How-To Categories
Recent How-To's
News Feed E-mail
Login
| How to use the GeSHi plugin/mambot |
|
|
|
| Written by Cory | |
| Tuesday, 22 July 2008 | |
|
Joomla! comes with a plugin/mambot called GeSHi that comes in quite handy if you have a site like HowToJoomla.net in which you share code snippets with your readers. I recently tried to use GeSHi on a Joomla! 1.5 site, and I found that it works differently in Joomla! 1.5 than it does in Joomla! 1.0. Read on to see how to use it in both. What is GeSHi?GeSHi stands for "Generic Syntax Highlighter", and it is used to highlight code snippets in different web languages like PHP, HTML, and CSS. It also converts tags in those languages so that they will not render like regular tags. For example, if you want to share some HTML code, you have to use something like GeSHi, or the browser will treat your HTML code like regular HTML code. The following code is done without GeSHi: Without GeSHi The following code is done with GeSHi: <p><strong>With GeSHi</strong></p> Not that in the code with GeSHi, you can see the HTML tags, and in the code without GeSHi, you cannot see the HTML tags. The words "Without GeSHi" are rendered like regular HTML How to use GeSHi in Joomla! 1.0To use GeSHi in Joomla! 1.0, you use the following HTML code:
<pre lang="html">
<!-- your HTML code here -->
</pre>
You can change 'lang="html"' to other languages like 'lang="php"' so that GeSHi highlights it according to the language you are using. How to use GeSHi in Joomla! 1.5GeSHi has a very slight difference in Joomla! 1.5. Here is an example: <pre xml:html> <!-- your HTML code here --> </pre> Note that instead of 'lang="html"', you use 'xml:html'. That is the only difference. I'm not sure why they did it that way, but they did so if yo plan on using GeSHi for Joomla! 1.5, you need to be aware of this. Questions/CommentsAs always, questions and comments are welcome.
Set as favorite
Bookmark
Email This
Hits: 1105 Trackback(0)
Comments (6)
![]()
Jason Boyette: ... http://www.jkboyette.com
Thanks for this. Do you know of any place where you can get all the syntax requirements for GeSHi in 1.5?
1 report abuse
vote down
vote up
July 24, 2008
Votes: +0
Jason Boyette: ... http://www.jkboyette.com
You say for 1.0,
You can change 'lang="html"' to other languages like 'lang="php"' so that GeSHi highlights it according to the language you are using. In 1.5, if you want to display PHP code, do you change it to ? How about CSS? I'm looking for a resource for the syntax inside the tag. Maybe I'll just use the old trial-and-error method. 3 report abuse
vote down
vote up
July 24, 2008
Votes: +0
Jason Boyette: ... http://www.jkboyette.com
Shoot, the comment system removed my tags!
4 report abuse
vote down
vote up
July 24, 2008
Votes: +0
Jason Boyette: ... http://www.jkboyette.com
Thanks! That's what I was looking for. If I find any more information, I'll write back.
6 report abuse
vote down
vote up
July 24, 2008
Votes: +0 Write comment
|
| < Prev | Next > |
|---|








