I am using Joomla 1.5. and I am writing a blog in joomla and want to highlight some HTML and javascript code but when I save that article after inserting the HTML code as it is, it gets exicuted itself. I also tried it with codecitation plugin but no result. If you people have any solution then please reply.
-
what was wrong with the codecitation plugin? – WooDzu Nov 30 '11 at 09:47
-
http://stackoverflow.com/questions/8306553/i-am-using-html-snippet-in-to-hightlight-html-and-javascript-code-in-blog-joomla/8311560#8311560 – SMacFadyen Nov 30 '11 at 11:00
-
I answered this question exactly how you should do it. Install the Blank Module extension/module, and put your code in there and load it in your article. – SMacFadyen Nov 30 '11 at 11:01
-
@WooDzu I don't know but even other plugin with same functionality is not working. Actually it is working well to highlighting other code but only problem with HTML and JavaScript. – RoyalEnfy Nov 30 '11 at 11:29
-
@SMacFadyen I have tried that also using Custom HTML module. But what the problem is that HTML code is executed in that custom HTML module also. – RoyalEnfy Nov 30 '11 at 11:32
5 Answers
Use a <pre>
tag it should work.
e.g.
<pre><html><\html></pre>

- 14,098
- 13
- 34
- 50
-
I enter the code in HTML window(window that opens after clicking HTML button) – RoyalEnfy Dec 01 '11 at 09:56
-
Really :), don't know why it is not working for me. are you working on joomla 1.5? – RoyalEnfy Dec 01 '11 at 10:44
-
no I tested it on 1.7. but It should work on 1.5 also. If its not working add a image. – Sara Dec 01 '11 at 10:55
-
I was thinking about adding image, but the problem is I want to allow people to copy that code. which is not possible with image. – RoyalEnfy Dec 01 '11 at 10:57
Sorry for coming late to the party. I used an extension called Easy Script. Just download, install and paste your script in your article manager and Boom. It even supports Bootstraps and other scripts as well.. Just give is a trial

- 902
- 15
- 23
In your blog try "& lt;" (without space) to write < and "& gt;" (without space) to write > in your HTML Code.
This syntax is used to write "<" and ">" symbols on some web page. Otherwise it will treat your code as part of the blog article and will show its output.

- 14,813
- 5
- 66
- 90
-
It works only for ones but when i save that page and again open to update, that code is executed. – RoyalEnfy Nov 30 '11 at 07:47
You can use <pre>
and <code>
tags.
Also Joomla has a native plugin to display code and syntax highlighting, based on the Geshi project.
It's easy to use, just be sure it is enabled in your plugins config:
<pre lang="html" >
<p> some text </p>
</pre >
Hope it helps!

- 111
- 3
-
I was not aware about Geshi project thanks for that, but the problem not solved yet. – RoyalEnfy Dec 01 '11 at 09:57