Development Ultra basic news system!

Discussion in 'Software' started by voodoo2k4, 29 Oct 2008.

  1. voodoo2k4

    voodoo2k4 Ghetto Modder

    Joined:
    21 Apr 2004
    Posts:
    316
    Likes Received:
    2
    So I have finished this wee site, nice CSS HTML site with a few splashes of borrowed PHP bits for interativity.

    Before I hand over the site I need a very VERY simple systems for the client to add news articles to the main page with no ability to mess things up. All they need to be able to add is text articles in a text box on an admin page.

    On the page they would simply be:

    <p><h1>Headline1 </h1></p>
    <p>Article text.</p>

    <p><h1>Headline2 </h1></p>
    <p>Article text.</p>

    <p><h1>Headline3 </h1></p>
    <p>Article text.</p>

    There must be some super simple thing out there to do this. Every CMS/News systems I can find have waaaay too much. WYSIWYG editors and pages and more

    All I need is a simple admin page with headline box, an article box and a post button. No power to delete etc etc etc

    I expect most of you just throw soemthing together yourselfs running off a text file but Im not up to that?

    HELP?

    Dean.
     
    Last edited: 29 Oct 2008
  2. Firehed

    Firehed Why not? I own a domain to match.

    Joined:
    15 Feb 2004
    Posts:
    12,574
    Likes Received:
    16
    There are a couple of hosted solutions where you basically add a class to the template on the sections you want to allow editing for and they figure out the rest, but I can't remember the name for the life of me. Googling around a bit or browsing ads and articles on freelancing sites will probably turn them up. But like you say, most off the off-the-shelf systems are major overkill. I could knock together a basic system pretty quickly (a text file would work well enough, though I'd probably go for sqlite since CSVs can get flaky very easily and it sounds like a proper mysql db would be overkill) but don't really have the time for free work these days, especially as I'm writing a much heavier-duty CMS right now.
     
  3. voodoo2k4

    voodoo2k4 Ghetto Modder

    Joined:
    21 Apr 2004
    Posts:
    316
    Likes Received:
    2
    Ill paypal you a tenner for a basic news system if it helps, i have 1 free mysql data base on the sever if needed but would rathr avoid for simplicity! Will end up with one of the stupid over kill things or this snippet edit thing I used once before.

    Anyone? :)

    Dean.

     
  4. alecamused

    alecamused Minimodder

    Joined:
    22 Apr 2008
    Posts:
    302
    Likes Received:
    24
    Code:
    // create a SQLite2 database file and return a database handle
    $dbHandle = sqlite_open($_SERVER['DOCUMENT_ROOT'].'/../news.sqlite2', 0666, $sqliteError) or die($sqliteError);
    
    // create page view database table
    $sqlCreateTable = 'CREATE TABLE pageView(id INTEGER PRIMARY KEY, title TEXT, data TEXT)';
    @sqlite_exec($dbHandle, $sqlCreateTable); // remove or 'comment out' this line after first run
    
    // insert data in database
    $title = sqlite_escape_string(<content of title-field>); 
    $data = sqlite_escape_string(<content of news-field>); 
    $sqlInsertVisit = 'INSERT INTO pageView (title, data) VALUES (\''.$title.'\', \''.data.'\')';
    sqlite_exec($dbHandle, $sqlInsertVisit);
    
    // get content from database
    $sqlGetView = 'SELECT title,data FROM pageView';
    $result = sqlite_query($dbHandle, $sqlGetView);
    $pageView = sqlite_fetch_all($result); // store result in array
    
    // print page views
    foreach ($pageView as $entry) {
        echo 'title: ' . $entry['title'] . '  news: ' . $entry['data'];
    }


    this (more or less) should be the essentials you need..
     
  5. BentAnat

    BentAnat Software Dev

    Joined:
    26 Jun 2008
    Posts:
    7,230
    Likes Received:
    219
    one thing to consider in the above example (might be wrong - i normally work with mysql, not sqllite):

    remember when you pull it back out of the DB for display to stripslashes (the entry is parsed with sqlite_escape_string, which adds slashes around several characters - notably apostrophes, slashes, and some others).

    Wouldn\'t want news showing like this, would you?
     
  6. voodoo2k4

    voodoo2k4 Ghetto Modder

    Joined:
    21 Apr 2004
    Posts:
    316
    Likes Received:
    2
    Unfortunately Im no coder! Otherwise that wuld probably be the most useful thing ever. I have zero knowledge of PHP apart from dropping in pre-written functions here and there. Shame as it all looks nice and clean! I would need some serious hand holding to get that sorted though!

    Thanks a million though!

     
  7. alecamused

    alecamused Minimodder

    Joined:
    22 Apr 2008
    Posts:
    302
    Likes Received:
    24
    guess you're right. didn't try it, just copied it from some examples ;)

    deadline? i might have some free time this weekend to produce something worth dropping into your existing stuff.
     
  8. koola

    koola Minimodder

    Joined:
    11 Jul 2004
    Posts:
    2,401
    Likes Received:
    10
    www.cutephp.com

    Very small and neat flat-file news posting system. Brain dead easy to include in your pages and customise.
     
  9. voodoo2k4

    voodoo2k4 Ghetto Modder

    Joined:
    21 Apr 2004
    Posts:
    316
    Likes Received:
    2
    My night in shinning armour!

    Not in a gay way, more of a geek way!

    That does more than I need but in a clean simple system that I can incorpate (butcher) and doesnt completely mess up my existing pages. Lets hope it goes well when I have a play this weekend. I did a little test sub dir from work and look great so hopefully will be good.

    And the computer numpty client might actually not be able to screw up the site, winner!

    Thanks ever so much

    Dean.


     

Share This Page