Greetings
I have a little problem that I have been trying to solve... I am a new coder so please bear with me ..
I am trying to put the query and out put into a variable to pass to a template system... any ideas on how to do this would be appreciated
There are 4 files
file one )basic.html
( a file that holds the basic design of the page)
in this file I have 4 varialbes {header}{menu}{page_content}{footer}
file two)
list_makes.php file
there are 2 variables here that I want to fill with content {number}{table}
this is the file that generates the page
within this file I need to 'require '
process_makes.php file (third file)
which will get the values for {number} and {table} these holders are then passed back to the
list_makes.html file (fourth file )as the {page_content}
//
##################################
here is the basic_html file ( the main template holder)
##################################
{header}
<table width=778 cellpadding=10 cellspacing=0 border=0>
<tr>
<td valign=top class="navbar" id="navbar" bgcolor=#ECEFF6 width=130>{menu}
</td>
<td valign=top>{page_content}
</td>
</tr>
</table>
{footer}
##################################
// this is the list_makes.php file
##################################
<?php
// declare new template
$tpl = new template;
// load the files needed
$tpl->load_file('header','tpl/header.html');
$tpl->load_file('footer','tpl/footer.html');
$tpl->load_file('menu', 'tpl/menu.html');
$tpl->load_file('basic','tpl/basic.html');
$tpl->load_file('list_makes','tpl/list_makes.html');
require 'process_makes.php';
/
here we have to grab the variables number and table
then save them and pass them to list_makes.html for display
/
//define the content
$header = $tpl->return_file ('header');
$menu = $tpl->return_file('menu');
$tpl->load_file('list_makes', 'tpl/list_makes.html');
$tpl->register('list_makes','number,table');
$tpl->parse('list_makes');
$page_content = $tpl->return_file('list_makes');
// process the results
$footer = $tpl->return_file ('footer');
// register all variables within basic
$tpl->register('basic','header, menu, page_content,footer');
$tpl->parse('basic');
$tpl->print_file('basic');
?>
##################################
// here is the list_makes.html page that has the 2 variables or template holders
number and table
##################################
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src='../admin/images/title-level2.png'></td>
</tr>
<tr>
<td>There are currently {number} makes in the database to edit/remove.</td>
</tr>
<tr>
<td>{table}</td>
</tr>
<tr>
<td><img src='../admin/images/aline.png'></td>
</tr>
<tr>
<td><a href='/admin/page.php?pn=create_makes'>Create a new make</a></td>
</tr>
</table>
##################################
//process_makes.php page
##################################
<?
$tpl->load_file('list_makes','tpl/list_makes.html');
$tpl->register('list_makes','number,table');
// grab the number of results
mysql_select_db('foo');
$query= "SELECT * from makes";
$result= mysql_query($query);
$num_results= mysql_num_rows($result);
$number ="$num_results";
// this works here and the $number is passed into the template holder
// show the results here
$table ='the table results go here';
// this is the start of the results I want to save in the variable $table
// the below output is what I want for $table
echo"<table width=\"50%\" border=\"1\"><form>
<tr><td>Make Id</td><td>Make Name</td><td colspan=2>Modify</td>";
for ($i=0;$i<$num_results;$i++)
{
$row =mysql_fetch_array($result);
echo "<tr><td>$row[make_id]</td>";
echo "<td>$row[make_name]</td><td><a href=\"/cpanel/edit_make.php?id=$row[make_id]\">edit </a></td>";
echo "<td><a href=\"/cpanel/delete_make.php?id=$row[make_id]\">delete </a></td>";
echo "<input type=\"hidden\" name=\"make_name\" value=\"$row[make_name]\"><input type=\"hidden\" name=\"make_id\"value=\"$row[make_id]\"></tr>";
}
echo "</form></table>";
// end of the results that are formated and that I want to save
?>
thanks so much for everyone that took time to even look at it