How can i add a code snippet to an article?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
outsideritc
New Member
New Member
Posts: 3
Joined: Fri Aug 17, 2012 11:21 am

How can i add a code snippet to an article?

Post by outsideritc »

hello, sorry but im loosing a lot of time about discovering how to insert a code snippet like this one:

Code: Select all

div#news {
/* margin for the entire div surrounding the news items */
	margin: 2em 0 1em 1em;
/* border set here */
	/*border: 1px solid #909799;*/
/* sets it off from surroundings */
	background: #ffffff;
}
in a page or in a news article.

Nore microtiny nore other wysiwyg editors have such a function, and if i do it directly in the html code i get a smarty error also if i use such a

Code: Select all

{literal}
the tag

Code: Select all

<pre>
has a black backgroud-color that i can't apparently change....

Any help please?
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: How can i add a code snippet to an article?

Post by Jos »

Why not put it in a stylesheet where it belongs?
Last edited by Jos on Fri Aug 17, 2012 11:53 am, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: How can i add a code snippet to an article?

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: How can i add a code snippet to an article?

Post by Jos »

Oke I'm sorry.. I misunderstood :-X
outsideritc
New Member
New Member
Posts: 3
Joined: Fri Aug 17, 2012 11:21 am

Re: How can i add a code snippet to an article?

Post by outsideritc »

hi Rolf... thank you but it doesn't works.

Having installed Geshi, not only cmsms does not show the preformated code but it breaks all css and the site flush get broken after the code to be formatted :-(
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: How can i add a code snippet to an article?

Post by Dr.CSS »

To me/us that looks like CSS which goes in a style sheet, maybe it would help if you explained a little more fully what you mean by "how to insert a code snippet like this one" ...
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: How can i add a code snippet to an article?

Post by Rolf »

I used it for http://docs.cmsmadesimple.org/layout/ex ... e-template and it does work...
Perhaps check all steps again?
Did you use the literal tags too?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
outsideritc
New Member
New Member
Posts: 3
Joined: Fri Aug 17, 2012 11:21 am

Re: How can i add a code snippet to an article?

Post by outsideritc »

Just to avoid misunderstanding : my need was not to ad CSS instructions to my template, but to post out some code snippet formatted and indented to some technical articles that i have to publish.
I could be as CSS as Php as Python:

Code: Select all

>>> a = 12
>>> b = 3
>>> print a,b,(a – b)
12 3 9
I solved it at the moment with a hack that perhaps works, but it is surely not correct:

1) I have observed that for any reason, unknown to me, that the instructions

Code: Select all

<pre>
{literal}
//my code sample
{/literal}
</pre>
was originating a black background with lenght 100% .
I jus have added to main main_css_file.css the instructions:

Code: Select all

div#pre_box{
color:#ffffff;
}
then in the page or news article i insert this instruction:

Code: Select all

<div id="pre_box">
<pre>
{literal}
//my code sample
{/literal}
</pre>
</div>
and cmsms display my sample code pre-formatted but in white color on a black background.
Not so beautiful but working.
Maybe somebody has a better solution?
Post Reply

Return to “CMSMS Core”