User Tools

Site Tools


dr:themesettings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dr:themesettings [2012/01/13 15:33] fgmdr:themesettings [2020/11/23 17:23] (current) – external edit 127.0.0.1
Line 16: Line 16:
  
 In the admin.theme file, we'll add the admin_settings function. If the theme is a plain PHP theme, it will already exist. If it is a PHPtemplate theme, as in the case of our "admin" theme, the file will have to be created. In the admin.theme file, we'll add the admin_settings function. If the theme is a plain PHP theme, it will already exist. If it is a PHPtemplate theme, as in the case of our "admin" theme, the file will have to be created.
- +<code php>
-<php>+
 function admin_settings() function admin_settings()
   {   {
Line 33: Line 32:
   return system_settings_form('admin_admin_settings', $form);   return system_settings_form('admin_admin_settings', $form);
   }   }
-</php>+</code>
  
 Proof of concept example, no more: we just define a setting for the theme to use later on. In this case, it will be a CSS background color. NOTICE: a true world example should not take input and store it without some sanity checks. Proof of concept example, no more: we just define a setting for the theme to use later on. In this case, it will be a CSS background color. NOTICE: a true world example should not take input and store it without some sanity checks.
Line 40: Line 39:
  
 With the "admin" theme being based on PHPtemplate, we'll modify node.tpl.php to apply our parameterized color to all nodes. This example just changes the first line with an inline style: With the "admin" theme being based on PHPtemplate, we'll modify node.tpl.php to apply our parameterized color to all nodes. This example just changes the first line with an inline style:
-<php>+<code php>
 <?php <?php
 echo '<div style="background-color: echo '<div style="background-color:
Line 49: Line 48:
 if ($page == 0) ... if ($page == 0) ...
 [...the rest of the file is unchanged...] [...the rest of the file is unchanged...]
-</php>+</code>
  
 Ugly inline styling, but this is just a demo, so we don't care. I add the "! important" clause to make sure it is being forced even if rules cascade from elsewhere in the CSS files to change that background. Ugly inline styling, but this is just a demo, so we don't care. I add the "! important" clause to make sure it is being forced even if rules cascade from elsewhere in the CSS files to change that background.
Line 61: Line 60:
 ==== The themesettings module ==== ==== The themesettings module ====
  
-<php>+<code php>
 // themesettings.module for Drupal 4.7 // themesettings.module for Drupal 4.7
 // (C) 2006 FG Marand  // (C) 2006 FG Marand 
Line 150: Line 149:
   return $ret;   return $ret;
   }   }
-</php>+</code>
  
 ===== How does it work ? ===== ===== How does it work ? =====
dr/themesettings.1326468833.txt.gz · Last modified: 2020/11/23 17:23 (external edit)