| 3:41 pm on Oct 19, 2001 (gmt 0)|
Don't quite follow you. Do you want the script to save the updated code back to the server? Or just display it to the user?
The work I've done recently has been laid out such:
This file contains less than 10 lines, sets a few variables, and "includes" a template page. There is either a page like this for every page of the site, or some "?" trickery to make it show the right page at the right time.
This is my layout template for the site. All pages that follow the basic form start from this. It is mostly html, with a <?php include($this-pages-content-file); ?> in the middle, and <?php echo $this-pages-title; ?> at the top.
This page, for example, would have the content for the index page. This is an html fragment page that holds the guts for the page. There is another page like this for every page on the site.
| 3:58 pm on Oct 19, 2001 (gmt 0)|
I want to make a php script that allows my clients to update the text on their web pages.
The php page (script) will:
1. Read an html page.
2. Present a form with the text content in text boxes for the client to edit and hit the 'update' button.
3. Re write the html page with the new text.
I would like to avoid 'includes' as I have heard that php pages can get a lower rank on SEs.
My client will go to his secure 'Update tool' (php) - which rewrites their html pages.
| 4:26 pm on Oct 19, 2001 (gmt 0)|
Do a touch of research on apache .htaccess files and figure out how to make .htm or .html files run php on command. I don't remember the exact syntax off the top of my head.
On the other hand, its actually a good idea to do things the way you were mentioning (with static pages that are changed by php) since that will protect you from having too much processor usage in the event of high traffic. What you would need to do is open the file in question for reading using:
$file_index = fopen($filename,'r')
I think you then read it into a string with:
string buffer = fread(file_index, sizeof($file_index))
then close your file:
Then, I think you can scan through the string looking for the specific location of a substring using:
Once you found the beginning and ending index of the string you want to replace, use
to extract the string and output it in the form.
Then when the user submits his input, you just open your file for writing:
and start dumping text into it.
Its actually quite a pain to write the script, but if you over generalize it, you'll only have to do it once.
| 5:20 pm on Oct 19, 2001 (gmt 0)|
I found some code that did exactly what you want to do.
Go to [sourceforge.net...]
you will most likely find what you need.
| 5:46 pm on Nov 23, 2001 (gmt 0)|
Well I've got my script now and it works.
I have to add these tags either side of editable text:
<!--edit "Name of the label"--> <!--end-->
Will this affect SEO? If I have these tags inside <H1> or <P> tags
I know I can't expect great SEO with my clients updating their own pages (I give them some basic lessons). I just want to know if say Google would get upset about such tags within <H1> or <P> tags