PDA

View Full Version : Pull month and year graphic title


attroll
10-30-2004, 06:24 PM
I am looking for a hack that will let me set sponsors for a module on the CMPS. What I have is a sponsor block and I only allow one sponsor at a time for the whole month. But I have 6 months worth of sponsors paid up into the future. What I want is to save a graphic file ahead of time buy month and year somehow so it will get the current sponsor and change when the next month come up. One that might look something like January2004.jpg, February2004.jpg, ect, January2005.jpg and on and on. I saw this little mod that Brian posted for (Calendar Babes) that gave me the idea but I don’t know how to convert it to pull a file titled for month and year. Can someone write a hack like this?

I hope what I am trying to say is making sense here.

alkatraz
11-27-2004, 06:10 AM
Why not just use a full featured banner manager with the banner tracking code in a custom module. phpMyAds is what I use, its sweeeet and free.

Our Sponsors
 

attroll
11-27-2004, 07:32 AM
Why not just use a full featured banner manager with the banner tracking code in a custom module. phpMyAds is what I use, its sweeeet and free.

I will check into that. Sweet. Whee did you get that from VB.org?

Artayick
11-27-2004, 07:44 AM
no it is a stand alone software.. just got to like hotscripts and do a search for it.. or even just google search it.. you will find it..

Our Sponsors
 

attroll
11-27-2004, 08:31 AM
I found it and installed it. It would work great if I wanted to have random sponsors. But as I meantioned before. I have one sponsor for the whole month. Then when that month is over there is a new one for the next month.

Artayick
11-27-2004, 08:51 AM
so you are wanting a sponsor mod that checks the date and sets the image according to the date.. hmmm in theory seems like it will just be a simple if statement.. if month is equal to "whatever" then do the image code then just run the same if statement for each month then just give it a Null value for the else part and create a no current sponsors image to display if that ever occurs..

Let me see what I can come up with.. no promises but I will take a stab at it..

attroll
11-27-2004, 09:12 AM
That is what I was thinking. Something along the lines of that. But I was not sure how to do it. I will wait and see waht you come up with. Thanks.

Artayick
11-27-2004, 09:25 AM
<?php

$Month = date("M");



if ($Month == "Jan") {

$src = "image1.jpg";

}
if ($Month == "Feb") {

$src = "image2.jpg";

}
if ($Month == "Mar") {

$src = "image3.jpg";

} else {

$src = "image4.jpg";

}

?>

<img src="<? echo $image_path + $src; ?>">

Now you can add an if statement for each month. The only thing I am currently unsure of is on the date function if it displays the full monthor just the 3 letter version of it. Depending on how that works might have to change the code a bit.

If you want something short like just say like three months could prolly come up with a shorter elseif statement or something...

hope this helps.. if not im sure someone here can fix my code..

Artayick
11-27-2004, 09:32 AM
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat"><span class="smallfont"><b>$vba_options[portal_blockbullet] Title Goes here</b></span></td>
</tr>
<tr>
<td class="$getbgrow" width="100%">

<?php

$Month = date("M");



if ($Month == "Jan") {

$src = "image1.jpg";

}
if ($Month == "Feb") {

$src = "image2.jpg";

}
if ($Month == "Mar") {

$src = "image3.jpg";

} else {

$src = "image4.jpg";

}

?>

<img src="<? echo $image_path + $src; ?>">

</td>
</tr>
</table>
<br />

I just threw this in a module seems to be working ok.. I don't myself have any images to use.. but I get a broken image link which is a good start..