Replacing part of content before render

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Fatin
New Member
New Member
Posts: 3
Joined: Wed Jun 08, 2011 8:49 am

Replacing part of content before render

Post by Fatin »

Hi,
I add content page in Administration Panel of CMS MS. In this content I have few images. Before displaying it on page I want to replace each "img src" string with 'img class="example_class" src'. I was looking for a part of code which is responsible for displaying content on page, but after a few hours I didn't find it....
uniqu3

Re: Replacing part of content before render

Post by uniqu3 »

Do you mean the content that is entered in TinyMCe and called with {content} in template?
In TinyMCE you can add a class to image, when adding it in content.

So in the image popup of TinyMCE there is tab appearance, where you can select a class available from your stylesheet.

Else is it's all images inside {content} tag you could use smarty replace like {content|replace:'<img':'<img class="example_class"'}

Else you should be more specific, what content and what images ;)
Fatin
New Member
New Member
Posts: 3
Joined: Wed Jun 08, 2011 8:49 am

Re: Replacing part of content before render

Post by Fatin »

Thank you for your reply ;) I know that I can add class to img in TinyMCE, my client also knows it, but sometimes he didn't remember ;) So I think that the best issue will be adding class name to img before displaying it using php. So I can't find place in source where is it getting from database before render...
nervino
Power Poster
Power Poster
Posts: 448
Joined: Sun Dec 28, 2008 12:15 pm
Location: Roma, Italy

Re: Replacing part of content before render

Post by nervino »

If you want to style each image in content or in a part of it (and if I understood correctly what you need), why don't use stylesheet's rules?
For example, if you have a content area in a div with id="mydiv" you can make a stylesheet rule: #mydiv img {whatever..}.
Post Reply

Return to “Developers Discussion”