Tut site - GeSHi

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Tut site - GeSHi

Post 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.
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: Tut site - GeSHi

Post by egg82 »

you mean like this?
<SPAN style="BACKGROUND-COLOR: #ffff00">Text</SPAN>
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: Tut site - GeSHi

Post 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
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: Tut site - GeSHi

Post 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
Post Reply