1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to add content easily to a page?

Discussion in 'Web Design' started by Wings[SENSE], Oct 14, 2011.

  1. Wings[SENSE]

    Wings[SENSE] Regular Member

    Joined:
    Jan 10, 2010
    Messages:
    373
    Likes Received:
    177
    Occupation:
    SEO co.
    Location:
    Quebec
    Hey everyone,

    I have a client who wants me to redesign his website but he also wants a little box on the main page where he can writes news daily (eg If the office is closed for the holiday, he wants to be able to write it in the designed box).

    I'm only good at designing and I have no idea how to code this kind of thing. I thought maybe looking for a script is my best bet but I also have no idea how these works so it didn't really help me.

    Basically my client wants something very easy to use like login somewhere, write what he wants, save/publish and it's done.

    Any ideas on how to implement this? :confused:

    Thanks a lot!!
     
  2. The Doctor

    The Doctor Jr. VIP Jr. VIP

    Joined:
    Dec 18, 2010
    Messages:
    612
    Likes Received:
    188
    Occupation:
    Computer Scientist, Engineer, Programmer.
    Location:
    ☆☆☆☆☆☆
    hmm lets see the simplest way would be to make a directory called "secure" or something and then on the main page where the content is supposed to be put:
    PHP:
    <?php echo file_get_contents("secure/content.txt"); ?>
    no go into "secure" and create a file called content.txt. Then right click the file and select something like "properties" or "permissions" and set permissions to 777. Now in the secure directory create a file called admin.php and add this to it:

    Code:
    <html>
    <head>
    <title>Admin</title>
    </head>
    <body>
    <?php
    if(isset($_POST['submit']))
    {
      $fp = fopen('content.txt', 'w');
      fwrite($fp,$_POST['content']);
      fclose($fp);
      echo "<center>content has been saved</center><BR><BR>";
    }
    ?>
    <form action="admin.php" method="POST">
    <textarea name="content" rows="100" cols="100"><?php echo file_get_contents("content.txt"); ?></textarea>
    <BR>
    <input type="submit" value="submit" name="submit">
    </form>
    </body>
    </html>
    now go into cpanel and password protect the "secure" directory. I just threw this together real fast for you and there could be errors. I haven't tested it but it should work.
     
    • Thanks Thanks x 1