CodeIgniter Forums

Full Version: Reversing markup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

This isn't specific to CodeIgniter, but I'm using the Textile markup tool in an application that I'm building with CodeIgniter, so I figured I'd ask here in case anyone knew what to do:

Like I said I'm using Textile to automatically process the content textarea of a CMS I'm building, and want a way to reverse the Textile markup for editing purposes.

For example, if I write:
Hello, this is a paragraph

* This is a list item
* This is another list item

This is another paragraph, "and a link!":
And submit it to the database, the text is automatically converted to:
<p>Hello, this is a paragraph</p>

        <li>This is a list item</li>
        <li>This is another list item</li>

<p>This is another paragraph, <a href="">and a link!</a></p>
Obviously I love this feature, but would like to extend it a little more so that when I edit the article, the content body that loads is not the latter, but the former.

Does anyone know how I would do this? Google is being extremely unhelpful (automatically de-parsed back into Textile's formatting).

El Forum

Hey everyone, I actually decided to do something that I think works really well for this situation:

Rather than using a single field in the table for content, I decided to make two: content, and content_textile. That way I can use the content field for inserting and updating, and then process it with Textile for storage in content_textile. Then I just call the content_textile field in my views for display.

If anyone else is in the same boat I was, you might try out my solution. It's a little more work at first, but I think it's probably better in the long run.