Jump to content


This topic is now archived and is closed to further replies.


adding .tpl file to php smarty based website

Recommended Posts

HI there,


I have a website www.organicgrowshop.co.uk


I am trying to add a new static based template file to the site  www.organicgrowshop.co.uk/wormcasttea.html


For some reason the css is screwed up on it though. I added a new style for it in the admin panel and it takes the logo and the basket button from the style but not the CSS.


I edited the index.php file and added the new style sheet name to it:


$db = new DB();
$prods = $db->select("SELECT friendly, name FROM products");
$smarty->assign('prods', $prods);

foreach($_GET as $k=>$v){
	$smarty->assign($k, $v);
if(isset($_GET['friendly'])) {
	$friendly = mysql_real_escape_string($_GET['friendly']);
	$products = $db->select("SELECT * FROM products WHERE friendly='$friendly'");
	$the_product = $products[0];
	$name= $the_product['style'];

	$style = $db->select("SELECT * FROM styles WHERE `name`='$name'");

	$detail = json_decode($the_product['detail']);	
	$smarty->assign('detail', $detail);
	$smarty->assign('style', $style);
	$smarty->assign('the_product', $the_product);
} elseif(isset($_GET['css'])) {
	header("Content-type: text/css");

	$q = 'SELECT css, style FROM products WHERE friendly="'.$_GET['css'].'"';

	$res = mysql_query($q);
	if (mysql_num_rows($res) > 0) {
		$css = mysql_fetch_array($res);
		$smarty->assign('productCss', $css[0]);
		$style = $db->select("SELECT css FROM styles WHERE `name`='".$css[1]."'");
		$smarty->assign('styleCss', $style[0]);
	} else {
		$smarty->assign('productCss', '');
		$smarty->assign('styleCss', '');

		$style = $db->select("SELECT css FROM styles WHERE `name`='contact'");	
		$smarty->assign('styleCss', $style[0]);
	} elseif ($_GET['css']=='about') {
		$style = $db->select("SELECT css FROM styles WHERE `name`='about'");	
		$smarty->assign('styleCss', $style[0]);
	} elseif ($_GET['css']=='home' || $_GET['css']=='404' || $_GET['css']=='cart' || $_GET['css']=='admin' || $_GET['css']=='login' || $_GET['css']=='paypal' || $_GET['css']=='checkout' || $_GET['css']=='wormcasttea'){ 
		$style = $db->select("SELECT css FROM styles WHERE `name`='default'");	
		$smarty->assign('styleCss', $style[0]);

	$t = 'css.css';
	$smarty->assign('css', $_GET['css']);
} else {
$t = 'index.tpl';

if($t=='index.tpl' || $t=='404.tpl' || $t=='paypal.tpl' || $t == 'login.tpl'){	
$style = $db->select("SELECT * FROM styles WHERE `name`='default'");	
$smarty->assign('style', $style);		
$style = $db->select("SELECT * FROM styles WHERE `name`='contact'");	
$smarty->assign('style', $style);
$style = $db->select("SELECT * FROM styles WHERE `name`='about'");	
$smarty->assign('style', $style);
$style = $db->select("SELECT * FROM styles WHERE `name`='wormcasttea'");	
$smarty->assign('style', $style);



I can't figure out why it is not working :(


Any help is much appreciated!

Share this post

Link to post
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.