fairview Posted July 27, 2007 Share Posted July 27, 2007 Hi - I am trying to add a custom menu to a side box on my store, and need to use php code in the menu. Can it be included in the template file, or do I need to strip the PHP out and put it in the menu.inc.php? Quote Link to comment Share on other sites More sharing options...
Guest eric47905 Posted July 29, 2007 Share Posted July 29, 2007 Im not sure if I am much help on your answer here, but I know you can do javascript and html obviously in the template files. But as far as the php, I think it would if at worst be better to code in the .inc.php file and just call to it as the rest of the items do in the template. At least that way, even if it could work in the template file (which I dont know if it can or if it cant, but I think the template file just gets called up as an html file in essence, and all the functionality is referenced to the php files in the background) you would have all of the real coding seperated making it easier to go back later and work on. That way the templates would stay as pure templates and code would be where the rest is. Sorry if that doesnt help you Quote Link to comment Share on other sites More sharing options...
Guest EverythingWeb Posted July 29, 2007 Share Posted July 29, 2007 the .tpl files dont get parsed for PHP. PHP has to be in the inc.php controlling the template :cry: Quote Link to comment Share on other sites More sharing options...
vokf Posted July 29, 2007 Share Posted July 29, 2007 The documentation for the template engine can be found at: http://www.phpxtemplate.org It looks pretty powerful stuff. In fact, I've just uploaded the new class (0.4.0 to see if it works - CubeCart is using an old version), and all is fine. Not too sure if there is much difference (speed or features), the file is larger, but it looks to have much more comments than the old file. Jason Quote Link to comment Share on other sites More sharing options...
markscarts Posted July 29, 2007 Share Posted July 29, 2007 Yah yah, XTemplate system is great and powerful, but there is a definite separation between the php code and the xhtml code in the XTemplate system, like everythingweb has said your php won't get parsed there. You cannot use php code in the templates. Quote Link to comment Share on other sites More sharing options...
fairview Posted July 31, 2007 Author Share Posted July 31, 2007 Thanks all - any idea about how to accomplish to following: I want to set the class of an <li> in a menu file based on a variable, so that I can create an expandable menu (which expands based on the category being viewed.....). Normally I would do it like this: <li class="<?php echo($pagetype;) ?>"><a href=".....catid=15">page name</a></li>. I haven't quite been able to figure out how to integrate the inc.php files with the template files.... I have seen the quickie tutorials, but they just reference calling the template from the inc.php file and the index.php file.... I need to figure out how to integrate the two. the inc.php files don't seem to use any html at all..... and the template files dont' use php, so I need to figure out how to strip the php out of the html in the statement above, or how to put the html into the inc.php file..... Any one willing to help? thanks again. Quote Link to comment Share on other sites More sharing options...
fairview Posted July 31, 2007 Author Share Posted July 31, 2007 Good News! I was able to figure it out thanks to a tip on the cubecartforum.org site in Hacks and Tweaks... to see the results, you can view: http://pearsandbears.net/store/index.php?a...at&catId=21. 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.