JHTML/tooltip: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Creates a tooltip with an image as button
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]<... |
m →Syntax: Minor misspelling - depreciated != deprecated |
||
| Line 39: | Line 39: | ||
| $link | | $link | ||
| 1 | | 1 | ||
| | | deprecated | ||
|} | |} | ||
Revision as of 21:45, 26 June 2011
Description
Creates a tooltip with an image as button
Template:Description:JHTML/tooltip
Syntax
tooltip($tooltip, $title='', $image='tooltip.png', $text='', $href='', $link=1)
| Parameter Name | Default Value | Description |
|---|---|---|
| $tooltip | $tooltip The tip string | |
| $title | $title The title of the tooltip | |
| $image | 'tooltip.png' | $image The image for the tip, if no text is provided |
| $text | $text The text for the tip | |
| $href | $href An URL that will be used to create the link | |
| $link | 1 | deprecated |
Returns
string
Defined in
libraries/joomla/html/html.php
Importing
jimport( 'joomla.html.html' );
Source Body
function tooltip($tooltip, $title='', $image='tooltip.png', $text='', $href='', $link=1)
{
$tooltip = addslashes(htmlspecialchars($tooltip, ENT_QUOTES, 'UTF-8'));
$title = addslashes(htmlspecialchars($title, ENT_QUOTES, 'UTF-8'));
if ( !$text ) {
$image = JURI::root(true).'/includes/js/ThemeOffice/'. $image;
$text = '<img src="'. $image .'" border="0" alt="'. JText::_( 'Tooltip' ) .'"/>';
} else {
$text = JText::_( $text, true );
}
if($title) {
$title = $title.'::';
}
$style = 'style="text-decoration: none; color: #333;"';
if ( $href ) {
$href = JRoute::_( $href );
$style = '';
$tip = '<span class="editlinktip hasTip" title="'.$title.$tooltip.'" '. $style .'><a href="'. $href .'">'. $text .'</a></span>';
} else {
$tip = '<span class="editlinktip hasTip" title="'.$title.$tooltip.'" '. $style .'>'. $text .'</span>';
}
return $tip;
}
[Edit See Also] Template:SeeAlso:JHTML/tooltip
Examples
<CodeExamplesForm />