...

View Full Version : Resolved Best way to load content into website?



CaptainB
04-09-2009, 12:37 PM
Hi,

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).

abduraooft
04-09-2009, 01:00 PM
http://www.codingforums.com/showthread.php?t=129123 is worth a look.

gnomeontherun
04-09-2009, 01:17 PM
You might consider using a CMS like Joomla! or a template engine like Smarty.

CaptainB
04-09-2009, 01:19 PM
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? :)

CaptainB
04-09-2009, 01:21 PM
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. :)

mlseim
04-09-2009, 01:35 PM
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:

<?php
$page="p1.txt";
if($_GET['p']){
$page="p".$_GET['p'].".txt";
}
?>

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).
index.php?p=2
index.php?p=3

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

_Aerospace_Eng_
04-09-2009, 01:40 PM
For a little more security look into using the method described here: http://www.digital-web.com/articles/easypeasy_php_2/

CaptainB
04-09-2009, 02:30 PM
Thank you guys, exactly what I was looking for!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum