How to Create a Static Page in Zen Cart
Say you want to create a new page called MyPage and link it from the information sidebox. Here's the seven step process to do that.
And you're done!
- Tell Zen Cart what new files/folders it should be looking for. In "includes/extra_datafiles/", create a file named "mypage_filenames.php" that looks like:
- Now we create the actual content. Make a file in "includes/languages/english/mytemplate/" called "mypage.php". In it you can define all of the normal content definitions. It normally looks something like:
define('NAVBAR_TITLE', 'This is mypages breadcrumb and title');
define('HEADING_TITLE', 'This is mypages heading!');
define('TEXT_INFORMATION', 'Here is where mypages actual content goes!');
- Create a new folder in "includes/modules/pages/" with the name you defined above in step one, so in our case it would be called "mypage".
require(DIR_WS_MODULES . 'require_languages.php');
- Now for the layout. Create the template file in the folder "includes/templates/mytemplate/templates/". You want it to be called "tpl_mypage_default.php". The standard layout is something like:
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<?= $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?>
<tr><td class="pageHeading" align="center">
<h1><?= HEADING_TITLE; ?></h1>
<?= TEXT_INFORMATION; ?>
<?= zen_back_link() . zen_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?>
- Define the menu title. Open "includes/languages/mytemplate/english.php" (if it doesn't already exist, copy over the entire base file from "includes/languages/english.php" and modify that) and add a line like this:
define('BOX_INFORMATION_MYPAGE', 'Visit MyPage!');
- Add it to the information sidebox in "includes/modules/sideboxes/mytemplate/more_information.php" by adding the line near the top:
$more_information = '<a href="' . zen_href_link(FILENAME_MYPAGE) . '">' . BOX_INFORMATION_MYPAGE . '</a>';