homepage Welcome to WebmasterWorld Guest from 54.167.96.124
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Newbie needs simple php script
I need a small php script that updates my site from a txt file
macmuso




msg:1250936
 10:11 am on Jan 9, 2003 (gmt 0)

Hi I am a complete newbie to php, but not html or programming (I know a lot of html, and a little programming in basic and perl). I am the webmaster of a small local site, and have decided to put a 'recent news' section on all the pages. Instead of typing out every change in every .html document, is there a simple php script that can link to a txt file, insert the contents into my html file and format it accordingly? The webpage in case you're interested is at <snip> Any help is greatly appreciated and I am only too happy to put a link to whoever helps on my site. If nobody knows how to or doesn't have the time, is there a site with a similar script on it I can use? I have looked all around the web and can only find scripts that let me add change and delete information, with unlimited users and admin mode, with smilies and cookies etc...!

Thanks in advance

[edited by: jatar_k at 5:42 pm (utc) on Jan. 9, 2003]
[edit reason] No urls thanks, See WebmasterWorld TOS [webmasterworld.com] [/edit]

 

onlineleben




msg:1250937
 10:25 am on Jan 9, 2003 (gmt 0)

Hello and welcome to Webmaster World,
to make things very simple, you do not need a program, but just the "include" command in PHP.
You can include whatever you like with this command. I suggest that you also put the required HTML formatting into the txt file that you want to present on different pages.
Good luck and lots of fun!

For the correct syntax go to php.net

Marcia




msg:1250938
 10:50 am on Jan 9, 2003 (gmt 0)

Do the pages need to have the .php file extension, or can they be regular .html pages?

onlineleben




msg:1250939
 12:40 pm on Jan 9, 2003 (gmt 0)

No, they could stay with the htm / html extension as long as the server is configured correctly. The server has to interpret all htm(l) files as php scripts. Your webhost can do the configuration quite easily.

Birdman




msg:1250940
 12:45 pm on Jan 9, 2003 (gmt 0)

But you will still have to have your html mark-up in your text file, unless you are happy with plain text. I think?

onlineleben




msg:1250941
 12:48 pm on Jan 9, 2003 (gmt 0)

Yes, and since macmuso says he does OK with html programming, this is the most easy way to include his news or ad or whatever.

jatar_k




msg:1250942
 5:51 pm on Jan 9, 2003 (gmt 0)

If you are just doing simple includes you could, as was recommended, use php include functionss [php.net]. If you want to make php parsed html extensions you need to make the changes to your server config.

look here for the AddHandler Directive [httpd.apache.org] for Apache

The only thing is that if you are using Apache you could just use SSI for simple includes.

How do I enable SSI [httpd.apache.org]

macmuso




msg:1250943
 4:13 am on Jan 10, 2003 (gmt 0)

Thanks. I tried keeping the file extension the same but it didn't work, so I just changed the name from index.html to index.php etc and that seems to work, instead of hassling the hosting provider

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved