Announcement

  •  » Engine
  •  » Smarty 3 upgrade

#1 2010-12-01 17:12:41

P@t
Piwigo Team
Nice
2007-06-13
4098

Smarty 3 upgrade

It would be great to upgrade to smarty 3 for piwigo 2.2, what do you think?
There is really great new features: http://www.smarty.net/v3_overview

Examples: javascript auto-escapement (no more literal or ldelim tags!), template objects (make template objects and execute them independently), variables filters, etc...

Maybe templates need a few changes... http://smarty-php.googlecode.com/svn/tr … 2_BC_NOTES


P@t

Offline

 

#2 2010-12-02 13:44:00

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13786

Re: Smarty 3 upgrade

javascript auto-escapement really looks interesting. Of course I think it's good to follow upgrades of Piwigo dependencies.

Negative notes:

* Smarty 3.0 was released on November 11th 2010 (4 weeks ago) so we can say that it could be a bit unstable considering it's a 100% rewrite.

* plugins may be broken

P@t, did you try to upgrade Smarty on your local copy to check if anything is broken?

Offline

 

#3 2010-12-02 15:09:15

rvelices
Former Piwigo Team
2005-12-29
1960

Re: Smarty 3 upgrade

plg wrote:

* Smarty 3.0 was released on November 11th 2010 (4 weeks ago) so we can say that it could be a bit unstable considering it's a 100% rewrite.?

3.0.0 November 11th, 2010 and then 5 another releases until 3.0.5 November 20th, 2010 - I think we should wait a bit but definitely migrate later...

Offline

 

#4 2010-12-03 10:14:53

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: Smarty 3 upgrade

rvelices wrote:

3.0.0 November 11th, 2010 and then 5 another releases until 3.0.5 November 20th, 2010 - I think we should wait a bit but definitely migrate later...

I don't agree... here is smarty 3 history releases:

Smarty 3.0.4 November 13th, 2010
Smarty 3.0.3 November 13th, 2010
Smarty 3.0.2 November 12th, 2010
Smarty 3.0.1 November 12th, 2010
Smarty 3.0.0 November 11th, 2010
Smarty 3.0rc4 October 5th, 2010
Smarty 3.0rc3 July 14th, 2010
Smarty 3.0rc2 June 14th, 2010
Smarty 3.0rc1 April 29th 2010
Smarty 3.0b8 March 5th, 2010
Smarty 3.0b7 Jan 17th, 2010

First beta released on january, and first RC released on april! We must trust smarty's developper... when piwigo 2.0 was released, do we tell users to wait for 3 or 4 month to upgrade? ;-)


P@t

Offline

 

#5 2010-12-03 10:17:00

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: Smarty 3 upgrade

plg wrote:

P@t, did you try to upgrade Smarty on your local copy to check if anything is broken?

Not yet, but I will soon... I think plugins won't be broken.


P@t

Offline

 

#6 2010-12-03 10:32:11

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13786

Re: Smarty 3 upgrade

Considering that Smarty 3.0rc1 was released 7 months ago (just like Piwigo 2.1.0) I think that Smarty 3.0 must be quite stable. OK, they have already released 5 bug fixing versions but it only shows that this is a very active project and this is a very good thing.

Please keep it for yourself ;-), but I don't think Piwigo 2.2.0 will be released before the end of 2010 unfortunately (but Piwigo 2.2.0RC1 I still have some hope). So the time Piwigo 2.2.0 is out, we will certainly update Smarty several times.

For me that's OK to upgrade Smarty, but before I would like to know if it breaks anything if we just replace the current Smarty library with Smarty 3.0.

Offline

 

#7 2010-12-03 11:22:44

LucMorizur
Member
Vienne (Isère) - France
2009-04-30
171

Re: Smarty 3 upgrade

No "perles collector" on this forum?

plg wrote:

Please keep it for yourself ;-)

:-D


Our gallery : Le Site à Nous (a silly name in french, but here I don't care ;-) ! )
An event, a new gallery ? Plugin Event Cats
My test gallery : Tests Piwigo de Luc
Thanksalot for this beautiful project.

Offline

 

#8 2010-12-04 13:31:14

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: Smarty 3 upgrade

So, I propose to do that:

- Update smarty to 3.0.5
- remove all {literal}, {/literal}, {ldelim} and {rdelim} tags
- remove useless @ before modifiers
- rewrite some tpl using new smarty functionnalities (like {function} for menubar_categories.tpl).

I also want to make piwigo Template class extending smarty class (class Template extends Smarty).
Why don't we move functions and modifier into smarty's plugins directory, as preconized here?


P@t

Offline

 

#9 2010-12-04 21:47:05

rvelices
Former Piwigo Team
2005-12-29
1960

Re: Smarty 3 upgrade

Ok for first part

P@t wrote:

I also want to make piwigo Template class extending smarty class (class Template extends Smarty).

Personally I think aggreagtion is better than inheritance in this case, but I'm not 100% sure

P@t wrote:

Why don't we move functions and modifier into smarty's plugins directory, as preconized here?

No, because I don't want to load 10 files for 10 simple functions such as translate, html_head and so on.

Offline

 

#10 2010-12-06 16:54:20

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: Smarty 3 upgrade

Ok.

I had two problems with smarty 3:

- There was a bug with empty function (return a notice if variable is unassigned). I reported the bug on smarty forum, and it is now fixed (http://www.smarty.net/forums/viewtopic.php?t=18490)

- With javascript auto-escapement, smarty do not accept white spaces after left delimiter (perfectly normal), but also do not accept white space before right delimiters (little bit strange, but "normal" according to them). So we need to remove all white spaces in our tpl files. But we also can fix that with a prefilter:

Code:

 static function prefilter_white_space_before_rd($source, $smarty)
  {
    $ld = $smarty->left_delimiter;
    $rd = $smarty->right_delimiter;
    $ldq = preg_quote($ld, '#');
    $rdq = preg_quote($rd, '#');

    return preg_replace("#$ldq(\S[^$ld$rd]*)\s+$rdq#", "$ld$1$rd", $source);
  }

rvelices, what do you think about that?


P@t

Offline

 

#11 2010-12-06 17:17:52

rvelices
Former Piwigo Team
2005-12-29
1960

Re: Smarty 3 upgrade

P@t wrote:

- With javascript auto-escapement, smarty do not accept white spaces after left delimiter (perfectly normal), but also do not accept white space before right delimiters (little bit strange, but "normal" according to them). So we need to remove all white spaces in our tpl files. But we also can fix that with a prefilter:
rvelices, what do you think about that?

For me it's fine either prefilter or impose no white space before }

Offline

 

#12 2010-12-06 23:45:48

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: Smarty 3 upgrade

rvelices wrote:

Ok for first part

P@t wrote:

I also want to make piwigo Template class extending smarty class (class Template extends Smarty).

Personally I think aggreagtion is better than inheritance in this case, but I'm not 100% sure

I think it's exactly the same, but it's clearer for me. And coders can easily use all smarty functions.
Also, a lot of functions have changed in smarty 3 (like clearAssign, getTemplateVars, etc...). But there is a backward compatability wrapper in smarty that allow plugins coders (for example) to get a notice with old functions.


P@t

Offline

 

#13 2011-03-14 18:10:16

flop25
Piwigo Team
2006-07-06
7037

Re: Smarty 3 upgrade

What about, now ?


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#14 2012-05-15 13:54:14

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13786

Re: Smarty 3 upgrade

Reminder: Piwigo didn't move to Smarty 3 because it requires PHP 5.2 and it was "too soon" to have such a requirement.

According to Wordpress.org statistics (which can be considered as identical to Piwigo installations), 99.9% websites are running PHP 5.2+. 7 months ago, it was 92.8%.

The PHP version no longer looks like a problem.

It's too late for Piwigo 2.4, but we can plan it for Piwigo 2.6. Not Piwigo 2.5, because we'll try to avoid breaking compatibility for plugins/themes.

Offline

 

#15 2012-05-15 14:58:40

rvelices
Former Piwigo Team
2005-12-29
1960

Re: Smarty 3 upgrade

plg wrote:

It's too late for Piwigo 2.4, but we can plan it for Piwigo 2.6. Not Piwigo 2.5, because we'll try to avoid breaking compatibility for plugins/themes.

I think we could do it with minimal impact to plugins/themes (if none ...)

Offline

 
  •  » Engine
  •  » Smarty 3 upgrade

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact