page.tpl.php

Re:

  1. freelance writer

Fix for trying to add a new variable to my page.tpl.php

  1. //this is inside my template.php file
  2. // removing a superfluous [] fixed it.
  3. function mytheme_preprocess_page(&$variables) {
  4.         $variables['bg_img']= 'http://gocompost.localhost/sites/all/themes/jonn

trying to add a new variable to my page.tpl.php

  1. //this is inside my template.php file
  2.  
  3. function mytheme_preprocess_page(&$variables) {
  4.         $variables['bg_img'][]= 'http://gocompost.localhost/sites/all/themes/jonny/css/cath.jpg';      
  5.        
  6.         }

Fix for Add Preious/Next Link

  1. <h3>mytheme_preprocess_node(){}</h3>
  2. <?php
  3. function myTheme_preprocess_node(&$vars, $hook) {
  4.   switch($vars['node']->type){
  5.     case 'nodeType':
  6.       if($vars['node']->body) {
  7.       $resultn =

Add Preious/Next Link

  1. <h3>mytheme_preprocess_node(){}</h3>
  2. <?php
  3. function myTheme_preprocess_node(&$vars, $hook) {
  4.   switch($vars['node']->type){
  5.     case 'nodeType':
  6.       if($vars['node']->body) {
  7.       $resultn =

Sample page.tpl.php

  1. <?php
  2. // $Id: page.tpl.php,v 1.28 2008/01/24 09:42:52 goba Exp $
  3. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Amorfati's page.tpl.php

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

add node type as body class

  1. page.tpl.php
  2.  
  3. <html>
  4.     <body class="<?php print($node->type) ? $node->type : 'notype';?>"</body>
  5. </html>

Fix for adding a view name class to page.tpl.php

  1. // in template.php
  2. function _phptemplate_variables($hook, $vars) {
  3.         switch ($hook) {
  4.        
  5.         case 'page':
  6.                 foreach (views_get_all_urls() as $key => $value) {
  7.                         if($_GET['q'] == $value) {
Syndicate content