[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/plugins/ -> function.stylesheet.php (source)

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004 by Ted Kulp (wishy@users.sf.net)
   4  #This project's homepage is: http://cmsmadesimple.sf.net
   5  #
   6  #This program is free software; you can redistribute it and/or modify
   7  #it under the terms of the GNU General Public License as published by
   8  #the Free Software Foundation; either version 2 of the License, or
   9  #(at your option) any later version.
  10  #
  11  #This program is distributed in the hope that it will be useful,
  12  #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  #GNU General Public License for more details.
  15  #You should have received a copy of the GNU General Public License
  16  #along with this program; if not, write to the Free Software
  17  #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  
  19  function smarty_cms_function_stylesheet($params, &$smarty)
  20  {
  21      global $gCms;
  22      $config = &$gCms->config;
  23      $pageinfo = &$gCms->variables['pageinfo'];
  24  
  25      $stylesheet = '';
  26      
  27      if (isset($params['name']) && $params['name'] != '')
  28      {
  29          $stylesheet .= '<link rel="stylesheet" type="text/css" ';
  30          if (isset($params['media']) && $params['media'] != '')
  31          {
  32              $stylesheet .= 'media="' . $params['media'] . '" ';
  33          }
  34          $stylesheet .= 'href="'.$config['root_url'].'/stylesheet.php?name='.$params['name'];
  35          $stylesheet .= "\" />\n"; 
  36      }
  37      else
  38      {
  39          foreach (get_stylesheet_media_types($pageinfo->template_id) as $media)
  40          {
  41              $stylesheet .= '<link rel="stylesheet" type="text/css" ';
  42              if ($media != '')
  43              {
  44                  $stylesheet .= 'media="'.$media.'" ';
  45              }
  46              $stylesheet .= 'href="'.$config['root_url'].'/stylesheet.php?templateid='.$pageinfo->template_id;
  47              if ($media != '')
  48              {
  49                  $stylesheet .= '&amp;mediatype='.urlencode($media);
  50              }
  51              $stylesheet .= "\" />\n"; 
  52          }
  53      }
  54  
  55      if (!(isset($config["use_smarty_php_tags"]) && $config["use_smarty_php_tags"] == true))
  56      {
  57          $stylesheet = ereg_replace("\{\/?php\}", "", $stylesheet);
  58      }
  59  
  60      return $stylesheet;
  61  }
  62  
  63  function smarty_cms_help_function_stylesheet() {
  64      ?>
  65      <h3>What does this do?</h3>
  66      <p>Gets stylesheet information from the system.  By default, it grabs all of the stylesheets attached to the current template.</p>
  67      <h3>How do I use it?</h3>
  68      <p>Just insert the tag into your template/page's head section like: <code>{stylesheet}</code></p>
  69      <h3>What parameters does it take?</h3>
  70      <ul>
  71          <li><em>(optional)</em>name - Instead of getting all stylesheets for the given page, it will only get one spefically named one, whether it's attached to the current template or not.</li>
  72          <li><em>(optional)</em>media - If name is defined, this allows you set a different media type for that stylesheet.</li>
  73      </ul>
  74      </p>
  75      <?php
  76  }
  77  
  78  function smarty_cms_about_function_stylesheet() {
  79      ?>
  80      <p>Author: Ted Kulp&lt;tedkulp@users.sf.net&gt;</p>
  81      <p>Version: 1.0</p>
  82      <p>
  83      Change History:<br/>
  84      None
  85      </p>
  86      <?php
  87  }
  88  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7