Guest pghtech Posted September 5, 2008 Share Posted September 5, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.