The Serendipity Handbook

You can now read the (german) handbook here: PDF - https://github.com/s9y/Book (LaTeX source).

Forum-Information

Before posting about errors, make sure that the answer cannot already be found in our FAQ or by searching this forum!
Posting is restricted to registered users (registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.

Board index Themes Template Developers: Please update entries.tpl!

Skinning and designing Serendipity (CSS, HTML, Smarty)
User avatar
garvinhicking
Core Developer
 
Posts: 29346
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Mon Jan 21, 2013 10:42 am

Hi!

Since Serendipity 1.7 we use Smarty3. This requires a small change in templates' entries.tpl files.

Within the main loop for entries:

Code: Select all
{foreach from=$dategroup.entries item="entry"}


you now need to add one line after that loop, so that it looks like this:

Code: Select all
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}


This line ensures, that {$entry} will be available in sub-templates like comments.tpl and trackbacks.tpl.

This change does not hurty older installations with Smarty2. If you are distributing commercial templates, you might want to contact your customers to update their templates, once they also upgrade their Serendipity installation to 1.7 (or 2.0).

Regards,
Garvin.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
Timbalu
Regular
 
Posts: 3587
Joined: Sun May 02, 2004 3:04 pm

Postby Timbalu » Mon Jan 21, 2013 11:37 am

please better use
Code: Select all
{assign var="entry" value=$entry scope="parent"}
with quotes, or
Code: Select all
{assign var="entry" value=$entry scope="root"}
with works same in this case.
Regards,
Ian

User avatar
yellowled
Regular
 
Posts: 5354
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Mon Jan 21, 2013 1:58 pm

garvinhicking wrote:This requires a small change in templates' entries.tpl files.

Within the main loop for entries:

Code: Select all
{foreach from=$dategroup.entries item="entry"}


you now need to add one line after that loop, so that it looks like this:

Code: Select all
{foreach from=$dategroup.entries item="entry"}
{assign var="entry" value=$entry scope=parent}


I was just thinking, it might not be just that simple. If a template contains .tpl files which also loop through said loop (which happens in complex, magazine-style templates), this would have to be assigned in any .tpl file which uses this loop, wouldn't it?

YL

User avatar
yellowled
Regular
 
Posts: 5354
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Mon Jan 21, 2013 3:09 pm

Happy to announce that all 25 themes which are available on http://yellowled.de/templates.html and http://yellowled.de/ports.html have just been updated with the compatibility code as provided by Garvin. Of course, you still need to update them manually.

(Gosh, I hope we're not going to have something similar anytime soon.)

YL

User avatar
Timbalu
Regular
 
Posts: 3587
Joined: Sun May 02, 2004 3:04 pm

Postby Timbalu » Mon Jan 21, 2013 3:27 pm

(Yes, I know its working without, ) but why without the quotes? This is much cleaner code {as you can use simple value=$foo vars without or complicated ones with backticks or {$bar} - and every string usage better as a quoted "string". If we/you have to change every single template we can reach it is better to do it right, IMHO.
Regards,
Ian

User avatar
yellowled
Regular
 
Posts: 5354
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Mon Jan 21, 2013 5:19 pm

Can't really say. I'm just assuming Garvin's code is okay.

This assumption worked quite well over the past … wow, it's been seven years. :)

YL

User avatar
garvinhicking
Core Developer
 
Posts: 29346
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Mon Jan 21, 2013 7:40 pm

Hi!

We'll stick to the working version now, I'd say. If there are no more objections I'll try to put up rc2 somewhen tomorrow!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
Timbalu
Regular
 
Posts: 3587
Joined: Sun May 02, 2004 3:04 pm

Postby Timbalu » Mon Jan 21, 2013 7:55 pm

I don't really understand these two answers ... :?
I was talking about the better/cleaner use of quoting for the scope parent string only, which is done now. And I'm happy! :P
Regards,
Ian

User avatar
yellowled
Regular
 
Posts: 5354
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Mon Jan 21, 2013 8:46 pm

garvinhicking wrote:We'll stick to the working version now, I'd say. If there are no more objections I'll try to put up rc2 somewhen tomorrow!

I was a tad quicker in replacing them with the quoted version this afternoon, which explains Timbalus confusion. :)

YL

User avatar
yellowled
Regular
 
Posts: 5354
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Mon Jan 21, 2013 8:47 pm

yellowled wrote:If a template contains .tpl files which also loop through said loop (which happens in complex, magazine-style templates), this would have to be assigned in any .tpl file which uses this loop, wouldn't it?

Anyone got some insight on this? Is the assign statement needed anywhere the foreach loop is used or just in the entries.tpl?

YL

User avatar
garvinhicking
Core Developer
 
Posts: 29346
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Tue Jan 22, 2013 10:47 am

Hi!

Anyone got some insight on this? Is the assign statement needed anywhere the foreach loop is used or just in the entries.tpl?


Do you have a precise example? If you can simply test it by checking

Code: Select all
<pre>{$entry|@print_r}</pre>


in the files where you re-use $entry, you should see if its assigned or not...?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
 
Posts: 5354
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Tue Jan 22, 2013 11:51 am

garvinhicking wrote:Do you have a precise example?

No core template, but some of the more complex, magazine style templates on Spartacus use it e.g. to display articles differently on the start page. I'll test those later today.

YL

User avatar
yellowled
Regular
 
Posts: 5354
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany

Postby yellowled » Tue Jan 22, 2013 12:11 pm

https://dl.dropbox.com/u/691134/test-ou ... reused.txt

That's the output of the single entry view using entries_single.tpl in Mimbo, which also uses the foreach loop. Judging from this – Mimbo only has the assign statement in entries.tpl –, I'd say it's working the way it's supposed to. :)

YL

User avatar
Don Chambers
Regular
 
Posts: 3150
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Tue Jan 22, 2013 10:43 pm

Been busy guys. Will definitely need to test this with Kinetic, which I may not get to for a few days.

abdussamad
Regular
 
Posts: 117
Joined: Fri Apr 21, 2006 10:11 pm
Location: Karachi, Pakistan

Postby abdussamad » Tue Feb 26, 2013 2:54 am

What about the templates on Spartacus? Will those be updated automatically?

Next


Return to Themes

Who is online

Users browsing this forum: No registered users and 1 guest

cron