Sylvie,
About the generated code, you choosed an example where the title is
extremely simple. In general, you will have some links to edit templates
or for the help page on doc.tw.o... So, you can't simply compare like
this.
About the simplicity of title, it's like other recent smarty
functions/blocks that started with a few lines and are now quite
powerful. We may enhance title too, especially because it's widely used
in tiki. There can be some interesting improvements later.
Well... We could discuss hours on this but I think it's really useless.
The goal (compared to a template) is to have something more robust than
a template (point on which we agree) and easier to use. Think about a
more complex example like this :
{title}
{if $edit eq 'y'}{tr}Edit:{/tr}{else}{tr}View:{/tr}{/if}
{tr}My Item{/tr}
{/title}
It's easier than this :
{capture assign='title'}
{if $edit eq 'y'}{tr}Edit:{/tr}{else}{tr}View:{/tr}{/if}
{tr}My Item{/tr}
{/capture}
{include file='title.tpl' title=$title}
...
Btw, it seems we both agree that this change is in a good way (even if
not the best one) and better than nothing. When it will be deployed
everywhere, it will be even easier to simply change {title}...{/title}
by {include file='title.tpl' title=...} everywhere if we consider that a
template is better. So, I propose to stop loosing time to discuss this.
Nyloth.
-----Original Message-----
From:
tikiwiki-devel-bounces@...
[mailto:
tikiwiki-devel-bounces@...] On Behalf Of
Sylvie Greverend
Sent: Tuesday 8 July 2008 13:33
To: Tikiwiki developers
Subject: Re: [Tikiwiki-devel] [Tikiwiki-cvs/svn] SF.netSVN:
tikiwiki:[13457] branches/1.10/lib/smarty_tiki/block.title.php
On Tue, 2008-07-08 at 10:11 +0200, WEBER Patrice wrote:
> Hi Sylvie,
>
> All smarty functions and blocks should work in overloaded templates.
If
> it is not the case, this is a bug. In this case, I'll check and fix
it.
This is the code produced by the old solution
<h1><a class="pagetitle" href="tiki-view_tracker.php?trackerId=<?php
echo $this->_tpl_vars['trackerId']; ?>
">Tracker: <?php echo $this->_tpl_vars['tracker_info']['name']; ?>
</a></h1>
This is the code produces but the new block
<?php $this->_tag_stack[] = array('title', array());
$_block_repeat=true;smarty_block_title($this->_tag_stack[count($this->_t
ag_stack)-1][1], null, $t
his, $_block_repeat);while ($_block_repeat) { ob_start(); ?>Tracker:
<?php echo $this->_tpl_vars['tracker_info']['name']; ?>
<?php $_block_content = ob_get_contents(); ob_end_clean();
$_block_repeat=false;echo
smarty_block_title($this->_tag_stack[count($this->_tag_stack)-1][
1], $_block_content, $this, $_block_repeat); }
array_pop($this->_tag_stack); ?>
Obviously there is much code in the compiled templates - the second one
should be slower
>
> Using a smarty block does not really slow down tw, thanks to smarty
> cache (mainly).
>
> Comparing this solution to a template that could be included, I
clearely
> prefer using smarty blocks and functions. The main two reasons are :
>
> - the benefits of encapsulation : there will be no risks of conflicts
> between the main template and the code in smarty funciton or block,
> params/inputs will be clearely identified, ...1
ok - the only point I agree on.
>
> - the benefits of php code (compared to smarty code) : ability to do
> more evolved things because its written in php, easily reuse the
> function in a php code, ...
For a simple function like title - I do not see the benefit of using
php . For pagination... of stuff like that ok.
>
> By the way, nothing has been done until now, so even if you consider
> this solution is not perfect, IMHO it's a good start to make code
> cleaner, to greately reduce and simplify existing code, and to have he
> same behavior and look in every scripts.
An include tpl will simplify the code too and unify the look
My main objection is that a simple user/admin is loosing the ability to
change the look. Only a php dev with access the php files can change the
look now - and the overload of templates can not be used anymore -
function can be convenient for maintaining a site.
For complex functions I agree - for a simple function like title I do
not see the advantage
My 2 cents
Sylvie
>
> Cheers,
> Nyloth.
>
>
> -----Original Message-----
> From:
tikiwiki-devel-bounces@...
> [mailto:
tikiwiki-devel-bounces@...] On Behalf Of
> Sylvie Greverend
> Sent: Monday 7 July 2008 21:27
> To: Devel
> Subject: Re: [Tikiwiki-devel] [Tikiwiki-cvs/svn] SF.net SVN:
> tikiwiki:[13457] branches/1.10/lib/smarty_tiki/block.title.php
>
> I am a little septic to put all this in a smarty block
> People can not use any more the template overload.
> I will prefer to put this in an template taht is included
>
> and I am not sure if it is not slowing down tw - going through php
code
>
> My 2 cents
>
>
> On Mon, 2008-07-07 at 12:05 -0700,
pkdille@...
wrote:
> > Revision: 13457
> >
>
http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=13457&view=rev> > Author: pkdille
> > Date: 2008-07-07 12:05:55 -0700 (Mon, 07 Jul 2008)
> >
> > Log Message:
> > -----------
> > [MOD] smarty block title: adding alt on edit template icon
> >
> > Modified Paths:
> > --------------
> > branches/1.10/lib/smarty_tiki/block.title.php
> >
> > Modified: branches/1.10/lib/smarty_tiki/block.title.php
> > ===================================================================
> > --- branches/1.10/lib/smarty_tiki/block.title.php 2008-07-07
> 16:23:42 UTC (rev 13456)
> > +++ branches/1.10/lib/smarty_tiki/block.title.php 2008-07-07
> 19:05:55 UTC (rev 13457)
> > @@ -39,7 +39,7 @@
> >
> > if ( $prefs['feature_view_tpl'] == 'y' && (
$tiki_p_edit_templates
> || $tiki_p_edit_templates ) ) {
> > $html .= '<a href="tiki-edit_templates.php?template=' .
> $smarty->_tpl_vars['mid'] . '" target="tikihelp" class="tikihelp"
> title="' . tra('View tpl:') . ' ' . $content . '">'
> > - . smarty_function_icon(array('_id' =>
'shape_square_edit'),
> $smarty)
> > + . smarty_function_icon(array('_id' =>
'shape_square_edit',
> 'alt' => tra('Edit Template')), $smarty)
> > . "</a>\n";
> > }
> >
> >
> >
> > This was sent by the SourceForge.net collaborative development
> platform, the world's largest Open Source development site.
> >
> >
>
------------------------------------------------------------------------
> -
> > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> > Studies have shown that voting for your favorite open source
project,
> > along with a healthy diet, reduces your potential for chronic
lameness
> > and boredom. Vote Now at
http://www.sourceforge.net/community/cca08> > _______________________________________________
> > Tikiwiki-cvs mailing list
> >
Tikiwiki-cvs@...
> >
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs>
>
>
------------------------------------------------------------------------
> -
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at
http://www.sourceforge.net/community/cca08> _______________________________________________
> Tikiwiki-devel mailing list
>
Tikiwiki-devel@...
>
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel------------------------------------------------------------------------
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at
http://www.sourceforge.net/community/cca08_______________________________________________
Tikiwiki-devel mailing list
Tikiwiki-devel@...
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at
http://www.sourceforge.net/community/cca08_______________________________________________
Tikiwiki-devel mailing list
Tikiwiki-devel@...
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel