Template Tricks
Table of contents
- About
- Custom CSS and JS
- Help, I broke my theme !
- Howto
- Adding a print button only if current page is a wiki page
- Adding some HTML (ex.: a logo) to the print version of wiki pages
- Adding a "Hello John" indication
- Adding content only for a group
- Adding content only for a permission
- Adding content only for a preference
- Display content conditional to current language
- How to know where something is in a template?
- How do I change the email messages?
- How to show content just when in certain pages
- How to force switch Theme for Anonymous
- Add wiki syntax in Custom code text areas of Look & Feel
- Add javascript tracking code
- Add your own PHP code
- Add Post-It Notes
- Add a top-level menu
- Timed content
- Dynamic content
- show the content without columns
- Add a wiki page in module
- How to Add Custom jQuery Code Using the Custom Code Textareas
- Debug
- Categories used in templates
- Show or hide modules by category
- Section
- Perspective
- Variables
- Alternate view of wiki content
- Improve communication for planned maintenance
- Related
About
Below, we will document some little template tricks. Typically show content depending on something. Can be done directly in templates/*.tpl files or in Admin > Look & Feel.Custom CSS and JS
Starting in Tiki5, in Admin > Look & Feel (tiki-admin.php?page=look) > Miscellaneous, there is a Custom Code section to add custom CSS and JavaScript.You can create styles/custom.js or styles/yourtheme/custom.js and that should get included automatically. You may need to empty your Tiki cache.
Change size of subtitle
custom CSS
#sitesubtitle {
font-size: 24px;
}Help, I broke my theme !
Apparently, a problem with my custom theme is preventing me from accessing my site normally.Reset the theme "manually": If you can't access the admin pages to set your site's theme back to one that is known to work, you can reset the theme from the back end, so to speak.
Database method: Use phpmyadmin on your server to access your Tiki database. In the table "tiki_preferences", find the row for "site_style". Edit this row by replacing the custom theme name with a standard theme, such as thenews.css.
FTP method (easier): Using your FTP client, go to the styles directory of your Tiki installation and rename the theme currently set as the site theme, such as by changing its ".css" file extension to ".txt". Tiki will revert to the default. Log in using the default theme and fix what is wrong. Also clear the site caches.
When trying out a new theme, it is much better to use the "switch theme" module to select it. Don't make a new and untried theme the site theme without first trying it out from the switch-theme module.
I am stuck in a theme
To change themes, you can point your browser to a non faulty theme:- Point your browser to: tiki-switch_theme.php?theme=fivealive.css
- Then, also check to Clear the cache with tiki-admin_system.php?do=all
If anything doesn't change
For some unknown reason the theme doesnt change. Look directly in the database in'tiki_preferences' look at:UPDATE `tiki_preferences` SET `value` = 'fivealive.css' WHERE `tiki_preferences`.`name` = 'style';
Howto
Adding a print button only if current page is a wiki page
{if $page neq ''}
<a title="{tr}Print{/tr}" href="tiki-print.php?page={$page|escape:"url"}">
<img src="pics/icons/printer.png"/>{tr}Print{/tr}
</a>
{/if}Adding some HTML (ex.: a logo) to the print version of wiki pages
Admin -> Look and Feel -> Customization -> HTML
{if $SCRIPT_NAME eq '/tiki-print.php'}
<img src="img/tiki/Tiki_WCG.png" alt="Site Logo" style="border: none">
{/if}