Web Analytics Made Easy -
StatCounter Best way to load content into website? - CodingForum


No announcement yet.

Best way to load content into website?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Resolved Best way to load content into website?


    Whenever I've made a website, I've always made the design and general layout at first. Then I've just used that page as a "template" for all future pages on the site. However, I guess that is not the most efficient way to build up a website.

    My site is made up with includes (for the header, footer, etc). But, how would the best way be to load different content whenever a link is clicked? Right now I'm just dublicating the general template and pastes content into the main div - and repeats that behaviour for every single page (gallery, contact, etc).
    Last edited by CaptainB; Apr 9, 2009, 02:44 PM.

  • #2
    http://www.codingforum.net/showthread.php?t=129123 is worth a look.
    Digitalocean Cloud Hosting (Referral link - get $10 free credit) Fameco


    • #3
      You might consider using a CMS like Joomla! or a template engine like Smarty.
      jeremy - gnomeontherun
      Educated questions often get educated answers, and simple questions often get simple answers.


      • #4
        Hi abduraooft, thanks for the link. I read the thread, however, I'm not totally sure I understand it fully. It seems like the code loads scripts, css, content, etc from a title attribute?

        What I want is just to change the actual content when a link is clicked as every site uses the same css and scripts. I guess there is a simpler way to do this? The solution in the link seems pretty much more advanced than what I need for my little site to me?


        • #5
          Originally posted by jeremywilken View Post
          You might consider using a CMS like Joomla! or a template engine like Smarty.
          I tend to avoid CMS - I want to code the stuff myself and like to know what every little bit does . Also, I find CMS too feature rich and hard to customize for a little site like mine.


          • #6
            Create your content in various plain text files (that can also include some HTML),
            call them .. p1.txt, p2.txt, p3.txt, etc.

            Then at the top of your "index.php", you have something like this:


            Where you want the text (content) to appear, do this:
            <?php include($page);?>

            Now, load various content by specifying the page in a link.

            index.php (if no page specified, p1.txt is loaded as the default).

            Finally, you edit those text files to change content ... either offline,
            or use an online editor such as FCKEditor.


            • #7
              For a little more security look into using the method described here: http://www.digital-web.com/articles/easypeasy_php_2/
              ||||If you are getting paid to do a job, don't ask for help on it!||||


              • #8
                Thank you guys, exactly what I was looking for!!