(Solved) Add an additional Timestamp to pictures

Alexandra70

Joined: 2004-12-08
Posts: 143
Posted: Wed, 2008-02-06 01:32

How can I add an additional Timestamp to be displayed next to every photo Thumbnail?

So it will display:

Date taken: 04/21/2001
Date uploaded: 02/05/2007
Views: 296

(adding the words "taken" and "uploaded" I know.. I just need help implementing the extra timestamp code)

I thought that all I had to do was edit ItemInfo.tpl

I tried the following..... (you can tell I don't know PHP, but at least I try fiddling with it)

<div class="{$class}">
{if !empty($showDate)}
<div class="date summary">
{capture name=childTimestamp}{g->date timestamp=$item.originationTimestamp}{/capture}
{capture name=childTimestamp}{g->date timestamp=$item.creationTimestamp}{/capture}
{g->text text="Date: %s" arg1=$smarty.capture.childTimestamp}
</div>
{/if}

That didn't work..

So I tried just adding an extra DIV below the first one..

<div class="{$class}">
{if !empty($showDate)}
<div class="date summary">
{capture name=childTimestamp}{g->date timestamp=$item.originationTimestamp}{/capture}
{g->text text="Date taken: %s" arg1=$smarty.capture.childTimestamp}
</div>
{/if}

<div class="{$class}">
{if !empty($showDate)}
<div class="date summary">
{capture name=childTimestamp}{g->date timestamp=$item.creationTimestamp}{/capture}
{g->text text="Date uploaded: %s" arg1=$smarty.capture.childTimestamp}
</div>
{/if}

Of course that didn't work either.

Could someone please help me?

Also.. This is just for picture Dates.. I don't want to make any changes to "Album" Dates.

Thank you!!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-02-06 02:41

Not sure what theme you are using but album.tpl should have a loop that starts like:
{foreach from=$theme.children item=child}
then below that you should be able to use:

{g->date timestamp=$child.originationTimestamp}
{g->date timestamp=$child.creationTimestamp}

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2008-02-06 02:41

haven't looked too cloely, but you need to give the two captures different names

{capture name=originationTimestamp}{g->date timestamp=$item.originationTimestamp}{/capture}
{capture name=creationTimestamp}{g->date timestamp=$item.creationTimestamp}{/capture}

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
Alexandra70

Joined: 2004-12-08
Posts: 143
Posted: Wed, 2008-02-06 04:13

Oh my!! I got a response from both of you... I thought for a while that I was being ignored here!!

THANK YOU!!

Dave, I am using the Classic Theme.. I need to remember to always specify that when I ask questions here. Sorry!!

Your code (album.tpl) generated all these dates below, just like it looks here, right on the top of the pictures thumbnails page (below the Album's name and description).

04/21/2007 04/28/2007 04/21/2007 04/28/2007 08/19/2006 04/28/2007 10/08/2006 04/28/2007 04/22/2007 04/28/2007 03/17/2007 04/28/2007 04/07/2007 04/28/2007 12/29/2006 04/28/2007 05/29/2007 06/05/2007 06/24/2007 07/01/2007 01/05/2007 07/10/2007 01/05/2007 07/10/2007

So that didn't work. But thanks for trying to help.

-------------

Valiant, your code (ItemInfo.tpl) worked great, but it also added the same thing in the Album page level... I don't want to have the 2 dates on the Album level because it doesn't make any sense.. to say "Date taken" for an Album. Only for pictures.

Look: (this is just my Test Gallery)

http://www.alexandradavila.com/gallery2/main.php

And when you go inside the Album... then the dates next to the thumbs are perfect. But at the top where it again displays the ALBUM date, it shouldn't have both either.

I understand that this may get a little bit more complicated now... since ItemInfo.tpl seems to take care of those "Dates" everywhere huh? I hope I'm wrong, and it can be fixed.

And just curious... something strange happened...

When I added your code, it totally messed up the FONT for the "second Date" and the "Views"... I don't know why. I had to change the font on theme.css for .giInfo, from 0.9em (originally), to 1em, and that fixed the weird font mess-up.

If you have the Web Developer Toolbar on Firefox, take a look... then change .giInfo back to 0.9em and see what happens. The font was ok at 0.9em before I added your code. Wonder why it shrunk afterwards... and changing to 1em fixed it.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-02-06 04:31

I thought that you would have move the code to where you would like it. And add some text to what you wanted.
anyway albums.tpl I added the bold and it seems to work for me.

                {if !empty($child.summary)}
                <p class="giDescription">
                  {$child.summary|entitytruncate:256|markup}
                </p>
                {/if}

                {if ($child.canContainChildren && $theme.params.showAlbumOwner) ||
                    (!$child.canContainChildren && $theme.params.showImageOwner)}
                {assign var="showOwner" value=true}
                {else}
                {assign var="showOwner" value=false}
                {/if}
                {if !$child.canContainChildren}
                Taken: {g->date timestamp=$child.originationTimestamp} <br />
				Added: {g->date timestamp=$child.creationTimestamp}
				{/if}
                {g->block type="core.ItemInfo"
                          item=$child
                          showDate=false
			  showOwner=$showOwner
                          showSize=true
       		          showViewCount=true
                          showSummaries=true
                          class="giInfo"}
                {g->block type="core.ItemLinks" item=$child links=$child.itemLinks}
              </td>

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Alexandra70

Joined: 2004-12-08
Posts: 143
Posted: Wed, 2008-02-06 05:09

Beautiful!!!

But I just had to add the css to your code because the words were all black.

                <p class="giInfo">
                Taken: {g->date timestamp=$child.originationTimestamp} <br />
				Added: {g->date timestamp=$child.creationTimestamp}</p>
				{/if}  

But... one more minor detail...

On this page:
http://www.alexandradavila.com/gallery2/v/test2/
On the top left it says "Date: 02/05/2008" which is correct because it's the Date that this Album was created. Perfect!!!

But..

On the photo page:
http://www.alexandradavila.com/gallery2/v/test2/aaa.html
On the top left it says "Date: 03/26/2006".
The part about 03/26/2006 is correct, but I want it to say TAKEN. And I don't know which file should I change. I don't want to do it on ItemInfo.tpl, because it will write TAKEN on the Album thumbs level too.

I thought it would be on photo.tpl, but could not find it there. Where is it?
Remember, it's just to change it on the actual photo page.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-02-06 05:22

Do you mean top Right?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Alexandra70

Joined: 2004-12-08
Posts: 143
Posted: Wed, 2008-02-06 05:35

Sorry... yes... brain tired.. As my husband says "the other left".. ha ha

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-02-06 05:40

in photo.tpl it is rendered with is bit of code:

                {g->block type="core.ItemInfo"
                          item=$theme.item
                          showDate=true
                          showOwner=$theme.params.showImageOwner
                          class="giInfo"}

I would change to

              Taken: {g->date timestamp=$theme.item.originationTimestamp} <br />
                {g->block type="core.ItemInfo"
                          item=$theme.item
                          showDate=false
                          showOwner=$theme.params.showImageOwner
                          class="giInfo"}

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Alexandra70

Joined: 2004-12-08
Posts: 143
Posted: Wed, 2008-02-06 06:07

Worked....

But uuuugh... It took the css color of the font again...

So I tried adding a <p class="giInfo"> or a <div class="giInfo"> as in...

              <p class="giInfo">
              Taken: {g->date timestamp=$theme.item.originationTimestamp} </p><br />

And then it added a space underneath it.

http://www.alexandradavila.com/gallery2/v/test/aaa_001.html

How do I add .giInfo to your code without having to do a <p> or <div>?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-02-06 06:15

_try removing the <br />

Dave
____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2008-02-06 06:18
<span class="giInfo">Taken: {g->date timestamp=$theme.item.originationTimestamp}</span>
                {g->block type="core.ItemInfo"
                          item=$theme.item
                          showDate=false
                          showOwner=$theme.params.showImageOwner
                          class="giInfo"}

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Alexandra70

Joined: 2004-12-08
Posts: 143
Posted: Wed, 2008-02-06 06:25

Yesssssssssssss.... that was better than removing the <br />!!

We........ are....... DONE!!!!!!!

Well, at least on this topic... I have a few other things to modify.. but that's it for today... I am brain dead..

Thank you so much again!!