Guest lithriel Posted November 14, 2007 Share Posted November 14, 2007 The main portion of my website (aplusdraftingdesigns.com uses SSI for the menu and footer areas. I would like to use the same navigation.inc and footer.inc file for the cart (http://aplusdraftingdesigns.com/store/ -currently offline) so that my client only has to update links from one file. I tried adding <!--#include virtual="/common/navigation.inc" --> to the index.tpl file located in the skins/myskin/styleTemplates/global/ directory. I even tried using a PHP include. Now I don't know much about PHP, so I'm not surprised the include files are not working. Is there anyway to use the same navigation.inc file in index.tpl and cart.tpl to skin my site without converting my entire site to PHP? What is the proper syntax? Right now the only way I can get the site to look correct is to insert the code that would have been the menu as xhtml directly into the index.tpl file, but using the include would make my life a whole lot easier. Quote Link to comment Share on other sites More sharing options...
vokf Posted November 14, 2007 Share Posted November 14, 2007 CubeCart uses "xtemplate" a PHP Template class. One feature that isn't used by cubecart (afaik), is the file include.... In a template file add: {FILE "/common/navigation.inc"} Use in place your SSI includes. I've just tested, and its working fine. I've been recently playing with the template class, as I may use it for a non cc project. You can't put PHP inside the .tpl files, (but you can output data from a php file - view the "assign" commands inside /includes/content/ files) I hope this helps, Jason Quote Link to comment Share on other sites More sharing options...
Guest lithriel Posted November 14, 2007 Share Posted November 14, 2007 Thanks very much for your reply, but I'm getting a fatal error "File does not exist" I even tried typing in the full url. Instead of using the easy absolute path "/common/navigation.inc" in your code I've used {FILE "http://aplusdraftingdesigns.com/common/navigation.inc"} and I get: __XTemplate fatal error: file [http://aplusdraftingdesigns.com/common/navigation.inc] does not exist__ Funny thing is, if you type in http://aplusdraftingdesigns.com/common/navigation.inc it shows up just fine. So it does exist. What am I doing wrong? CubeCart uses "xtemplate" a PHP Template class. One feature that isn't used by cubecart (afaik), is the file include.... In a template file add: {FILE "/common/navigation.inc"} Use in place your SSI includes. I've just tested, and its working fine. I've been recently playing with the template class, as I may use it for a non cc project. You can't put PHP inside the .tpl files, (but you can output data from a php file - view the "assign" commands inside /includes/content/ files) I hope this helps, Jason Quote Link to comment Share on other sites More sharing options...
vokf Posted November 14, 2007 Share Posted November 14, 2007 As a test, put the navigation file in the same directory as your store root; http://aplusdraftingdesigns.com/store/ Then just reference the file. The "index.php" file in the store root (and cart.php) invokes the template, so any paths are relative to that location. {FILE "navigation.inc"} I don't know if the template engine can handle urls, so you may have to use "../common/navigation.inc" (or something like that!) Jason Quote Link to comment Share on other sites More sharing options...
Guest lithriel Posted November 14, 2007 Share Posted November 14, 2007 Brilliant! It's working now and the files aren't in the store directory. The path "../common/navigation.inc" works when "/common/navigation.inc" does not. Thanks for clarifying the path that's being referenced. :w00t: Quote Link to comment Share on other sites More sharing options...
vokf Posted November 15, 2007 Share Posted November 15, 2007 No worries, it gave me an excuse to read up on the docs :-) The template project is on sourceforge, and still active, and there are other features what are not being exploited. Cheers! Jason 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.