(→Second level structure) |
(→Second level structure) |
||
| Line 43: | Line 43: | ||
$template->assign_vars(array( | $template->assign_vars(array( | ||
| - | 'PLACEHOLDER'=> $placeholder_data | + | 'PLACEHOLDER'=> $placeholder_data |
| - | )); | + | )); |
[[Image:Theme-structure-main-home-php.gif|Second level structure is defined by main_home.php]] | [[Image:Theme-structure-main-home-php.gif|Second level structure is defined by main_home.php]] | ||
Note: This is a technical document. It discusses technical aspects of theme module and developing a custom theme which requires a good knowledge of advanced PHP, HTML, CSS and Javascript and is not meant for non-technical users. Know more about themes: What are themes? | Using Themes.
Contents |
Themes are neither solid, liquid or gas. They are collection of PHP scripts, HTML/CSS files and images, living under themes folder at root with folder name same as theme name. For Example: Theme Demo will be at ROOT/themes/demo. Theme files are interlinked and hooked together to form the actual website.
These are the reasons why should you learn theme development of Social Network Software.
For a minimal theme you will require two files:
So the homepage is rendered at two levels.
Which is controlled by text.htm which looks like an HTML file with placeholders enclosed in curly braces.
Our basic website structure is clear here.
File:First Level Structure.gif
Which is controlled by main_home.php. It substitutes whatever HTML code needs to be substituted for placeholders inside index.htm.
It is actually done with the help of assign_vars method of $template object of Template class. For example to assign some HTML code to {PLACEHOLDER}, first generate HTML and store it in some variable or as a constant (say $placeholder_data) and then assign that value to {PLACEHOLDER} by
$template->assign_vars(array(
'PLACEHOLDER'=> $placeholder_data
));