Jump to content

Can someone tell me what is wrong with this code?


Guest pghtech

Recommended Posts

Guest pghtech

So I am trying to keep custom code out of the main CC files. I have done the following to try and call a custom template in global/index.tpl which the associated inc.php file queries the database and returns the IMG_CURENT_CATEGORY in order to display the category image where I want to.

In the GLOBAL/INDEX.INC.PHP

require_once"includes".CC_DS."content".CC_DS."hdrImage.inc.php";

$body->assign("HDRIMAGE",$hdr_image);




Then in hdrImage.inc.php


<?php

$hdr_image = new XTemplate ("content".CC_DS."hdrImage.tpl");





##	Get Category info from Database

$currentCatQuery	= "SELECT cat_name, cat_id, cat_image, cat_desc FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_id = ".$db->mySQLSafe($_GET['catId'])." ORDER BY priority,cat_name ASC";

$currentCat			= $db->select($currentCatQuery);



if (!empty($currentCat[0]['cat_image'])) {

	$hdr_image->assign("IMG_CURENT_CATEGORY", imgPath($currentCat[0]['cat_image'], false, 'rel'));

	$hdr_image->assign("TXT_CURENT_CATEGORY", validHTML($currentCat[0]['cat_name']));

	$hdr_image->parse("hdr_image.cat_img");

	$hdr_image->parse("hdr_image.cat_name");

}



$hdr_image->parse("hdr_image");

?>

Finally in global/index.tpl

I call {HDRIMAGE}

And it doesn't work. What am I missing.

Link to comment
Share on other sites

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.   Paste as plain text instead

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