Ultimate Geshi plugin in Joomla

Sun, Jan 4, 2009

Joomla Tutorials

Ultimate Geshi plugin in Joomla

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.0

To 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.5

GeSHi 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.

Reblog this post [with Zemanta]

Related Posts

  1. Choosing right host for joomla
  2. Designing an elegant Joomla Photo Gallery Template
  3. Joomla – Award Winning CMS review
  4. SIFR with Joomla
, ,

7 Responses to “Ultimate Geshi plugin in Joomla”

  1. diggah Says:

    what an ultimate tutorial :D !!! Thanks a ton for it…

  2. WillianBR Says:

    I’m using Joomla v1.5 and “TinyMCE 2.0″.
    Any time I try to use Geshi tags, it’s clean up by editor.

    SELECT * FROM tabela;

    SELECT * FROM tabela;

    It’s never work.

    When a I came back to source HTML view, the PRE tag is only.

    Can you help me?

    Thanks

  3. WillianBR Says:

    Sorry! It’s:

    <pre xml:lang=”sql”>
    SELECT * FROM tabela;
    </pre>

    <pre xml:lang=sql>
    SELECT * FROM tabela;
    </pre>

  4. Rick Satmary Says:

    I love your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to design my own blog and would like to find out where u got this from. thank you.


Trackbacks/Pingbacks

  1. [...] Ultimate Geshi plugin in Joomla [...]

  2. [...] Ultimate Geshi plugin in Joomla [...]

  3. [...] Ultimate Geshi plugin in Joomla [...]

Leave a Reply