- This topic is empty.
-
AuthorPosts
-
June 14, 2009 at 12:09 pm #25146
twilightdenka
MemberHi, I did multiple searches on the forum but i didn’t find any related topics, so please pardon me if this question was asked a lot.
I have 7 images that I have set for each day of the week, Monday, Tuesday etc for a blog that i’m trying to design. but I think it would be a hassle if i were to use the php made for dates of the month that i found earlier on this site since i have to reassign all images to individual dates. I’m not even sure if php works for blogs because i’m not sure what it is anyway.
Can anyone guide me? Thanks.
June 16, 2009 at 2:15 am #59107AshtonSanders
ParticipantI would use the php date function for day of the week:
Code:/images/header.jpgThat will output a number representation of the day of the week: 1 (for Monday) through 7 (for Sunday)
So header1.jpg would be Monday’s header.
June 16, 2009 at 3:01 am #59109twilightdenka
Member"AshtonSanders" wrote:I would use the php date function for day of the week:Code:/images/header.jpgThat will output a number representation of the day of the week: 1 (for Monday) through 7 (for Sunday)
So header1.jpg would be Monday’s header.
Thanks but I do not quite understand this. Where am I suppose to place this code? In the <head></head> area? And is that the only line required? Where would my image source be placed?
Would this work?
Code:/images/header.jpgJune 16, 2009 at 3:19 am #59110AshtonSanders
ParticipantI’m sorry, I’ll simplify:
Here is basic PHP:
Code:This will print out a number between 1 and 7 depending on the day of the week: 1 (for Monday) through 7 (for Sunday)
In general: this is PHP, so it needs to be on a PHP page (not in a .css file)
So let’s say here’s the HTML code for my image:
Code:I make an image for each day of the week and name them:
image1.jpg
image2.jpg
image3.jpg
image4.jpg
etc…Now I can change my HTML code to:
Code:.jpg” />
And that PHP code will be replaced by a number, completing the call for the image.
(likewise, this can be done in CSS too:
Code:.jpg’)”>etc.
June 18, 2009 at 2:25 am #59291twilightdenka
MemberThank you, it seems plausible, but since I’m using this for a blog i can only use images that are hosted on the net itself, like photobucket, I made several images and labeled them with numbers as you suggested but I do not think the code would work like this,
Code:.jpg” width=”100″ height=”210″ />
Is it possible to incorporate images from images from the web? or is it strictly to hosted images in our domain only thus it can;t be used on blogs?
June 18, 2009 at 9:02 am #59192lyleyboy
MemberThere is a way around this but the best way would be to host your images somewhere.
Code:“;
}
If ($dayNo == 2){
echo ““;
}
………?>
Just keep that going for 7 days.
Don’t forget to escape the " (speech marks) like " or php will error.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.