Controller page, iframe
Permalink
Hi
I have a custom 'controller page' what I run in an iframe. This page uploads images to the server and show the thumbnails of them. But it isn't part of the page, so for example the 'C5_EXECUTE' isn't defined. That's why I can't reach non of the system variables. But I would like to know the id of the user.
I hope it can be done! Thanks for the help!
I have a custom 'controller page' what I run in an iframe. This page uploads images to the server and show the thumbnails of them. But it isn't part of the page, so for example the 'C5_EXECUTE' isn't defined. That's why I can't reach non of the system variables. But I would like to know the id of the user.
I hope it can be done! Thanks for the help!
![JohntheFish](/files/avatars/51576.jpg)
If you put your custom controller in a C5 tools file, you get a minimal C5 environment with none of the usual page overhead. It provides better security, id of user etc, libraries, helpers ...
And how can I do that? Just copy my file to the tools folder in the root directory of my site, or I have to add it to a list somewhere on the dashboard?
Pretty much yes.
http://www.concrete5.org/documentation/developers/system/directory-...
Have a look at code within the core /tools or various packages /tools for some ideas. But genrally, you just put a php script in yoursiteroot/tools, prepend it with the execute or die, let it take parameters from $_POST or $_REQUEST, then end it with an 'exit' statement;
You load your iframe from yoursite.com/tools/your_toolfile_name.php.
It can then get at any of your c5 site with the usual Loader:: facilities.
"A tool script is a simple PHP script either in your local tools/ directory or your block's tools/ directory. This script has no UI wrapped around it. It's lightweight, and simply loads a number of concrete5 objects and connects to the database. Otherwise, you're free to do what you wish inside it."
(from http://www.concrete5.org/documentation/how-tos/developers/javascrip... )
http://www.concrete5.org/documentation/developers/system/directory-...
Have a look at code within the core /tools or various packages /tools for some ideas. But genrally, you just put a php script in yoursiteroot/tools, prepend it with the execute or die, let it take parameters from $_POST or $_REQUEST, then end it with an 'exit' statement;
You load your iframe from yoursite.com/tools/your_toolfile_name.php.
It can then get at any of your c5 site with the usual Loader:: facilities.
"A tool script is a simple PHP script either in your local tools/ directory or your block's tools/ directory. This script has no UI wrapped around it. It's lightweight, and simply loads a number of concrete5 objects and connects to the database. Otherwise, you're free to do what you wish inside it."
(from http://www.concrete5.org/documentation/how-tos/developers/javascrip... )