Image for each dayname

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
FF
Regular
Posts: 18
Joined: Fri Feb 02, 2007 11:56 pm

Image for each dayname

Post by FF »

It's possible to have an image next to your date which seperates your posts.
Example:

[bar with <image> <date>]
post 1

post 2
[bar with <image> <date>]
post 1

But, is it possible to have this image to be 'linked' to a certain day?
For example.
Monday shows an ape
Tuesday shows a banane
Wednesday shows a canary
Thursday shows a dragon
Friday shows an egg
Saterday shows a frog
Sunday shows a gremlin

I hope you get my point :D
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Image for each dayname

Post by garvinhicking »

Hi!

Yes, you can edit the entries.tpl file, and inside each {foreach} entry loop, you can use the entry's post date to get the actual image, like:

Code: Select all

<img src="/images/{$entry.timestamp|@formatTime:'%u'}.jpg" />
then you create the files /images/1.jpg (Monday) to /images/7.jpg (Sunday). :-)

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/
FF
Regular
Posts: 18
Joined: Fri Feb 02, 2007 11:56 pm

Re: Image for each dayname

Post by FF »

garvinhicking wrote: Yes, you can edit the entries.tpl file, and inside each {foreach} entry loop, you can use the entry's post date to get the actual image, like:

Code: Select all

<img src="/images/{$entry.timestamp|@formatTime:'%u'}.jpg" />
then you create the files /images/1.jpg (Monday) to /images/7.jpg (Sunday). :-)
Hi Garvin,

Thanks for your quick response, but.. ;)

Is this correct?

Code: Select all

    {foreach from=$entries item="dategroup"}
    <div class="serendipity_Entry_Date">
        {if $dategroup.is_sticky}
        <h3 class="serendipity_date">{$CONST.STICKY_POSTINGS}</h3>
        {else}
        <h3 class="serendipity_date">{$dategroup.date|@formatTime:DATE_FORMAT_ENTRY}<img src="/dagboek/templates/xarno-2/images/{$entry.timestamp|@formatTime:'%u'}.jpg" /></h3>
        {/if}
</div>
I get different numbers for the same day.
Zaterdag, 5 december 2009 -> 1 (Saturday)
Zaterdag, 28 november 2009 -> 6 (Saturday)
Dinsdag, 24 november 2009 -> 6 (Tuesday)
Dinsdag, 10 november 2009 -> 2 (Tuesday)
Woensdag, 4 november 2009 -> 2 (Wednesday)
Maandag, 2 november 2009 -> 3 (Monday)
Zaterdag, 24 oktober 2009 -> 1 (Saturday)
See http://www.xarno.nl/dagboek/


---edit---
I changed

Code: Select all

$entry.timestamp
to

Code: Select all

$dategroup.date
and it seems to work now.

Please tell me that I'm doing this correctly so I can close this thread ;)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Image for each dayname

Post by garvinhicking »

Hi!

Yes, you can do it per each dategroup. I initially thought you wanted that line after each blog entry, so if you have multiple blog entries on the same day, you get multiple day lines. If oyu want it only once, the place you put it is perfectly fine.

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/
FF
Regular
Posts: 18
Joined: Fri Feb 02, 2007 11:56 pm

Re: Image for each dayname

Post by FF »

garvinhicking wrote: Yes, you can do it per each dategroup. I initially thought you wanted that line after each blog entry, so if you have multiple blog entries on the same day, you get multiple day lines. If oyu want it only once, the place you put it is perfectly fine.
Got to brush up my English ;)

Thank you very much.

Case closed 8)
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Image for each dayname

Post by yellowled »

FF wrote:Got to brush up my English ;)
We also have a German forum, you know :)

YL
FF
Regular
Posts: 18
Joined: Fri Feb 02, 2007 11:56 pm

Re: Image for each dayname

Post by FF »

yellowled wrote:
FF wrote:Got to brush up my English ;)
We also have a German forum, you know :)
Unfortunately my German is worse.
I'm living a few km's to the west of Germany ;) About 200 of them.

Greetings from The Netherlands :P
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Image for each dayname

Post by yellowled »

FF wrote:Greetings from The Netherlands :P
I was just assuming. In 8 out of 10 hypothetical cases, you would've been German :)

YL
Post Reply