First of all I want to say thanks Chris for the download counter script you posted in the general forum. I will add that to my list of scripts to put on my site.
Second: I have this idea for my website and PHP but, I want to make sure it will work before I start programming it and run into some sort of snag.
Basically I want to have my page layout change either randomly or each day of the week or something like that.
The core of the idea comes from the avatar script that Chris has. The only catch is I want to apply this to the entire page. So, would it be easier for a newbie PHP programmer to write it to randomly grab from one of say...ten html documents, or just change colors images etc....
Eventually I want to set up a check box and drop down box page that I can go to and change the settings from there. Also, in relation to this I want to set up a news page and be able to update it from another page on the web. I know how to make it write to a .txt document and then how to grab that text and convert it to a string and THEN post it to a html page...but, is there any way I can write directly to the html document instead? Or even a way to change the .txt documents extension to a .html?
thanks,
-junc
PHP Newbie!
Re:PHP Newbie!
the print() and echo functions will print any kind of string, be it a literal (in quotes) or a string variable. PHP is actually really good about this. you don't need to store these things in separate files, you can store it right in your PHP file, an included PHP file, or even an included HTML file.
for changing the page style, you can set variables that contain the vital information (like colors, styles, images, etc.) and use arrays to set it. for example, you can set up a style_of_the_day[] array with 7 elements and use PHP's date functions to find out what day it is and use that element for each of the styles in the page. you can even pull this information from a database or text file before picking the element. using random styles is easier - just use the random number to choose the element instead of processing what day it is.
i hope i understood your question right and was able to give you the tips you needed.
for changing the page style, you can set variables that contain the vital information (like colors, styles, images, etc.) and use arrays to set it. for example, you can set up a style_of_the_day[] array with 7 elements and use PHP's date functions to find out what day it is and use that element for each of the styles in the page. you can even pull this information from a database or text file before picking the element. using random styles is easier - just use the random number to choose the element instead of processing what day it is.
i hope i understood your question right and was able to give you the tips you needed.
Re:PHP Newbie!
Yep, that pretty much covers it. My biggest concern was just would all of that work. You seemed to have answered that.
Thanks!
-junc
Thanks!
-junc
Re:PHP Newbie!
I don't like to use the date() function, I prefer using linux time stamps.
First you get the time using something like:
then you use
Then it prints out the time, of course I prefer doing this because date uses a different type of time string which makes it harder to customize, while strftime has an easy to use and very customizable time string. Infact this message board uses time(); and strftime(); as well.
First you get the time using something like:
Code: Select all
$time = time();
Code: Select all
$time = strftime($format,$time);