Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Content Filters

Go to End

3 Posts   2190 Views

Nathan Cox

Community Member, 99 Posts

25 July 2007 at 1:47pm


Tell me if something like this exists, but I'm thinking it would be useful to have some kind of content filter system...something that lets you apply filters/make changes to content before it gets displayed on the page.

I was thinking two potential uses:

1) automatically adding <acronym> or <abbr> tags, or styling external links differently. For example, have a filter object that finds the first occurrence of "CSS" in the page content and replaces it with "<acronym title='Cascading Style Sheets'>CSS</acronym>".

2) putting page properties in the content. If you want a contact page that has a few paragraphs of content, then displays a contact form, then has some more content it would be great to be able to put something like {$Form} in the content and have it replaced with the page's form on the frontend.



Administrator, 690 Posts

25 July 2007 at 8:07pm

Good idea, but this would be quite site-specific.

The simplest thing way to implement this on a site would be to create a Content() method that returned some processed version of $this->Content.

This works because
* The editing form will only look at $this->Content
* The template will prefer to use $this->Content() over this->Content

So, add something like this in your Page class...

function Content() {
  return str_replace('GPL', '<abbr title="GNU Public License">GPL</abbr>', $this->Content);

Nathan Cox

Community Member, 99 Posts

27 July 2007 at 9:11am

You know, I didn't think of that...I guess in most cases there might not be enough benefit to having a dedicated system for it.