Mini Textile Library - Updated |
[eluser]Lone[/eluser]
If you are not familiar with what textile is please click here. I love using Textile for the output of textarea boxes on any websites that we do as it is a simple markup language that still makes some sense unformatted. TextilePHP and CI I actually started off usi_ng the TextilePHP class with instructions for implementation in CI from the CI Wiki. But one offsetting thing for me was the sheer size of the class and the fact that it add another 1.2mb to memory usuage in CI. Let's minimify! I have come to the realisation that there are four main features of Textile that I only use so decided to make a small helper file that just carried on these main features that I used it for. So what can it do? You send the helper function a string that has been written using the textile style and it will return the HTML for output. Currently it will interpret only the following textile formats: - Paragraphs (<p> ![]() - Line breaks (<br /> ![]() - Strong/bold (<strong> ![]() - Emphasis (<em> ![]() So how do I use it? First of all save the following code snippet to your application/libraries dir as 'Minitextile.php' Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Now you need to load the library, you can either autoload it to your autoload.php (recommended) or just use: Code: $this->load->library('Minitextile'); To use the function it is as easy as: Code: echo $this->Minitextile->process($string); I plan to extend this down the track but it serves its purpose for now and Im certain it will be handy for some people on here. Also, if you find any bugs please let me know in here! |
Messages In This Thread |
Mini Textile Library - Updated - by El Forum - 01-23-2008, 12:59 AM
Mini Textile Library - Updated - by El Forum - 01-23-2008, 01:40 AM
Mini Textile Library - Updated - by El Forum - 01-23-2008, 02:05 AM
Mini Textile Library - Updated - by El Forum - 01-23-2008, 02:38 AM
Mini Textile Library - Updated - by El Forum - 01-23-2008, 02:58 AM
Mini Textile Library - Updated - by El Forum - 01-23-2008, 04:54 AM
Mini Textile Library - Updated - by El Forum - 01-23-2008, 07:36 AM
Mini Textile Library - Updated - by El Forum - 01-23-2008, 07:42 AM
Mini Textile Library - Updated - by El Forum - 01-28-2008, 03:45 PM
Mini Textile Library - Updated - by El Forum - 05-16-2008, 06:15 AM
Mini Textile Library - Updated - by El Forum - 05-18-2008, 04:11 AM
|