Currently, i'm using Smarty 3 in all my projects.
I'm trying to evaluate dooview and what it's missing so that i can use it instead of smarty and, so far, i found 6 features i miss so that i can start thinking about smarty-dooview porting. These features are really useful and i think dooview and all designers that will work with it can really benefit.
- function arguments as associative array
This can be really usefull. Not all parameters are needed and designer should only defined what he want. Instead of just- Code: Select all
{{funct(par1,par2)}}
dooview could accept associative array- Code: Select all
{{funct(str=something total=3 att=true)}}
where template function will only accept one argument.. an array- Code: Select all
function funct( $params ){
$params['str'] // 'something'
$params['total'] // 3
$params['att'] // true
}
- modifiers
Yes, doophp supports modifiers (these can be interpreted as standard functions) but.. if you have 4.. 5.. in same call the syntax will become a mess:- Code: Select all
{{upper(bigger(truncate(margeit(addit(something)),3,60)),5)}}
What do you think to include a better/cleaner syntax:- Code: Select all
{{something|addit|margeit|truncate:3,60|bigger|upper:5}}
- calling class methods?
Currently it's possible to access object variables- Code: Select all
{{winner.@Physical}}
Executing object methods is really needed- Code: Select all
{{winner->getPhysical}}
{{winner->getPhysical(1,2,3)}}
{{winner->getPhysicals(color=red attribute=true)}} //asssociative
- dooview method to compile custom tags.
Imagine i have a tag 'mytag' that is always '12345' and i don't want to be dynamic, i mean i want to be really 12345 in php template file. Currently, i can assign 12345 to a data variable and display it.. but i don't want that. i want to compile it and make it static:- Code: Select all
$myview->addCustomCompile( 'mytag', '12345' );
basically, this will become a entry inside DooView::compileTags()- Code: Select all
function DooView::compileTags(){
...
$str = str_replace('mytag', '12345', $str);
...
return $str;
}
- on loops, how to check if iteration is first or last?
- Code: Select all
<!-- loop users -->
{{users' v}}
<!-- if users' first --> ...
<!-- elseif users' last --> ...
<!-- endif -->
<!-- endloop -->
- secondary view path. this is that most important feature i needed
By default, dooview will search for original html files inside a primary folder (eg, protected/view/). currently i have a engine that will search inside the primary folder but, if template file not found, will search inside a secondary folder.
Imagine you have 100 template folders, all template folder must have same structure! that's what i want to avoid!
if the current template folder (eg, 86th theme folder) don't have the needed template file, the template engine will search for it in the core template view folder (where it exists for sure). This means that a template designer only need to create a html file if he don't want the output of the core template file.
A way to define a secondary folder for dooview is really needed for me.
regards
Francisco A
