another minor patch

Skinning and designing Serendipity (CSS, HTML, Smarty)
User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: another minor patch

Post by Don Chambers » Tue Feb 10, 2015 10:16 pm

So, can we get a smarty var for the archive path in 2.0.1?

User avatar
onli
Regular
Posts: 2221
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: another minor patch

Post by onli » Tue Feb 10, 2015 10:39 pm

Don, I'm not into the code at the moment. I guess that probably there exists a way, or rather, the original solution has to be fixed. I'd like to wait to have Garvin confirm he had a look at it or go into the code myself/try to really understand the problem by trying to reproduce the issue.

Is there already an issue for this on github? If not and you want to help further with this, it would be great of you open one with a really short and concise description of the bug/missing feature.

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

Re: another minor patch

Post by garvinhicking » Wed Feb 11, 2015 11:36 am

OK guys, here's what I found out:
  • $serendipityArchiveURL is a variable that gets assigned by serendipity_event_staticpage. It is *NOT* available in the core, and it is *NOT* available in every serendipity view. Thus, this variable is actually not even safe to rely on or to use *AT ALL*. :-)
  • Because of this, the variable is usually only used in the staticpage-entries-listing.tpl smarty file of the staticpage plugin, and there only to link to the first page of an entries listing.
  • This is actually NOT the archive (singular!) that Don wants to link to, so to use this variable is wrong in TWO ways, not only in one way. ;-)
  • Bottom of the line: What you want to use is to create a config.inc.php file for your template, do:

    Code: Select all

    $serendipity['smarty']->assign('archiveURL', serendipity_rewriteURL(PATH_ARCHIVE));
    
    and then refer to that variable. For serendipity 2.0.1/2.1.0 I have added serendpity_rewriteURL as a smarty modifier, so that in the future you can do:

    Code: Select all

    {$CONST.PATH_ARCHIVE|rewriteURL}
    
    within a template, which will also make other URL paths available, too.
HTH,
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
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: another minor patch

Post by Don Chambers » Wed Feb 11, 2015 5:19 pm

Sweet! Works exactly as I asked for. Thanks a bunch Garvin!

Post Reply