1 person found this helpful
If he is using an html editor, doing a simple .php include is pretty easy.
As long as you have .php on your server (most hosts do), it's as simple as adding in a little line of code, for example:
<?php include("content.php"); ?>
Wherever you want your content.php file to show in your main page.
In this situation, you would have your news page set up with a .php extension (just change .html to .php) and within that page you would have the include code that points to the content.php page in the location where you want that content to load. Your client would then only update and upload the content.php page which would only have the html for the text and images that they want to add. The content.php page would not have the html, head (or its contents) or body tags, since those will already be written into your news.php page and you wouldn't want to duplicate them, so literally just the html for the text and images in the content.php file.
Thank you for your response Jon. Let me take it step by step to make sure that I understand.
- Name my News page news.php instead of news.html
- Build the page
- In area where I want the changeable content, I include this line of code: <?php include("content.php"); ?>
- Create a content.php page that contains only the content that is to be changing weekly.
Is this correct?
The changeable section will only contain <h2> and <p> tags with the ability to style in bold & italic. My client has no web experience whatsoever, so I want to make it as simple as possible for him. Will this be a simple process for him?
Yep, that'll do the trick, just make sure the content.php file is saved in the same directory as the news.php page if you leave the link the same in the .php include snippet.
It may take a little effort on your part to help them understand what they're doing initially, but it's always gone smoothly for me in the past with clients who wanted to do updates.
I just tested it on my desktop and it all works. Thank you for your help!
Oops, I may have spoken too soon. It worked in Live view in DW, but when I go to preview in a browser it doesn't work. In Firefox, it just keeps opening blank windows until I quit and in Chrome, Opera & Safari it just shows a few pixels of the background color. Will this only preview properly when it is uploaded to a server, or can I get it to work locally?
DW will mimic the server by processing php includes internally to some extent. Preview in Browser won't work at all.
If your server has .php, uploading and viewing the files will work fine.
You could set up a local server to verify everything is correct before uploading to your webserver by installing XAMPP (PC) or MAMP (Mac) which will allow you to run Apache web server, php and mySQL locally for testing.