[ 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.anchor.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_anchor($params, &$smarty)
  20  {
  21      global $gCms;
  22      #Added by Russ for class, tabindex and title for anchor 2006/07/19
  23      $class="";
  24      $title="";
  25      $tabindex="";
  26      $accesskey="";
  27      if (isset($params['class'])) $class = ' class="'.$params['class'].'"';
  28      if (isset($params['title'])) $title = ' title="'.$params['title'].'"';
  29      if (isset($params['tabindex'])) $tabindex = ' tabindex="'.$params['tabindex'].'"';
  30      if (isset($params['accesskey'])) $accesskey = ' accesskey="'.$params['accesskey'].'"';
  31      #End of first part added by Russ 2006/07/19
  32      
  33      if (isset($_SERVER['REQUEST_URI']))
  34      {
  35          $url = $_SERVER['REQUEST_URI'].'#'.$params['anchor'];
  36          $url = str_replace('&', '&amp;', $url);
  37          if (isset($params['onlyhref']) && ($params['onlyhref'] == '1' || $params['onlyhref'] == 'true'))
  38              #Note if you set 'onlyheref' that is what you get - no class or title or tabindex or text
  39              echo $url;
  40          else
  41              #Line replaced by Russ
  42              #    echo '<a href="'.$url.'">'.$params['text'].'</a>';
  43              #Line replaced with -  by Russ to reflect class and title for anchor 2006/07/19
  44              echo '<a href="'.$url.'"'.$class.$title.$tabindex.$accesskey.'>'.$params['text'].'</a>';
  45              #End of second part added by Russ 2006/07/19
  46      }
  47  }
  48      #Ammended by Russ for class, tabindex and title for anchor 2006/07/19
  49  function smarty_cms_help_function_anchor() {
  50      ?>
  51      <h3>What does this do?</h3>
  52      <p>Makes a proper anchor link.</p>
  53      <h3>How do I use it?</h3>
  54      <p>Just insert the tag into your template/page like: <code>{anchor anchor='here' text='Scroll Down'}</code></p>
  55      <h3>What parameters does it take?</h3>
  56      <p>
  57      <ul>
  58      <li><tt>anchor</tt> - Where we are linking to.  The part after the #.</li>
  59      <li><tt>text</tt> - The text to display in the link.</li>
  60      <li><tt>class</tt> - The class for the link, if any</li>
  61      <li><tt>title</tt> - The title to display for the link, if any.</li>
  62      <li><tt>tabindex</tt> - The numeric tabindex for the link, if any.</li>
  63      <li><tt>accesskey</tt> - The accesskey for the link, if any.</li>
  64      <li><em>(optional)</em> <tt>onlyhref</tt> - Only display the href and not the entire link. No other options will work</li>
  65      </ul>
  66      </p>
  67      <?php
  68  }
  69      #Amended by Russ for class, tabindex and title for anchor 2006/07/19
  70  function smarty_cms_about_function_anchor() {
  71      ?>
  72      <p>Author: Ted Kulp&lt;tedkulp@users.sf.net&gt;</p>
  73      <p>Version: 1.1</p>
  74      <p>
  75      Change History:<br/>
  76      <strong>Update to version 1.1 from 1.0</strong> <em>2006/07/19</em><br/>
  77      Russ added the means to insert a title, a tabindex and a class for the anchor link. Westis added accesskey and changed parameter names to not include 'anchorlink'.<br/>
  78      </hr>
  79      </p>
  80      <?php
  81  }
  82  ?>


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