Single page CMS query

Discussion in 'NZ Computing' started by KiwiBrian, May 18, 2006.

  1. KiwiBrian

    KiwiBrian Guest

    Can anyone recommend from personal experience a method, or perhaps a PHP
    script, whereby I can allow a viewer to log into one particular page on my
    website and
    upgrade some content listing sporting type activities for the coming month?
    I am reasonably familiar with HTML and CSS, but that is about the limit of
    my skills.
    I have seen many criticisms of scripts etc., hence my desire for a
    recommendation from personal experience.
    Thanks for any replies
    Brian Tozer
     
    KiwiBrian, May 18, 2006
    #1
    1. Advertisements

  2. KiwiBrian

    Allistar Guest

    Hi Brian,
    Sounds like you need a database (I'd recommend mysql for this) to store
    the data and some PHP code (also recommended) to retrieve the data from the
    database to display to the browser.

    There are a number of ways of handling security (if you need to only allow
    access to certain people). You can use HTTP authentication (where the
    browser pops up a login window) - this is typically done using a .htaccess
    file in the folder you want to restrict access to. Another way is to have a
    page that have a form that asks for login information, which you would
    validate against the database and then store a cookie (PHP makes this easy
    through the use of sessions).

    I can't think of any freely available toolkit that provides what you need,
    but I'd be surprised if there was not one somewhere. Tried a search on
    sourceforge?

    Allistar.
     
    Allistar, May 18, 2006
    #2
    1. Advertisements

  3. KiwiBrian

    Nik Coughlin Guest

    Hi, you shouldn't multipost, I just read this over in alt.html as well.
    Crosspost my man!

    Anyway, something that simple is pretty easy. I wouldn't bother with a
    database for a one page CMS. Here's the quick, dirty and simple way to do
    it.

    You need three files, let's call them "view.php" (the page that the public
    see), "edit.php" (the edit content page that the admin uses), and
    "content.txt" (the actual content that gets edited).

    "view.php" has an include statement at the appropriate place on the page
    that includes "content.txt":

    <?php include( 'content.txt' ); ?>

    "edit.php" should be password protected and have something like this:

    <?php
    if( $_POST[ 'submitted' ] ) {
    $handle = fopen( 'content.txt', 'w' );
    fwrite( $handle, $_POST[ 'content' ] );
    fclose( $handle );
    }
    ?>
    <form action="edit.php" method="post">
    <textarea id="content" name="content".><?php include( 'content.txt' );
    ?></textarea>
    <input type="hidden" name="submitted" id="submitted" value="true">
    <input type="submit">
    </form>

    You'll probably want to convert the carriage returns in the content to <br>
    tags -- you can use nl2br for this.

    "content.txt" should have write permission set.

    None of this is tested BTW, off the top of my head so there might be errors.
    Also it's all grossly oversimplified, but it should give you some idea.

    Cheers
     
    Nik Coughlin, May 19, 2006
    #3
  4. KiwiBrian

    -=rjh=- Guest

    Three words - RSS :) Totally different approach to Nik's script.

    You don't say what you are currently using to generate your web page -
    is it static?

    Calendar:

    Can you use an online calendar, and incorporate an RSS feed from the
    calendar into your webpage? This works with Protopage and Google
    calendar, there is a (not very good) example at
    http://www.protopage.com/hindesite (you can see it has issues with the
    order events are displayed, but I haven't looked into doing that in any
    detail).

    If you are using a static web page you might want to use RSSInclude or
    similar to get RSS feed. Your person then just has to keep the calendar
    up to date, and everything else happens automatically. The beauty of
    this is that your person doesn't have to remember to visit the website
    to update the details.

    RSSInclude works well with Blogger if you are using that.

    Calendar can be private and located anywhere online, there are lots of
    these available online now, but not all will output an RSS feed. I've
    only tried Google so I know it works, but also possibly of interest are
    http://www.hipcal.com/, http://www.backpackit.com/ Yahoo! and probably
    MS Live will have something, too. I don't know if any of these output
    RSS though.

    There will be ways of using a service like suprglu to incorporate pretty
    much anything into an RSS feed, too, once you have published it
    somewhere accessible.

    Email:

    Or else use a service that will convert an email into an RSS feed which
    you can then pick up - even a simple blogspot blog can be dedicated to
    do just that. Your person just has to send an email to an account
    associated with your blogspot blog.

    Or http://www.mailbucket.org/ maybe?

    http://www.masternewmedia.org/2004/02/01/email_to_rss_in_three.htm is
    interesting

    Or look at some of these http://www.google.com/search?q="email+to+rss"

    There will almost certainly be some experts here who will know how to
    best use Outlook to advantage in this situation, I'm sure that uses RSS
    by now.

    All this kind of stuff is much easier if you are using a blog.

    Maybe not a lot of help, but the possibilities are endless, and a
    different approach to scripting.
     
    -=rjh=-, May 19, 2006
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.