Guest acschnabel Posted May 30, 2011 Share Posted May 30, 2011 I'm adding a custom content box to my header. Right now, it's just supposed to show a horizontal list of items separated by a "|", but instead, it displays the work "Array" and nothing else. I can custom code the HTML into the global/index.tpl file but need to get a grasp of this custom boxes concept for my own understanding. Here's what I've got: includes\global\index.inc.php file: ## Custom Top Menu Box require_once'includes'.CC_DS.'boxes'.CC_DS.'topMenu.inc.php'; $body->assign('TOP_MENU',$box_content); In includes\boxes\topMenu.inc.php: <?php if (!defined('CC_INI_SET')) die("Access Denied"); ## include lang file $lang = getLang('includes'.CC_DS.'boxes'.CC_DS.'topMenu.inc.php'); $box_content = new XTemplate ('boxes'.CC_DS.'topMenu.tpl'); ?> In the skins\Classic\styleTemplates\boxes\topMenu.tpl file: <!-- BEGIN: topMenu --> {LANG_HOME} | {LANG_NEW_CUSTOMERS} | {LANG_SIGNIN} | {LANG_MY_ACCOUNT} | {LANG_CUSTOMER_SERVICE} <!-- END: topMenu --> In the language\en\includes\boxes\topMenu.inc.php <?php $lv = !$langBully ? "lang" : "bully"; ${$lv}['topMenu'] = array( 'home' => "Home", 'new_customers' => "New Customers", 'signin' => "Sign In", 'my_account' => "My Account", 'customer_service' => "Customer Service", ); ?> And finally in the skin\Classic\styleTemplates\global\index.tpl file <div>{TOP_MENU}</div> I've found a bunch of "How to add custom content" but they all seem to be really old and CCv3 related. If anyone can point me towards a guide for doing it in CC4, that would be great. Thanks in advance for your help. Quote Link to comment Share on other sites More sharing options...
leeofaccy Posted May 30, 2011 Share Posted May 30, 2011 You need to open your includes\boxes\topMenu.inc.php and assign the values to the text between the curly brackets that are on your \styleTemplates\boxes\topMenu.tpl Try this.... <?php if (!defined('CC_INI_SET')) die("Access Denied"); ## include lang file $lang = getLang('includes'.CC_DS.'boxes'.CC_DS.'topMenu.inc.php'); $box_content = new XTemplate ('boxes'.CC_DS.'topMenu.tpl'); $box_content->assign('LANG_HOME', $lang['topMenu']['home']); $box_content->assign('LANG_NEW_CUSTOMERS', $lang['topMenu']['new_customers']); $box_content->assign('LANG_SIGNIN', $lang['topMenu']['signin']); $box_content->assign('LANG_MY_ACCOUNT', $lang['topMenu']['my_account']); $box_content->assign('LANG_CUSTOMER_SERVICE', $lang['topMenu']['customer_service']); $box_content->parse('topMenu'); $box_content = $box_content->text('topMenu'); ?> Also, remove the comma from the end of this line in your language file 'customer_service' => "Customer Service", Lee Quote Link to comment Share on other sites More sharing options...
Guest acschnabel Posted May 30, 2011 Share Posted May 30, 2011 Beautful.. Thank you much. 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.