[ 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.startExpandCollapse.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_startExpandCollapse($params, &$smarty)
  20  {
  21      static $firstExpandCollapse = true;//only gets set one time per page
  22      
  23      global $gCms;
  24      $config =& $gCms->GetConfig();
  25  
  26      if (!empty($params['id']) && !empty($params['title'])) {
  27          $id = $params['id'];
  28          $title = $params['title'];
  29      }
  30      else {
  31          echo 'Error: The expand/collapse plugin requires that both parameters (id,title) are used.';
  32          return;
  33      }
  34  
  35      if ($firstExpandCollapse) {
  36          echo '<script type="text/javascript" language="javascript" src="'.$config['root_url'].'/lib/helparea.js"></script>';
  37          $firstExpandCollapse = false;
  38      }
  39      $url = str_replace('&', '&amp;',  $_SERVER['REQUEST_URI']);
  40      echo '<a href="'. $url .'#'. $id .'" onclick="expandcontent(\''.$id.'\')" style="cursor:hand; cursor:pointer">'.$title.'</a><br />
  41      <div id="'.$id.'" class="expand">';
  42  }
  43  
  44  function smarty_cms_help_function_startExpandCollapse() {
  45      ?>
  46      <h3>What does this do?</h3>
  47      <p>Enables content to be expandable and collapsable. Like the following:<br />
  48      <a href="#expand1" onClick="expandcontent('expand1')" style="cursor:hand; cursor:pointer">Click here for more info</a><span id="expand1" class="expand"><a name="help"></a> - Here is all the info you will ever need...</a></span></p>
  49  
  50      <h3>How do I use it?</h3>
  51      <p>Just insert the tag into your template/page like: <code>{startExpandCollapse id="name" title="Click Here"}</code>. Also, you must use the {stopExpandCollapse} at the end of the collapseable content. Here is an example:<br />
  52      <br />
  53      <code>{startExpandCollapse id="name" title="Click Here"}<br />
  54      This is all the content the user will see when they click the title "Click Here" above. It will display all the content that is between the {startExpandCollapse} and {stopExpandCollapse} when clicked.<br />
  55      {stopExpandCollapse}
  56      </code>
  57      <br />
  58      <br />
  59      Note: If you intend to use this multiple times on a single page each startExpandCollapse tag must have a unique id.</p>
  60      <h3>What if I want to change the look of the title?</h3>
  61      <p>The look of the title can be changed via css. The title is wrapped in a div with the id you specify.</p>
  62  
  63      <h3>What parameters does it take?</h3>
  64      <p>
  65      <i>startExpandCollapse takes the following parameters</i><br />
  66      &nbsp; &nbsp;id - A unique id for the expand/collapse section.<br />
  67      &nbsp; &nbsp;title - The text that will be displayed to expand/collapse the content.<br />
  68      <i>stopExpandCollapse takes no parameters</i><br />
  69      </p>
  70      <?php
  71  }
  72  
  73  function smarty_cms_about_function_startExpandCollapse() {
  74      ?>
  75      <p>Author: Brett Batie&lt;brett-cms@classicwebdevelopment.com&gt;</p>
  76      <p>Version: 1.0</p>
  77      <p>
  78      Change History:<br/>
  79      None
  80      </p>
  81      <?php
  82  }
  83  
  84  ?>


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