You can include another .tpl file in the theme files using this code:
{FILE "themes/YOUR_THEME/myfile.tpl"}
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!
</div>
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 )
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):
include:mytext.html
Don't forget to place mytext.html file in datas/html folder
Otherwise this won't work.
1. External HTML file is using CSS file from your theme. e.g.
<html>
<head></head>
<body>
<div class="block">
This block will be using css class from themes/mytheme/mytheme.css
because my default theme is mytheme
</div>
</body>
</html>
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)
<html>
<head>
<title>HTML Include</title>
</head>
<body>
<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.
</div>
</body>
</html>
3. There can be only one include per page
4. Function is space sensitive
Valid code:
include:mytext.html
Wrong code:
include: mytext.html
You can also redirect to an URL.
Example:
redir:mypage.html
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.
Example:
http://www.yoursite.com/page.php?m=edit&id=1
1. You can only point to another page on your website.
Valid code:
redir:page.php?id=1
Wrong code:
redir:http://www.cotonti.com
2. Function is space sensitive
Valid code:
redir:page.php?id=1
Wrong code:
redir: page.php?id=1
Bedankt: 4 tijden
It would be nice to write/update such an article for Siena!