Adding Pages to my site
You have several options if you want to add a page to your site. Here they are, in increasing order of complexity:
Use EZ-Pages
EZ-Pages are a great way to add new text content to your site. The one restriction they have is that you can’t execute any PHP code on them, but for many situations, this is not required.
Use the built-in extra pages
The built-in extra pages are
You may use these pages to add content to your site.
Turn on creation of links to these pages from Admin > Configuration > Define Page Status, then modify the page content using the Define Pages Editor.
Use a Plugin
This plugin adds six new define pages which can be used just like page_2 .. page_4.
Build a new custom page
A number of files go into building a new page. The best way to create a new page is to use one of these plugins as a starting point:
The latter is somewhat less customizable but contains fewer files.
(Note that the About Us page is built in to Zen Cart 1.5.8 and higher; these plugins are referenced only as examples of how to build a page.)
The advantage of creating a new page is that you can use PHP in the page, which is not an option with EZ-Pages. Being able to use PHP means you can add conditional logic, do database lookups, customize for specific groups or customer characteristics, etc.
Add infrastructure to build multiple pages
Use this plugin as a starting point:
Linking to your New Page
Once you have created your new page, you’ll want to link to it. A few options are:
- If you have created the page as an EZ-Page, use the EZ-Pages sidebox.
- If you want the link in the Information Sidebox, use the instructions on adding a link to the Information Sidebox.
- You can put the link in the header or footer of your site, but the method of doing so will depend on your template.
- If you need to link to your new page, see creating links.
Site Map
If you add custom pages to your site, don’t forget to add them to your sitemap. Copy includes/templates/template_default/templates/tpl_site_map_default.php
to includes/templates/YOURTEMPLATE/templates/tpl_site_map_default.php
(if the override file is not already there), and add a link to your new page.
Providing Direct Access to Files
You may wish to simply provide files (such as PDFs or zips) on your site without requiring the registration and purchase steps associated with paid downloads.
For example, you may wish to provide:
https://MYSTORE.com/pdfs/acme_anvil_user_manual.pdf
or perhaps
https://MYSTORE.com/zips/acme_manuals.zip
The recommended method of doing this is described in Downloads which are not products.
If what you want to do is associate PDFs with specific products, look at the PDF Attachment in Product Description plugin.
Define Pages
While Define Pages won’t create entirely new pages, the mechanism can be used to inject additional content into your site.
Use of PHP
The use of PHP in new pages is subject to the following restrictions:
Mechanism | Restrictions |
---|---|
EZ-Pages | not allowed |
Built in extra pages | allowed, no restrictions |
Plugins | allowed, no restrictions (assuming plugin creates a custom page) |
New Custom Page | allowed, no restrictions |
Define Pages | allowed but not recommended; should not be used if CKEditor is also used |