Selaa lähdekoodia

Add name attribute to hyperlink template

pdontthink 18 vuotta sitten
vanhempi
commit
e2674fade2
2 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. 4 1
      functions/html.php
  2. 2 1
      templates/default/hyperlink.tpl

+ 4 - 1
functions/html.php

@@ -27,13 +27,15 @@
  * @param string $class   The CSS class name (OPTIONAL; default
  *                        not used)
  * @param string $id      The ID name (OPTIONAL; default not used)
+ * @param string $name    The anchor name (OPTIONAL; default not used)
  *
  * @return string The desired hyperlink tag.
  *
  * @since 1.5.2
  *
  */
-function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='') {
+function create_hyperlink($uri, $text, $target='', $onclick='', 
+                          $class='', $id='', $name='') {
 
     global $oTemplate;
 
@@ -43,6 +45,7 @@ function create_hyperlink($uri, $text, $target='', $onclick='', $class='', $id='
     $oTemplate->assign('onclick', $onclick);
     $oTemplate->assign('class', $class);
     $oTemplate->assign('id', $id);
+    $oTemplate->assign('name', $name);
 
     return $oTemplate->fetch('hyperlink.tpl');
 

+ 2 - 1
templates/default/hyperlink.tpl

@@ -13,6 +13,7 @@
   *      + $onclick - onClick JavaScript handler (optional; may not be present)
   *      + $class   - CSS class name (optional; may not be present)
   *      + $id      - ID name (optional; may not be present)
+  *      + $name    - Anchor name (optional; may not be present)
   *
   * @copyright © 1999-2006 The SquirrelMail Project Team
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
@@ -27,4 +28,4 @@
 extract($t);
 
 
-?><a href="<?php echo $uri ?>"<?php if (!empty($target)) echo ' target="' . $target . '"'; ?><?php if (!empty($onclick)) echo ' onclick="' . $onclick . '"'; ?><?php if (!empty($class)) echo ' class="' . $class . '"'; ?><?php if (!empty($id)) echo ' id="' . $id . '"'; ?>><?php echo $text; ?></a>
+?><a href="<?php echo $uri ?>"<?php if (!empty($target)) echo ' target="' . $target . '"'; ?><?php if (!empty($onclick)) echo ' onclick="' . $onclick . '"'; ?><?php if (!empty($name)) echo ' name="' . $name . '"'; ?><?php if (!empty($class)) echo ' class="' . $class . '"'; ?><?php if (!empty($id)) echo ' id="' . $id . '"'; ?>><?php echo $text; ?></a>