Warning: preg_match_all() [function.preg-match-all]: Compilation failed: group name must start with a non-digit at offset 4 in /home/socialne/public_html/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/socialne/public_html/wiki/includes/MagicWord.php on line 671

Warning: preg_replace() [function.preg-replace]: Compilation failed: group name must start with a non-digit at offset 4 in /home/socialne/public_html/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: group name must start with a non-digit at offset 4 in /home/socialne/public_html/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/socialne/public_html/wiki/includes/MagicWord.php on line 671

Warning: preg_replace() [function.preg-replace]: Compilation failed: group name must start with a non-digit at offset 4 in /home/socialne/public_html/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: group name must start with a non-digit at offset 4 in /home/socialne/public_html/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/socialne/public_html/wiki/includes/MagicWord.php on line 671

Warning: preg_replace() [function.preg-replace]: Compilation failed: group name must start with a non-digit at offset 4 in /home/socialne/public_html/wiki/includes/MagicWord.php on line 675

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: group name must start with a non-digit at offset 4 in /home/socialne/public_html/wiki/includes/MagicWord.php on line 670

Warning: Invalid argument supplied for foreach() in /home/socialne/public_html/wiki/includes/MagicWord.php on line 671

Warning: preg_replace() [function.preg-replace]: Compilation failed: group name must start with a non-digit at offset 4 in /home/socialne/public_html/wiki/includes/MagicWord.php on line 675
Devdoc:Theme Development - Social Networking Software - Online Social Network Software
From Social Networking Software - Online Social Network Software
Jump to: navigation, search
(Theme Development)
(Recommended theme files)
Line 52: Line 52:
The above files are bare bones of a theme but for a full featured theme which is not just a static homepage we have to go beyond and create some more files for a robust and extensible theme structure.
The above files are bare bones of a theme but for a full featured theme which is not just a static homepage we have to go beyond and create some more files for a robust and extensible theme structure.
-
Website has some elements which are global or are common to a large number of pages. eg. Banner is global and included in every webpage whereas user page navigation makes sense only when a user is logged in and not in home page of website.
+
Website has some elements which are global or are common to a large number of pages. eg. Banner is a global element as it is included in every webpage whereas user-page-navigation makes sense only when a user is logged in.
 +
 
 +
Such elements need to be included in every page. A file called '''body.php''' (which is not a part of theme files) is responsible for assigning values to these common template placeholders (just like main_home.php) and is included in every page automatically. A minimal code is shown below.
 +
 
 +
<?php
 +
$template->assign_vars(array(
 +
  'HEADER_HTML' => HEADER_HTML,                  // HEADER_HTML defined in header.php
 +
  'FOOTER_HTML' => FOOTER_HTML,                  // FOOTER_HTML defined in footer.php
 +
  'LEFT_HTML' => LEFT_HTML,                      // LEFT_HTML defined in left.php
 +
  'LEFT_COMMUNITY_HTML' => LEFT_COMMUNITY_HTML    // LEFT_COMMUNITY_HTML defined in left_community.php
 +
 
 +
  ));
 +
?>
 +
 
 +
Above code shows that the task of rendering the common elements is done automatically, provided that they are defined at their respective places. So everything is reduced to taking care of four additional theme files as following:
-
Such elements need to be included in every page.
 
===header.php===
===header.php===
-
Header covers banner and menu. Banner in turn includes site logo too. All pages of social network software website share same header and so while it can be populated inside main_home.php but it will be judicious to make it a separate file so that it can be shared among all pages.
+
Header is a global element. Header covers banner and menu. Banner in turn includes site logo too and so requisite HTML must be taken care of.
Minimal header.php has data for {HEADER_HTML} defined.
Minimal header.php has data for {HEADER_HTML} defined.
-
  define('HEADER_HTML',$header_html_data);
+
  <?php
 +
    define('HEADER_HTML',$header_html_data);
 +
?>
===footer.php===
===footer.php===

Revision as of 12:09, 19 July 2011

Main Page
About SNS
Developer Documentation
Personal tools