Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Making something easy to update

    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

  • #2
    Senior Coder rafiki's Avatar
    Join Date
    Aug 2006
    Location
    Floating around somewhere...
    Posts
    2,042
    Thanks
    19
    Thanked 42 Times in 42 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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 )

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,456
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    Ebany ...
    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.

    Step 2:
    Create two graphic images ... an "open" sign, and a "closed" sign.

    Step 3:
    Upload both of those images and give us the URL to your site and the images.

    Step 4:
    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.

    Step 5:
    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.

  • Users who have thanked mlseim for this post:

    Ebany (05-13-2008)

  • #5
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,456
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    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".

  • #7
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,456
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    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,
    so I provided a Javascript method where she inserts Javascripting into the page
    where an image should appear, and a separate PHP script that only needed to
    be uploaded.

    So, the Javascript insert looks like this, and was inserted exactly where
    the image (or photo) will appear on the web page:
    <script type="text/javascript" src="status.php"></script>

    And the PHP script "status.php" looks something like this:
    PHP Code:
    <?php

    // 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
    if($s=="closed"){
    $img="<img src='images/closed.jpg' alt='' />";
    }
    if(
    $s=="opened"){
    $img="<img src='images/opened.jpg' alt='' />";
    }

    // Output the data back using a Javascript Header.
    Header("content-type: application/x-javascript");
    // 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);
    echo 
    "document.write(\"$string\")";
    exit;
    }
    ?>
    Last edited by mlseim; 05-19-2008 at 04:41 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •