OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 5:12 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: PHP Newbie!
PostPosted: Fri Oct 25, 2002 4:24 pm 
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


Top
  
 
 Post subject: Re:PHP Newbie!
PostPosted: Fri Oct 25, 2002 11:15 pm 
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.


Top
  
 
 Post subject: Re:PHP Newbie!
PostPosted: Sat Oct 26, 2002 7:56 am 
Yep, that pretty much covers it. My biggest concern was just would all of that work. You seemed to have answered that.

Thanks!
-junc


Top
  
 
 Post subject: Re:PHP Newbie!
PostPosted: Sun Oct 27, 2002 4:22 pm 
I don't like to use the date() function, I prefer using linux time stamps.

First you get the time using something like:

Code:
$time = time();


then you use

Code:
$time = strftime($format,$time);


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.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 61 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group