17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1604 Views |
-
Content Filters

25 July 2007 at 1:47pm
Hi,
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.
Thoughts?
-
Re: Content Filters

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->ContentSo, add something like this in your Page class...
function Content() {
return str_replace('GPL', '<abbr title="GNU Public License">GPL</abbr>', $this->Content);
} -
Re: Content Filters

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.
| 1604 Views | ||
|
Page:
1
|
Go to Top |


