Originally Posted by
MaxBodine
Instead of writing the home page as one long page on define_main_page.php, for maintenance and a lot of updating that I do, I wanted to organize sections in php includes.
Example my regular websites index.php pages, I would take the six image section on
https://uesakausa.com put that in its own php file then on the index page I would use one line a php include() function.
<?php include('sixPictureSection.php') ?>
Then I can swap those out easily.
In the zen cart I would need to know what directory to save the sixPictureSection.php in so the define_main_page.php would know where to find it. I am just assuming I can do that.
Thanks!
There are a couple of different "core" Zen Cart functions that can help with this:
From a template directory (e.g. /includes/templates/YOUR_TEMPLATE/templates) to search for yourfilename.php in the templates subdirectory:
Code:
require($template->get_template_dir('yourfilename.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/yourfilename.php'); ?>
That will pull in /includes/templates/YOUR_TEMPLATE/templates/yourfilename.php, if it exists there. If not, it will pull in /includes/templates/template_default/templates/yourfilename.php. If not found there, a PHP error will result.
From the modules directory (e.g. /includes/modules/YOUR_TEMPLATE/yourfilename.php):
Code:
require(DIR_WS_MODULES . zen_get_module_directory('yourfilename.php'));
That will pull in /includes/modules/YOUR_TEMPLATE/yourfilename.php, if it exists there. If not, it will pull in /includes/modules/yourfilename.php. If not found there, a PHP error will result.
Bookmarks