Page 1 of 1

Tut site - GeSHi

Posted: Sun Oct 23, 2011 8:22 pm
by Pazuzu156
Hey, I'm using GeSHi for syntax highlighting my code. I know how to take code, and highlight it using GeSHi's functions, but what I'm trying to accomplish is taking a piece of code, and highlighting it, while also having other code snippets on one page using the same highlight.

Here is how I want it:

Code: Select all

$array = array(
    0    =>    array(
        'code'    =>    'code_snippet',
        'lang'    =>    'language'
    )
);
The code and the language are coming from a database. The reason I want this, is because I'm also allowing user created tuts to be submitted, and their code should be highlighted as well.

If anyone can help, please do.

Re: Tut site - GeSHi

Posted: Mon Oct 24, 2011 1:37 pm
by egg82
you mean like this?
<SPAN style="BACKGROUND-COLOR: #ffff00">Text</SPAN>

Re: Tut site - GeSHi

Posted: Mon Oct 24, 2011 5:05 pm
by Pazuzu156
No. GeSHi does the highlighting for you, and I already know how to use it. But I want to highlight text ONLY if there is a code snippet in the post. Like in this site with syntax=php

Re: Tut site - GeSHi

Posted: Mon Oct 24, 2011 9:08 pm
by egg82
ohhhhh, I see. Just use the same concept. Search the text for syntax=php and use GeSHi where the "start" and "end" tags are