Themes Guide
From ExponentCMS Docs
This page contains a Themes Guide with basic information about creating Exponent Themes.
| Developers Note: Please see the New Themes Guide which is currently being implemented in the Exponent 0.97.0 development trunk. | ||
Contents |
About Exponent Themes
The important thing to remember about Exponent Themes is that the main site theme controls the overall look and feel of the website, but you can also control design of individual page content by modifying Module views, from the Default view for each module to any other view you create. You can also change the look of some system-wide views (Login, Search) by modifying the files in the /exponent/views/ folder.
If you modify any view, don't do it in your main exponent directories or you'll lose your custom views on the next upgrade. Instead, copy any view file you wish to modify to your themes folder.
Adding a Back Button to a Module View
This is a guide to adding a Back Button or Return to Previous Page Link to an Exponent Theme Module Page so that users have a link to go back to the main page after reading a news article or other sub-module page.
| ALERT! If you modify Module Files then they will be overwritten when you upgrade Exponent. Save a backup of any changes to your local computer. |
You need to access the the exponent_flow_get() function from the Flow subsystem subsystem/flow.php. This returns the last URL set from a user's session data. By saving this information to a template variable $backlink you can then recall it to make the Back to Previous Page link.
It's straightforward for basic modules (News, Listings, Articles, etc), but a bit more difficult for complex modules (Blog, Image Gallery, etc) as you need to store the location info before it gets modified by user interaction
Simple Solution
For the News Module, edit the module actions file:
modules/newsmodule/actions/view.php
Insert the following code into line 41:
$template->assign('backlink',exponent_flow_get()); $template->output();
Then edit the module views file:
modules/newsmodule/views/_viewSingle.tpl
Insert the following code wherever you want the link to appear:
<a href="{$backlink}">back to previous page</a>
Complex Solution
For the Blog Module, edit module actions file:
modules/weblogmodule/actions/view.php
Insert the following code before line 22:
$backlink = (exponent_flow_get()); exponent_flow_set(SYS_FLOW_PUBLIC,SYS_FLOW_ACTION);
Insert the following code before line 80:
$template->assign('backlink',$backlink); $template->output();
Then edit the module views file:
modules/weblogmodule/views/_view.tpl
Insert the following code wherever you want the link to appear:
<a href="{$backlink}">back to previous page</a>
See Forum Post: News Module Return to Previous Page link.
Designers Resources
- Download Themes
- Designers Guide — doesn't really exist yet!
- Zimmer Tech Themes Tutorial — excellent Exponent CMS Theme tutorial.
- 4webhelp.net — Unix timestamp converter to change timestamps into dates.
- 01-scripts.de — Unix timestamp converter to change timestamps into dates and dates into timestamps.
- Smarty Template Engine — official website.
- Smarty Manual — excellent reference guide.
- Smarty Wiki — excellent unofficial Wiki guide.


