Is there a library that .... |
[eluser]ShannenName[/eluser]
I have this situation: I want users to post code and for the system to automatically escape and format anything in a Code: [code] EXACTLY like CI forums code box does. Is there a library or plugin or something for this? I would look this up for myself but I don't know what this process is called!
[eluser]ShannenName[/eluser]
How would I make it a class and am I allowed to do this?
[eluser]cahva[/eluser]
There is an easy way to get GeSHi working right away. First add autoloading(PHP5 feature) as described here. Basically you only need to add that __autoload function to your config.php. Then download geshi from the site, and copy geshi.php and geshi folder to application/libraries. Rename geshi.php to GeSHi.php (thats the name of the class and autoload will find it also in *NIX systems which are case sensitive). Then you're ready to go. Test it: Code: <?php For the bbcode, you can look into this basic function to parse bbcode tags: http://www.php.net/manual/en/function.bb....php#93349 Create a helper of that function so you can use it anywhere you like.
[eluser]ShannenName[/eluser]
I don't get what to put in the autoload function. I get this far then get stuck: Code: function __autoload
[eluser]ShannenName[/eluser]
Oh no just that post wasn't sent properply. It was a double post but my internet cut out and something happened to it. Problem not solved =(
[eluser]cahva[/eluser]
Ok So as in the blog post, just add this bit of code to file application/config/config.php: Code: /* What that autoload does,is that when you put code anywhere in controllers, models, helpers or libraries like this: Code: $foo = new Foo();
[eluser]pickupman[/eluser]
I downloaded the geshi source and converted it to a CI library. Download the attached zip file and place into your /application/libraries folder. Here's how you can use it: Code: $this->load->library('geshi'); The file is too big to attach to the post, so I have posted it on my website. Dowload Here |
Welcome Guest, Not a member yet? Register Sign In |