Ok, i am designing my new website design and it's all going to be dynamic but i've come across a major problem. Basically, i'm filling a template file with content from a database which is fine until i need to use multiple tables for one section. If you look at the images below, you can see what I'm trying to achieve and what i currently am achieving.
The two images showing what i am trying to achieve are attached. The image named Current is what the code currently generates and the other is what i aim for the code to generate. These can also be found at the imageshack links below.
Current :- http://img525.imageshack.us/i/current1.png/
What i am aiming for:- http://img101.imageshack.us/i/perfect1.png/
My code is as follows.
<?php
// Connect to database
include("config.connection.php");
include("open.connection.php");
// Variables
$per_page = $side_articles;
$links_per_page = '5';
$sort = $side_order;
// Get Offset
$offset = $_GET['s'];
if(!$offset) $offset = 1;
$limit = ($offset - 1) * $per_page;
// Get File Count
//($count = mysql_query('SELECT * FROM side_section',$conn)) ? $queries++ : die(mysql_error());
//$total = mysql_num_rows($count);
$x = 1;
//
// Get side
($section_extraction = mysql_query('SELECT * FROM side_section', $conn)) ? $queries++ : die(mysql_error());
// Side Has Rows
if (mysql_num_rows($section_extraction) < 1)
{
$sidesectionlist_loop = il_template_opener('side.section.list.no.side.tpl');
}
else
{
// Print Files
while($side = mysql_fetch_array($section_extraction))
{
// Loop Template Replace
$t_r_array = Array();
$t_r_array[] = array('{SIDE_LIST_SID}', $side['ID']);
$t_r_array[] = array('{SIDE_LIST_SECTION_TITLE}', $side['Title']);
// Second Query
($section_info = mysql_query("SELECT * FROM side_title where SectionID='$side[iD]'", $conn)) ? $queries++ : die(mysql_error());
while($side2=mysql_fetch_array($section_info))
{
// Loop Template Replace
$t_r_s_array = Array();
$t_r_s_array[] = array('{SIDE_LIST_IID}', $side2['ID']);
$t_r_s_array[] = array('{SIDE_LIST_ITEM_TITLE}', $side2['Title']);
$t_r_s_array[] = array('{SIDE_LIST_FILE}', $side2['File']);
$t_r_s_array[] = array('{SIDE_LIST_ARTICLE}', $side2['SectionID']);
$sideitemlist_loop .= il_template_array_replace('side.item.list.loop.tpl', $t_r_s_array);
}
$sidesectionlist_loop .= il_template_array_replace('side.section.list.loop.tpl', $t_r_array);
}
}
// Paging Links
//$sidelist_paging = paging('side.php?s=','s',$total,$per_page,$links_per_page,1,1,1,1,0,0);
// Main Template Replace and Print
$t_r_f_array = Array();
$t_r_f_array[] = array('{SIDE_LIST_LOOP}',$sidesectionlist_loop);
$t_r_f_array[] = array('{SIDE_LIST_ITEMLOOP}',$sideitemlist_loop);
$sidelist_output = il_template_array_replace('./'.$theme.'/'.$protocol.'side.list.tpl',$t_r_f_array);
print($sidelist_output);
//print($sidesectionlist_loop);
//il_output('side',$sidelist_output,
//'
//<script type="text/javascript" src="scripts/misc.js"></script>
//');
//include("close.connection.php");
?>
The structure of the two tables is as follows:
Side Section
ID
Title
Side Title
ID
Title
File
SectionID
This is really holding me back because without this, i lack a way of making the rest of my pages functional, any help will be greatly appreciated.
[attachment deleted by admin]