Open Power Template 2.x family
PLEASE PROVIDE THE TEMPLATES AND/OR PHP CODE IN THE TASK DESCRIPTION (Not URL-s to them). THAT ALLOWS US TO REPRODUCE THE PROBLEM! OTHERWISE WE ARE NOT ABLE TO HELP YOU!
Remember to hide all the security-related pieces of code from the task description, like passwords, server paths etc. for your own safety. Once we close the task, we cannot edit it anymore!
PLEASE PROVIDE THE TEMPLATES AND/OR PHP CODE IN THE TASK DESCRIPTION (Not URL-s to them). THAT ALLOWS US TO REPRODUCE THE PROBLEM! OTHERWISE WE ARE NOT ABLE TO HELP YOU!
Remember to hide all the security-related pieces of code from the task description, like passwords, server paths etc. for your own safety. Once we close the task, we cannot edit it anymore!
FS#49 - No API for retrieving variables in Opt_View
Attached to Project:
Open Power Template
Opened by Jacek Jędrzejewski (eXtreme) - Saturday, 31 January 2009, 03:49 GMT-8
Last edited by Jacek Jędrzejewski (eXtreme) - Friday, 06 February 2009, 03:55 GMT-8
Opened by Jacek Jędrzejewski (eXtreme) - Saturday, 31 January 2009, 03:49 GMT-8
Last edited by Jacek Jędrzejewski (eXtreme) - Friday, 06 February 2009, 03:55 GMT-8
|
Details$_data is private in Opt_View so there is no way to read the content of set variables. There should be a magic __get function (and "classic" function equivalent like with __set and assign) to make possible working like with symfony: (pseudo-code below)
$view->article = get_article_from_db(); if(!$view->article) { throw new Error404Exception(); } And I suggest to make also magic functions __isset and __unset as aliases for defined() and remove(). |
This task depends upon
Closed by Jacek Jędrzejewski (eXtreme)
Friday, 06 February 2009, 03:55 GMT-8
Reason for closing: Implemented
Additional comments about closing: Implemented in rev. 48
Friday, 06 February 2009, 03:55 GMT-8
Reason for closing: Implemented
Additional comments about closing: Implemented in rev. 48
Comment by Jacek Jędrzejewski (eXtreme) -
Tuesday, 03 February 2009, 04:21 GMT-8
I attach a patch which adds those methods. It was tested and works. I don't apply it util Zyx approves this feature.
Comment by Zyx (Zyx) -
Tuesday, 03 February 2009, 09:50 GMT-8
I know that those methods are missing. My intention was not to use OPT as a data container for the script, like it is shown in your example. Exceptions were invented to handle such situations - they should be generated directly by get_article_from_db() and by catching them, you decide, what to do next.
Comment by Jacek Jędrzejewski (eXtreme) -
Tuesday, 03 February 2009, 12:46 GMT-8
But why not? I provided just a simple example. While working with symfony and its view I become convinced there are many other situations it can be useful (I mean even reading the content of a variable). It also may become necessary for making framework ports in the future. In OPT1.x $data was public and I used this "feature" many times.
view.patch
(0.9 KiB)