View Full Version : Making something easy to update
05-12-2008, 11:01 PM
I am making a site for a friends company, though to be honest I'm not that far ahead of them, skills wise! Their business is weather dependent, and they want a banner or something similar they can update to let people know if they are open on any given day. I want to make this as easy as possible for them to change, but I'm not sure how best to go about it.
If at all possible I'd rather avoid them having to go in and alter any code as I'd worry about them changing a wrong bit and breaking the whole page. Does anyone know any good ways I could get this done?
Thanks in advance :D
05-12-2008, 11:08 PM
Create a page where it enters a value 'Open' || 'Closed' into a database, retract the value Then use an if statement using PHP and mysql.
Just remember to make sure that you make sure not just anyone can change the value.
05-12-2008, 11:16 PM
Now, you say that like its really easy, and I'm hoping it is, but it is still far beyond where I am at. (Basically they saw I had made a website which is just really simple html and decided I was the best person to make theirs...I am slowly but surely learning though, with help :) )
05-13-2008, 03:59 AM
Are you able to change the extension of their main page from .html to .php? Example, "index.html" would now be "index.php"
That would be the first step. Any other links they have to "index.html" would
then need to be changed too.
Create two graphic images ... an "open" sign, and a "closed" sign.
Upload both of those images and give us the URL to your site and the images.
We can provide you with the PHP code to put into your website.
(you'll be inserting some into "index.php", plus adding another PHP script).
Very easy to do.
They can then change the "open" or "closed" image from any computer
in the world by entering a simple code into a web page.
But we need to see the two images and the page where they will appear.
05-13-2008, 08:17 AM
That sounds absolutely perfect.
I feel a little embarrassed to give details of the site cause I know it looks awful at the moment. It was more important to get something up quickly, and then I am going to make it look decent as I have the time - Its a nice little learner project for me I guess.
I'll have to sort the images out this evening after work, but I'll update with the details you need as soon as they are done.
05-13-2008, 05:20 PM
The important thing is to call your main page "index.php" ... or whatever page
will be displaying the "open" or "closed" sign needs to have the .php extension.
Probably best to make the two images the same size and determine where they
will appear on your page. The PHP script will display whichever image the owner
wishes to display.
If you want to PM me with the site details, I would be glad to help ...
so your site would not be "public".
05-19-2008, 04:34 PM
Continuing on with this thread ...
The obvious solution is to use PHP "includes", also making your file exensions .php,
example: change index.html to index.php, or use .htaccess to process your
.html and .htm files as PHP.
She is really new to PHP and wasn't comfortable making those types of changes,
where an image should appear, and a separate PHP script that only needed to
the image (or photo) will appear on the web page:
And the PHP script "status.php" looks something like this:
// Do something here to determine which photo will appear.
// using a date function, or some logic that determines
// whether the store is opened or closed.
$s="opened"// pretend the logic makes it opened today at 10am.
// Determine which image to use.
$img="<img src='images/blank.jpg' alt='' />";// default image
$img="<img src='images/closed.jpg' alt='' />";
$img="<img src='images/opened.jpg' alt='' />";
// Clean-up the string in case there are carriage returns or quotes.
$string = str_replace(array("\r\n", "\r", "\n"), "", $img);
$string = str_replace("\"", "`", $string);
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.