Guest marklyon Posted February 22, 2008 Share Posted February 22, 2008 Hi all! I've been trying to figure this out and I've failed miserably - I'm no PHP Guru! I have a menu I'm using on the following site: http://www.able-training.co.uk and I'd like to use that menu within Cube Cart? How would I include it using PHP? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
burgensteen Posted February 22, 2008 Share Posted February 22, 2008 Cant you just use the standard CC menu and style it as you want ?? Quote Link to comment Share on other sites More sharing options...
Guest marklyon Posted February 22, 2008 Share Posted February 22, 2008 Cant you just use the standard CC menu and style it as you want ?? I haven't looked into it to be honest. I'm trying to make everything low maintenance so that when I change one php file it reflects site-wide. Quote Link to comment Share on other sites More sharing options...
Guest tyler-bishop Posted February 24, 2008 Share Posted February 24, 2008 Cant you just use the standard CC menu and style it as you want ?? I haven't looked into it to be honest. I'm trying to make everything low maintenance so that when I change one php file it reflects site-wide. Thats how the templates function, if you edit index.tpl it will reflect almost all the pages. Quote Link to comment Share on other sites More sharing options...
Guest marklyon Posted February 25, 2008 Share Posted February 25, 2008 Thanks tyler-bishop The only problem is when I edit the index.tpl to include the following code: <?php include_once("'path_to_my_includes_folder'/menu.php"); ?> It doesn't work. At the moment CubeCart is really well integrated into the design of the site and I'd like to use the same menu on the e-commerce pages as I do on the rest of the site - hence using the includes as it will be fantastic to edit just one file. I hope I've explained myself a little better. Cheers Quote Link to comment Share on other sites More sharing options...
Guest Brivtech Posted February 26, 2008 Share Posted February 26, 2008 You're almost there! You need to put the php code within the inc.php file, and then parse it to the template file! So, in your example, assuming it's the global/index.tpl file... open: includes/global.index.inc.php Then add in somewhere where there are similar lines: $menu_code = "whatever code you put in the file that you were trying to include"; $body->assign("MY_MENU",$menu_code); Then, open up your index.tpl file that you first mentioned, and replace the line of php that you added with this: {MY_MENU} Save and upload, and where you have the item in the curly brackets, it will be passed (parsed) the information from the inc.php file that does all the processing work. If you're still unsure about this, have a look at some of the other variables there, and see how they have been programmed. Each .tpl file has a respective inc.php file that processes the database information and passes it to the template. Quote Link to comment Share on other sites More sharing options...
Guest marklyon Posted May 16, 2008 Share Posted May 16, 2008 Brivtech! Your a legend! Quote Link to comment Share on other sites More sharing options...
Guest Astroman Posted May 27, 2008 Share Posted May 27, 2008 Hi, I'm trying to do something similar so I thought I'd post it here. Can you tell me how I would include the current year in a tpl file? Usually in tpl files I write something like {PHP}echo date ('Y');{/PHP} but that doesn't work with Cube Cart, so I guess I have to use a different method? Quote Link to comment Share on other sites More sharing options...
Guest EverythingWeb Posted May 27, 2008 Share Posted May 27, 2008 Yeah, you will need to assign the value in the PHP: $body->assign("DATE", date('Y-m-d')); Then, in the .tpl, use: {DATE} where you want it. Quote Link to comment Share on other sites More sharing options...
Guest Astroman Posted June 2, 2008 Share Posted June 2, 2008 Yeah, you will need to assign the value in the PHP: $body->assign("DATE", date('Y-m-d')); Then, in the .tpl, use: {DATE} where you want it. Thanks, I will give that a go. 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.