Including content in the pages or the theme files Including content in the pages or the theme files

Including external HTML into TPL files or pages

Including content in the pages or the skin files

#1. Including a TPL file into another TPL file

You can include another .tpl file in the theme files using this code:

{FILE "themes/YOUR_THEME/myfile.tpl"}

#1.1. Simple example: Ask visitor to sign-up for your newsletter

We're gonna create reminder.tpl and put it in themes/mytheme folder.

This is the code:

<div class="block">
<img src="theme/{PHP.theme}/img/newsletter.png" width="64" height="64" alt="" /> 
Please, don't forget to sign up for our Newsletter!

Notice that this .tpl file doesn't have beginning and ending template blocks (e.g. <!-- BEGIN: MAIN --><!-- END: MAIN -->)

This .tpl file (reminder.tpl) can be included in any .tpl file.

For the purpose of this "tutorial", I included it in 3 files: page.tpl, list.tpl and forums.sections.tpl

You simply have to place this code :

{FILE "themes/mytheme/reminder.tpl"}

where you want it to appear.

And this is my output:

P.S. If you don't see any changes make sure you cleaned the "Disk cache" ( Administration > Other > Disk cache > Purge all )

Including a whole HTML file into a page

Pages can pickup the content of an HTML file as body of the page. You simply have to place this line in page text (in MarkItUp or in CKEditor Source mode):


Don't forget to place mytext.html file in datas/html folder

Otherwise this won't work.

#1.2. What can be done, and what can't?

1. External HTML file is using CSS file from your theme. e.g.

<div class="block">
This block will be using css class from themes/mytheme/mytheme.css
because my default theme is mytheme

2. Include tag must be the only thing entered in page text

HTML file will be included in this case:

But it won't work in this case:

love.html code: (used in examples above)

<title>HTML Include</title>
<div class="block">
<strong>I'm an external HTML file included in this page! Beware!</strong><br />
Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Quisque fermentum massa eu quam pellentesque quis dapibus nisl tincidunt. 
Sed augue lectus, consectetur quis sollicitudin ac, pulvinar sit amet nulla. 
Mauris a purus mattis nulla eleifend condimentum. 
Nullam leo diam, mollis at tempus vel, fermentum a justo. 
Donec eget erat augue, vel porta lorem. 
Praesent tristique tortor ac nulla aliquam non varius lectus dapibus.
Morbi consectetur ante ut dui consequat vel placerat neque congue. 
Maecenas rutrum pharetra viverra. Nam ut augue. 

3. There can be only one include per page

4. Function is space sensitive

Valid code:


Wrong code:

include: mytext.html

#2. Redirecting from a page to another URL

You can also redirect to an URL.



And when you click on the page which has this code in page text, it will automatically redirect you to mypage.html

Note: You'll have to use direct URL to edit the page which has "redir:" in page text.


#2.1. Things to remember:

1. You can only point to another page on your website.

Valid code:


Wrong code:


2. Function is space sensitive

Valid code:


Wrong code:

redir: page.php?id=1

1. Eugene  2012-04-17 01:53

It would be nice to write/update such an article for Siena!

Only registered users can post new comments