i have question about coding.
i have a website that currently has
include("main content");
to my main content.
i want the main content to cycle every 24hours. so it displays different content
every day.
like day one it shows
"main content 1"
day two "main content 2"
day 3 main content 3 .... and so on
can this be done?
PHP newbi - need help
Moderator: General Moderators
Re: PHP newbi - need help
Hi there,
This can be done. Try something similar to the following:
As an example I am going to show you how to make it display based on which day of the week it is.
With the above example:
If the day was Monday it will include "main_content1.html",
Tuesday will include "main_content2.html"... and so on...
Hope this helps.
Kind Regards
AMCH
This can be done. Try something similar to the following:
As an example I am going to show you how to make it display based on which day of the week it is.
Code: Select all
// date("N") is a built in php function to establish the day of the week based on a number representation,
// 1 being Monday etc... it uses your system time/calendar to establish which day it is.
$day_to_include = date("N");
// the following concatenates the variable onto the end of "main_content"
$day_to_include = "main_content".$day_to_include."html";
// the following includes a file that is equal to the variable
include "$day_to_include";If the day was Monday it will include "main_content1.html",
Tuesday will include "main_content2.html"... and so on...
Hope this helps.
Kind Regards
AMCH
Re: PHP newbi - need help
thax so much.
life saver!
life saver!