Question: Automate HTML format

Discussion in 'Web Design and Development' started by gamera~, Dec 30, 2008.

  1. gamera~ macrumors member

    Joined:
    Apr 28, 2005
    Location:
    Boston MA
    #1
    Hello all, I would appreciate any help you might have for my following problem!

    I've just recently made a website for a cafe

    [ link here ]

    and the owner wants the lunch menu page to update with specials of the day. As it is now, the lunch menu is formatted thus:
    Code:
    <table>
    	<tr>
              <td>
                <span class="itemname">chicken cutlet sandwich</span>
                fried chicken cutlets, tomatoes, cheese, lettuce
                and mayo
              </td>
            </tr>
    </table
    My problem is: the kitchen manager needs to update specials every day. He is not computer literate. The HTML is easy for me to see and update, but I don't think he'll be comfortable doing it.

    I am fairly new to web development. Are there any options to automate this process? Ideally, I would like him to be able to type in the title and description into two fields and hit 'submit'. Also, I am not sure server-side what services are available, as we will be switching service soon.

    thanks! ~Mike
     
  2. DipDog3 macrumors 65816

    DipDog3

    Joined:
    Sep 20, 2002
    #2
    You need to have some service that saves the information on the server, and if the server has PHP, then it would be pretty easy.
     
  3. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    Yea, the easiest way would be to take advantage of a server side script like PHP, Perl, Python, etc. You could create a page with a form for the guy to fill out and that would store the contents in a database or even a flat file (plain text) and then use a server side language to take that content and place it into the table.

    An alternative is to use SSI (server side includes) if your web server supports it. Then you could add this to your HTML,
    HTML:
    <table>
    	<tr>
              <td>
                <span class="itemname">
                  <!--#include virtual="/directory/specialOfTheDay.txt" -->
                </span>
              </td>
            </tr>
    </table>
    Then you would have a file named specialOfTheDay.txt that the guy could edit in a text editor. Though issue here would be that he would need to upload the change. You could also do server side stuff to make this a little easier too.

    So I guess it'll depend what options your web server allows for.
     
  4. gamera~ thread starter macrumors member

    Joined:
    Apr 28, 2005
    Location:
    Boston MA
    #4
    thanks for the advice! Looks like I'll need to go and learn some PHP. Any good websites/books you'd recommend?

    edit: assuming the new host has PHP installed. But I'm assuming it's more or less ubiquitous?
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    PHP form handling:
    http://www.w3schools.com/php/php_forms.asp (basic)
    http://www.onlamp.com/pub/a/php/2004/08/26/PHPformhandling.html

    Reading/Writing files with PHP:
    http://www.w3schools.com/PHP/php_file.asp (basic)
    http://www.apitalk.com/document.php?id=1184208074_5

    Password protecting pages:
    http://www.zubrag.com/scripts/password-protect.php

    I added the last link because you don't want just anyone to be able to access the form and change the special of the day. There's other ways of password protecting a page as well. If the web server is run on Apache there's a way through the .htaccess file to setup password protection. A Google search will point you in that direction. Also, I wouldn't have any links on the site that point to this form page. Security through obscurity is a helpful aid, just don't rely on it. This should get you started pretty well.

    Edit: For starting out I'm suggesting working with a plain text file since it's for something pretty small, but if you want to get more fanciful down the road you can make use of a database. This would allow for you to store past specials as well as the current. Then this guy could setup the specials for the coming week or look at past specials so he doesn't repeat them too often or see how often he uses a certain special. Just some food for thought. :)
     
  6. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #6
    @OP:

    I found a shareware $25.00US PHP script here that has simple web forms and security options as discussed in this thread. You could adapt this to add a "special" into each menu or simply configure a category as "special" in the configuration. Based on the screenshots, the forms look VERY easy, so once it's setup just bookmark it, give your boss the password, 5 minutes of training, and of course web access so he can do the changes at work or from home. Be sure to view the screenshots at the link above.

    I figure you should at least check it out, it's easier to adapt a script than write one from scratch - especially if you're new to PHP, hence the suggestion. If I were doing the project, I'd use the database to store previous specials, etc., as discussed earlier. But this is a good start and no major expense other than your time to download it and install it and $25.00. I could not find one for "free" that does what this one does and installs in 5 mins.

    Note: Due to its license, you need to download it via bitTorrent (peer to peer downloading), which is available on Mac. Full details here and download the bitTorrent client here for Mac.

    -jim
     
  7. ChicoWeb macrumors 65816

    ChicoWeb

    Joined:
    Aug 16, 2004
    Location:
    California
    #7
    This might be a good use of Cushy CMS. It's a few lines of copying and pasting. Just a thought...
     
  8. gamera~ thread starter macrumors member

    Joined:
    Apr 28, 2005
    Location:
    Boston MA
    #8
    thanks everyone! this is precisely the help I needed.

    re CushyCMS: I watched the screencast; it looks fairly easy to set up and use but I'm not sure how one would add or remove items in a list... e.g. one day there could be 5 lunch specials, another day only 3.
     

Share This Page