Feature Request [# 2100] More flexibility to template/theme management
Tags:   No tags associated yet.

  Go back
 Target:  --  Category:  Layout
Description:
Hello,

The new template management is great in VM 1.1 (as all others features). But , I think we can give further un flexibility : (The following is of course based on my experience on my own site).

As i have special templates for displaying a product_details page, I have to change not only the theme but also the page shop.product_details as all variables i need are not exported to the template. (I dislike change the core file as it drives always on the long run to migration problem.

To solve that and give full access in template file for all variables used in core files, here is my suggestion :

At the beginning of the file that will use templates, we create an object $var = new varObj; where varObj is defined as

class varObj {
	function __set($varname,$value)
	{
		$this->{$varname} = $value;
	}
}
For all variables used (or defined) in this file we replace ($varname = .... or .... = $varname) by $var->varname = ... or ... = $this->varname.

At this time, we can suppress all $tpl->set( ...) and adding the argument $vat to the template fetch function call the fetch function will not need anymore to call extract() function.

In template, retrieve or use a variable will easy as <?php echo $var->xxx; ?>

If it sounds good for you i can make a full test on a shop.browse file .

Patrick

(We can have moreover some enhancement with the get function in the case we call in template a variables not defined. It would be good to warn the developer)

Details:
Submitted Comment
pcollet
Jun 19
Damn, It could be possible (I didn't ask myself the question as i do my dev in PHP5). After a check, set is for PHP5 only.
soeren_nb
Jun 19
Sounds good, but I think this feature would require PHP5, right?