set a variable in dashboard and get it in php
Permalink
I am using Concrete5 Cache API to speed up my single page, and now i set cache timeout to be 10 minutes in my php, it is hardcoded.
What i want to do now is create a variable which tells how long should the cache exist in dashboard, and get it in php code, so that i can config the cache timeout in dashboard dynamically.
I saw the develop documentation about Attributes, but the documentation is really hard to understand and don't tell anything useful, so i have to ask here, is anybody know how?
Any help will be thankful.
What i want to do now is create a variable which tells how long should the cache exist in dashboard, and get it in php code, so that i can config the cache timeout in dashboard dynamically.
I saw the develop documentation about Attributes, but the documentation is really hard to understand and don't tell anything useful, so i have to ask here, is anybody know how?
Any help will be thankful.
found an easier way now:
create a page attribute with type number, and set it's value in single page.
in single page controller php file:
$c->getCollectionAttributeValue('attr_handle');
that's it!
Thanks anyway.
create a page attribute with type number, and set it's value in single page.
in single page controller php file:
$c->getCollectionAttributeValue('attr_handle');
that's it!
Thanks anyway.
You can also use $c->getAttribute() which is shorter and does the same thing.
it should have a textbox named "cache_time".
And in controller the code will be like
Then in frontend you can access the code through
The $cache_time will store the value you saved in dashboard.
Note: You need to replace the "theme_handle" with your themes handle. And change it when you change any theme accordingly.
Rony