Page 1 of 1

entry-time in footer -> link to archive by date

Posted: Mon Jul 31, 2006 12:31 am
by stm999999999
Some themes have the time / date of the entry in the footer:

it often looks lieke this:

author - categories - time - comments - trackbacks

There "time" links in most cases to the article themselves - something you did not need realy.


If you replace in

Code: Select all

{if $dategroup.is_sticky}
   <img src="/templates/{$template}/img/time.gif" style="border: 0px" title="{$CONST.ON}"  alt="{$CONST.ON}" />
{ else }
  <img src="/templates/{$template}/img/time.gif" style="border: 0px" title="{$CONST.AT}"  alt="{$CONST.AT}" />
{/if}
 <a href="{$entry.link}">{if $dategroup.is_sticky}{$entry.timestamp|@formatTime:DATE_FORMAT_ENTRY} {/if}{$entry.timestamp|@formatTime:'%H:%M'}</a>
the

Code: Select all

<a href="{$entry.link}">
with:

Code: Select all

<a href="/{$CONST.PATH_ARCHIVES}/{$entry.timestamp|@formatTime:'%Y'}/{$entry.timestamp|@formatTime:'%m'}/{$entry.timestamp|@formatTime:'%d'}.html">
the time will link to all the articles with the same date! :-)

Posted: Mon Jul 31, 2006 4:16 am
by carl_galloway
Great find, I agree that the default link is a bit redundant, but I remember emailing Garvin about this many months ago and his reason for leaving it in place was that some users have very long entries and a link to the detail page in the entry footer was useful.

Quite a few of the templates actually break this convention by placing the entry footer directly under the entry title so users still need to scroll to the top if they want to click into detail view, so in instances like that your fix would be very useful.

BTW, on my local PC the path didn't work and I had to add {$serendipityBaseURL} so that my link code looks like this

Code: Select all

<a href="{$serendipityBaseURL}{$CONST.PATH_ARCHIVES}
/{$entry.timestamp|@formatTime:'%Y'}/{$entry.timestamp|@formatTime:'%m'}/
{$entry.timestamp|@formatTime:'%d'}.html">
{$entry.timestamp|@formatTime:'%H:%M'}</a>
Thanks for sharing your code, Carl[/code]

Posted: Mon Jul 31, 2006 1:14 pm
by stm999999999
... and his reason for leaving it in place was that some users have very long entries and a link to the detail page in the entry footer was useful.
Hm, I see the intention but which visitor would know, that the time is an entry-permalink? For this purpose I suggest to add a "Permalink"-entry in the footer, if someone wants this.
Thanks for sharing your code, Carl
no no, YOU share your code with the world! I only give a little bit back!

Posted: Mon Jul 31, 2006 1:18 pm
by garvinhicking
Hi!

I like the idea of having the time link to the archives page, I think it is definitely useful.

IMHO we could break with the existing convention here, and it seems that Carl and stm tend to agree with this?

However the code to be used needs to be tweaked a bit; in the current form it would be quite costy to perform those several function calls - so the link variable should be set within serendipity_printEntries().

I'll try to take care of this at the end of the week!

Best regards,
Garvin

Posted: Mon Jul 31, 2006 8:10 pm
by carl_galloway
That would be really groovy Garvin, I'll keep an eye open for it.