Page 1 of 1

Image for each dayname

Posted: Fri Dec 04, 2009 9:07 pm
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

Re: Image for each dayname

Posted: Sat Dec 05, 2009 12:49 pm
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

Re: Image for each dayname

Posted: Mon Dec 07, 2009 10:13 pm
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 ;)

Re: Image for each dayname

Posted: Tue Dec 08, 2009 11:39 am
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

Re: Image for each dayname

Posted: Wed Dec 09, 2009 9:42 pm
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)

Re: Image for each dayname

Posted: Thu Dec 10, 2009 10:59 am
by yellowled
FF wrote:Got to brush up my English ;)
We also have a German forum, you know :)

YL

Re: Image for each dayname

Posted: Sat Dec 12, 2009 10:06 pm
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

Re: Image for each dayname

Posted: Sun Dec 13, 2009 2:12 pm
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