Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   AutoGallery SQL question... (http://www.greenguysboard.com/board/showthread.php?t=19103)

tortus32 2005-04-29 05:17 PM

AutoGallery SQL question...
 
How can I do the "Monday" "Tuesday" ...etc. thing, like seen here:

http://www.puppykibble.com/

Thanks,

Bill

f69j69b 2005-05-01 03: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 04:56 PM

dayrotate.pl
Code:

#!/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:
Code:

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 09: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 09: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 08: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:
Code:

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 11:24 AM

yep, that would do it.

tortus32 2005-05-02 11:32 AM

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 11:37 AM

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 11:50 AM

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 05: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 07:20 PM

use 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 01:51 AM

The answer is under Template Values on this page - http://www.jmbsoft.com/owners/ags/ma...lates.tgp.html

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

|viking|

tortus32 2005-05-03 07: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 08:46 AM

Quote:

Originally Posted by Wazza
The answer is under Template Values on this page - http://www.jmbsoft.com/owners/ags/ma...lates.tgp.html

Ok, I used that and got it to work!

All I had to do was this:
Code:

- shows today's image "Tuesday"
- shows yesterday's image "Monday"

Thanks a bunch!

Bill


All times are GMT -4. The time now is 12:58 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc