Is there a library that .... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Is there a library that .... (/showthread.php?tid=29414) Pages:
1
2
|
Is there a library that .... - El Forum - 04-09-2010 [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! Is there a library that .... - El Forum - 04-09-2010 [eluser]WanWizard[/eluser] In the current version of our CMS we use GeSHI for code processing and syntax hightlighting. Converting it into a CI library is still on the todo list (at the bottom), but since it's a class, making it available as a CI library should be a breeze. Is there a library that .... - El Forum - 04-09-2010 [eluser]ShannenName[/eluser] How would I make it a class and am I allowed to do this? Is there a library that .... - El Forum - 04-09-2010 [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.bbcode-create.php#93349 Create a helper of that function so you can use it anywhere you like. Is there a library that .... - El Forum - 04-09-2010 [eluser]ShannenName[/eluser] I don't get what to put in the autoload function. I get this far then get stuck: Code: function __autoload Is there a library that .... - El Forum - 04-09-2010 [eluser]ShannenName[/eluser] delete this Is there a library that .... - El Forum - 04-09-2010 [eluser]cahva[/eluser] So you got it to work? Is there a library that .... - El Forum - 04-09-2010 [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 =( Is there a library that .... - El Forum - 04-09-2010 [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(); Is there a library that .... - El Forum - 04-09-2010 [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 |