Jump to content

adding .tpl file to php smarty based website


hashstar

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:

 

<?
include('include/includes.php');
$db = new DB();
$prods = $db->select("SELECT friendly, name FROM products");
$smarty->assign('prods', $prods);

if(isset($_GET)){
foreach($_GET as $k=>$v){
	$smarty->assign($k, $v);
	}
}
if(isset($_GET['t'])){
$t=$_GET['t'].'.tpl';
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', '');
	}

	if($_GET['css']=='contact'){
		$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);		
}
elseif($t=='contact.tpl'){
$style = $db->select("SELECT * FROM styles WHERE `name`='contact'");	
$smarty->assign('style', $style);
}
elseif($t=='about.tpl'){
$style = $db->select("SELECT * FROM styles WHERE `name`='about'");	
$smarty->assign('style', $style);
}
elseif($t=='wormcasttea.tpl'){
$style = $db->select("SELECT * FROM styles WHERE `name`='wormcasttea'");	
$smarty->assign('style', $style);
}
$smarty->display($t);

 

 

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

 

Any help is much appreciated!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.