I am confused about caching.

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
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

I am confused about caching.

Post by andrewvideouk »

I have made (copy 'n' pase code) ;) function and place in the plugs folder. Which is working great. Basic it making sure all urls, phones numbers are clickable and removes all emty html tags from content been given and other stuff. I noiced that WYSIWYG editors don't aways make the links clickable especially if they been copying and pase content from else where. (removing empty tags coming soon)

In the html I have the header
{content assign='capturedcontent'}
in the main body
{pagecleaner clean=$capturedcontent}

I want to know what is the best way to cache this so its don't load every page load.

I did look at this page https://docs.cmsmadesimple.org/general- ... g-in-cmsms I am bit lost.

I guess if you did this {capture assign='mycontent'}{pagecleaner clean=$capturedcontent}{/capture} that wouldn't cache it.

Sorry I am not been clear. Baiscy I want the content to be cache made by my pagecleaner.

The code I am using is from

https://github.com/kwi-dk/UrlLinker

you welcome to look at my messy function ;D Please don't laugh at me. I don't know much about php programing.

Thanks guys.
Attachments
function.pagecleaner.php.zip
(5.93 KiB) Downloaded 160 times
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3479
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: I am confused about caching.

Post by velden »

Consider checking the Event manager and put your code in a UDT.
ContentEditPre could be the right event to connect it to.
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: I am confused about caching.

Post by andrewvideouk »

Yes I know that would be the best route to use ContentEditPre and I have considered it but I can't find anything how to use ContentEditPre with UDT
I don't know how to call string (page, news or cal Content) that been submit and then save to the database after.
I would need a example of code of Getting page Content after been submited and the code to save it the to database. Without that I am dead in the water with ContentEditPre.

Me using ContentEditPre would be amzing as I would able to put lot more stuff in the code to clean up and adding filers to the Content been submited.
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: I am confused about caching.

Post by andrewvideouk »

Did try find this from other post few years ago i well try use with ContentEditPre

I hope this code works

Code: Select all

$content_obj =& $params['content'];
$text = $content_obj->GetPropertyValue('content_en');
$text = $content_obj->SetPropertyValue('content_en',$text);
$text = $content_obj->GetPropertyValue('myblock');
$content_obj->SetPropertyValue('myblock',$text);
How would I do it for the news content?

And thank you
Post Reply

Return to “Developers Discussion”