Themes Guide

From ExponentCMS Docs

Jump to: navigation, search
Edit Menu

Image:Icon_Designers_40px.png Themes Guide

This page contains a Themes Guide with basic information about creating Exponent Themes.

Image:Icon_Developers_40px.png 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 Icon_Warning_20px.png

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 Icon_Warning_20px.png

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_blue_40px.png 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.


Image:Icon_Resources_20px.png Designers Resources

Personal tools