I need help please.
I'm very new to the vbulletin code as well as sql. I'm toying around with my software and I'm working on a small "garage" if you will, I guess you could say I'm using this as a learning process..
I have things set up already to work without going thru the vbulletin templates and I'm trying to set that up now.
I'm needing to read all the data from the table and pass all the data to the templates but I'm lost on how to do this, all I can manage to do is send one line over instead of everything.
bamfg.php
PHP Code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT', 'bamfg');
define('CSRF_PROTECTION', true);
$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array('bamfg_main');
$actiontemplates = array();
require_once('./global.php');
$navbits = construct_navbits(array('' => 'Test Page'));
$navbar = render_navbar_template($navbits);
$query = "SELECT * FROM BAMFG_vehicle";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))
{
$yearz = $row['year'];
$makez = $row['make_model'];
}
$templater = vB_Template::create('bamfg_main');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('year', $yearz);
$templater->register('make_model', $makez);
print_output($templater->render());
?>
Of course, with the code above it will only send the data from the very last query over to the template.
If I were to move the parts of the code up inside the while statement then it would send the very first query of the table over to the template.
This is where I'm lost =/
Here is my template code.
bamfg_main
PHP Code:
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<div id="pagetitle">
<h1>{vb:raw pagetitle}</h1>
</div>
{vb:raw year}
{vb:raw make_model}
<h2 class="blockhead">Title</h2>
<div class="blockbody">
<div class="blockrow">
Text
</div>
</div>
{vb:raw footer}
</body>
</html>
Thanks alot guys, I'm going to be searching the forums some more as well.