blesseld Posted June 5, 2009 Share Posted June 5, 2009 Hey All, I'm looking to get pointed in the right direction to create a more dynamic php website. What I am trying to achieve is Setting up a database to store my content. I have done Many Many searches in google, and its all about creating the database. I guess I am after understanding how the data is stored and how to go about doing it... My site is currently setup with a wack of includes, to make things easier to update. Below is how my index page is setup, I setup a variable to give it a name, and the control.php is where i set all my variables for page_id, title, keywords ... <?php $sheet_name = "homepage"; include("inc/control.php"); ?> <?php include("inc/page-top.php"); ?> <p>Some content here</p> <?php include("inc/expand-boxes.php"); ?> <p>more includes</p> <?php include("inc/page-bot.php"); ?> I guess I'm just lost on what needs to be done... What I am after is storing my "Content" the code between the page-top and page-bot in a database to act like articles.... or is there a smarter thing to do? I get the concept of connecting to a database, Just don't know how the data is stores, and how do I store code and whatnot within the database. Any help on my journey to create a more dynamic php template/website would be very much appreciated, Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/ Share on other sites More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 Have you looked at some basic mysql tutorials (if you're planning on a mysql database) ? These would heplp you greatly. You communicate with the datbase using simple queries. An example of retrieving some data is as follows; SELECT * FROM `table`; Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/#findComment-850054 Share on other sites More sharing options...
blesseld Posted June 5, 2009 Author Share Posted June 5, 2009 I do plan on using mysql. ...and have just started reading into it Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/#findComment-850060 Share on other sites More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 And what exactly are you stuck on at the moment? Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/#findComment-850071 Share on other sites More sharing options...
blesseld Posted June 5, 2009 Author Share Posted June 5, 2009 I gues I'm lost on the actual process, Am I storing all my content within the data base... like the content between my top and bot includes, or am i storing the actual file within the db? or, like wrapping my content between my top/bot includes, creating another file then storing that in the db.... this is where im stuck Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/#findComment-850073 Share on other sites More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 It all depends what you want to do really. I use many different options depending on the project size. If I only have a few pages, I may just hard code everything. Something a bit bigger might hold all the page names in the db, and use a single index.php file to control the site. This can then pull certain templates (.html files) depending on the requested page, or get stored cintent from the db. Personally for static page content I'd just use a template folder as you currently are. If you want to store content areas (for example) you can add them to your table, then request the correct data depending on the current page etc... Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/#findComment-850074 Share on other sites More sharing options...
blesseld Posted June 5, 2009 Author Share Posted June 5, 2009 hrmmm, I kinda like the idea of storing variables in the db, ...also the site will be faily large in the end. My folder structure is currently: forum images inc js index.php about.php then i want to add a couple folders for different sections...that use different layouts. business entertainment ... all which are controlled by control.php...here is a snipet from the file case 'giorge': { $page_id = "101"; $title ="Title"; $meta_desc = "desc"; $meta_key = "keywords"; $nav_style = "browse"; $nav_trail_start = "home"; $nav_trail_root = "browse-places"; $nav_trail_category = "restaurants"; $nav_trail_page ="<a class='blue' href='#nogo'>- Giorge Restaurant</a>"; include("inc/head.php"); include("inc/header1.php"); break; } default: { echo ""; break; } } case 'giorge' is the main variable, all my pages have this. <?php $sheet_name = "homepage"; include("inc/control.php"); ?> I htink a db would be good for this control file, But i guess I want to tackle and learn to load full content within the body just to learn it, but main use would be for my news section I want to implement a box on the main page that takes "x"amount of characters form the 3 recent news pages, and feed them into my news box on my homepage. Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/#findComment-850085 Share on other sites More sharing options...
gevans Posted June 5, 2009 Share Posted June 5, 2009 Sounds like you've got the begginings of a plan there!! Anything else you need help with on this? Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/#findComment-850092 Share on other sites More sharing options...
blesseld Posted June 5, 2009 Author Share Posted June 5, 2009 I think I'm good for now, I'm going to start setting up the db, we'll see what issues I run into...i'll probably post them here if I run into any. Thanks for the help Link to comment https://forums.phpfreaks.com/topic/161085-question-for-setting-up-dynamic-database-website-help-please/#findComment-850097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.