Current location: Hot Scripts Forums » Programming Languages » PHP » Need Help Creating a PHP script to edit html file


Need Help Creating a PHP script to edit html file

Reply
  #1 (permalink)  
Old 07-20-09, 12:59 PM
Swag Swag is offline
New Member
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Need Help Creating a PHP script to edit html file

Hey,

I am very new to php. Was wondering if anyone could help me create a php script that edits index.html, but only a certain spot.

I don't want to keep uploading the index.html file in my ftp program anymore just to edit a few things of text.

Basically, I want to go to www.MYSITE.com/script.php and just add/edit what is a few lines of my .html file.

Hopefully that makes sense. Anyone suggest where I should start?
Reply With Quote
  #2 (permalink)  
Old 07-22-09, 06:27 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
That's probably easier than creating a program...

If you have ssh access, you could probably do a 'search and replace' on the file.

Or if your hosting site has a web interface, they probably have a file manager that you could use.

It's best to keep a backup, so editing it locally and uploading it is probably the safest anyway.

Last edited by dgreenhouse; 07-22-09 at 06:30 AM.
Reply With Quote
  #3 (permalink)  
Old 07-22-09, 07:29 AM
DaiLaughing DaiLaughing is offline
Newbie Coder
 
Join Date: Jul 2009
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
It is a lot easier to ftp than create a content management system. As dgh said if you can't ftp all the time most hosts provide a web-base file upload facility.
Reply With Quote
  #4 (permalink)  
Old 07-22-09, 01:10 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Make your index file a php file. Set up a database with a table for the info you want to change. Create an editing script for that information so you can change it whenever you want, and avoid file uploads. Then simply do a query in the index file for that info.
Reply With Quote
  #5 (permalink)  
Old 07-22-09, 06:36 PM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
methinks mdhall sees the obvious! :-)
Reply With Quote
  #6 (permalink)  
Old 07-22-09, 09:38 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Or use a free blog / site / template system.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Script - load text from file vaskov17 Script Requests 2 08-14-08 11:02 AM
php upload file script xavier039 PHP 5 08-29-06 04:35 PM
including php file within html albobis PHP 4 06-12-06 10:15 PM
Saving php generated file as html file GS300 PHP 0 12-29-04 03:34 AM
One PHP file to edit another.... drgn91 PHP 10 07-22-03 11:29 AM


All times are GMT -5. The time now is 08:42 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.