Log in

View Full Version : AutoGallery SQL question...


tortus32
2005-04-29, 06:17 PM
How can I do the "Monday" "Tuesday" ...etc. thing, like seen here:

http://www.puppykibble.com/

Thanks,

Bill

f69j69b
2005-05-01, 04:37 PM
one of the board moderators might want to get rid of that link when I clicked on it my virus program went off saying i had picked up a trojan

Fred

cd34
2005-05-01, 05:56 PM
dayrotate.pl

#!/usr/bin/perl

use File::Copy;

@weekdays = ('sunday.jpg','monday.jpg','tuesday.jpg','wednesday.jpg',
'thursday.jpg','friday.jpg','saturday.jpg');

my ($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime time;

copy($weekdays[$wday],'today.jpg');
copy($weekdays[($wday==0?7:($wday-1))],'yesterday.jpg');
copy($weekdays[($wday<1?($wday+6):($wday-2))],'twodaysago.jpg');
copy($weekdays[($wday<2?($wday+5):($wday-3))],'threedaysago.jpg');


cron entry:

0 0 * * * cd /var/www/domain.com/images/;/usr/bin/perl /var/www/domain.com/images/dayrotate.pl > /dev/null


Your 'day' images will be sunday.jpg, monday.jpg, etc.

in your html, you refer to

today.jpg, yesterday.jpg, twodaysago.jpg and threedaysago.jpg

tortus32
2005-05-01, 10:05 PM
Wow, this might be beyond my abilities, but what the heck, I'll give this a try!

Do I edit the cron.cgi file that came with AutoGallery SQL and add that line of code somewhere?

Thanks,

Bill

cd34
2005-05-01, 10:19 PM
that runs completely independently from AutoGallery. All this does is rotate 7 images and set the appropriate filenames -- requires no 'hook' into AutoGallery.

tortus32
2005-05-02, 09:46 AM
Ok, cool.

if I want to show all 7 days of the week, do I just add more code to the dayrotate.pl file?

Like:
copy($weekdays[($wday<3?($wday+4):($wday-4))],'fourdaysago.jpg');
copy($weekdays[($wday<4?($wday+3):($wday-5))],'fivedaysago.jpg');
copy($weekdays[($wday<5?($wday+2):($wday-6))],'sixdaysago.jpg');

Thanks,

Bill

cd34
2005-05-02, 12:24 PM
yep, that would do it.

tortus32
2005-05-02, 12:32 PM
Ok, cool.

I have customer support helping me with this at webair and they're telling me there's errors generated by the dayrotate.pl file.

Here's the error messages:

/www/virtual/tortus32/www.largelovelys.com/images/dayrotate.pl: line 1: {rtf1macansicpg10000cocoartf102: command not found
/www/virtual/tortus32/www.largelovelys.com/images/dayrotate.pl: line 2: syntax error near unexpected token `}'
/www/virtual/tortus32/www.largelovelys.com/images/dayrotate.pl: line 2: `{\fonttbl\f0\fmodern\fcharset77 Courier;}'

Let me know what you think.

Thanks,

Bill

cd34
2005-05-02, 12:37 PM
looks like you uploaded a microsoft word file.

Needs to be uploaded as ascii text -- from notepad or some other text editor.

tortus32
2005-05-02, 12:50 PM
Yep, that's what I did.

I copied the code from above and pasted it into a text file with TextEdit.
Uploaded it with Fetch to my images folder.

And once it was uploaded, the file type says Perl Source.

Thanks,

Bill

tortus32
2005-05-02, 06:54 PM
Is this the only way to do this?

Even the support people at webair can't figure out what's wrong.

Bill

cd34
2005-05-02, 08:20 PM
use php

<?php

echo date("l");
echo date("l",time() - (1* 86400));
echo date("l",time() - (2* 86400));
echo date("l",time() - (3* 86400));
echo date("l",time() - (4* 86400));
echo date("l",time() - (5* 86400));
echo date("l",time() - (6* 86400));

?>


although I really hate doing date calculations on every pageload -- especially 7 of them

you could also do the same thing with an array, find the current position, cycle through and set the variable.

Wazza
2005-05-03, 02:51 AM
The answer is under Template Values on this page - http://www.jmbsoft.com/owners/ags/manuals/3.1.x/templates.tgp.html

You could always ask in the owners forums and get Tech Support to give you a hand

|viking|

tortus32
2005-05-03, 08:14 AM
Those are both great, but I want to do this with image files for each day that say the day of the week, as seen in the link I posted above..

I already posted in teh owners forum there, but they always take a few days to reply. Not the speediest bunch.

Thanks,

Bill

tortus32
2005-05-03, 09:46 AM
The answer is under Template Values on this page - http://www.jmbsoft.com/owners/ags/manuals/3.1.x/templates.tgp.html

Ok, I used that and got it to work!

All I had to do was this:
<img src="images/##Weekday##.gif"> - shows today's image "Tuesday"
<img src="images/##Weekday-1##.gif"> - shows yesterday's image "Monday"


Thanks a bunch!

Bill