Hi Viet477,
I am interested with this plugin. i can apply it successfully for articles pages (view = article) but i cannot apply it for category pages (view = category) especially for the 'more article...' links. i would like the tooltips show up if someone hover the mouse on the links. so i modified some pages.
1. modified page blog_links.php in components\com_content\views\category\tmpl
Code: Select all
<?php // no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<div>
<strong><?php echo JText::_( 'More Articles ...' ); ?></strong>
</div>
<ul>
<?php $session =& JFactory::getSession();
$session->set('moreart',$this->links);//make the links properties globally
foreach ($this->links as $link) : ?>
<li><span class="tooltip_extranews">
<a class="blogsection" href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($link->slug, $link->catslug, $link->sectionid)); ?>">
<?php echo $link->title; ?></a></span>
</li>
<?php endforeach; ?>
</ul>
2. modified extranews.php in plugin\content
here it is :
Code: Select all
if($plugin_enabled=="1" && $option=="com_content" && $view=="article"){
//not modified
}
else
if($plugin_enabled=="1" && $option=="com_content" && $view=="category")
{ //***************************************************for category
$session =& JFactory::getSession();
$moreart = $session->get('moreart');
$title_chars= $this->params->get( 'char_count_title', 50);
$blockalign = $this->params->get( 'blockalign', 'left');
$blockwidth = $this->params->get( 'blockwidth', '80%');
$marginleft = $this->params->get( 'marginleft', '5%');
$marginright = $this->params->get( 'marginright', '5%');
//Tooltip
$enable_tooltip = $this->params->get( 'enable_tooltip','yes' );
$script_tooltip = $this->params->get( 'script_tooltip', 0 ); // 0:Joomla mootool 1:Overlib
$scriptIE6_tooltip = $this->params->get( 'scriptIE6_tooltip', 0 ); // 0:Dhtml tooltip 1:Overlib
$load_mootools = $this->params->get( 'load_mootools','no' );
$tooltip_desc_chars = $this->params->get( 't_char_count_desc', 150 );
$tooltip_desc_images= $this->params->get( 'tooltip_desc_images', 'yes' );
$img_width = $this->params->get( 'img_width', 80 );
$img_height = $this->params->get( 'img_height', 80 );
$tooltip_title_chars= $this->params->get( 't_char_count_title', 50 );
$tooltip_width = $this->params->get( 'tooltip_width','250' );
$tooltip_height = $this->params->get( 'tooltip_height','100' );
$tooltip_bgcolor = $this->params->get( 'tooltip_bgcolor','#24537d' );
$tooltip_capcolor = $this->params->get( 'tooltip_capcolor','#ffffff' );
$tooltip_fgcolor = $this->params->get( 'tooltip_fgcolor','#E1F0FF' );
$tooltip_textcolor = $this->params->get( 'tooltip_textcolor','#000000' );
$tooltip_border = $this->params->get( 'tooltip_border','1' );
$img_width = $this->params->get( 'img_width', 120 );
$showtext_before_n_after = 0;
//JPATH_SITE, JPATH_ROOT, and JPATH_BASE Đường dẫn của host khong phia la www.xahoihoctap.net
$br = strtolower($_SERVER['HTTP_USER_AGENT']); // what browser they use.
if(ereg("msie", $br) && !ereg("msie 7.0", $br)){ //IE 6.x
$script_tooltip = $scriptIE6_tooltip;
}
/****************************************************************************/
$doc =& JFactory::getDocument();
global $mainframe;
$url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
$doc->addStyleSheet($url.'plugins/content/extranews/css/extranews.css');
if ($enable_tooltip == 'yes') {
if($script_tooltip==1) $overlib = 1; else $overlib = 0;
$tooltip_title_chars2 = ($tooltip_title_chars == 0)? 999 : $tooltip_title_chars;
switch ($script_tooltip) {
case 0: //Joomla mootool
$initial_tooltip = "
window.addEvent('load', function(){
var JTooltips = new Tips($$('.Tips2'), {
maxTitleChars: 100, fixed: false
});
var Tips2 = new Tips($$('.tooltip_extranews'), { maxTitleChars: " . $tooltip_title_chars2 . ", fixed: false}, {
initialize:function(){
this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
},
onShow: function(toolTip) {
this.fx.start(1);
},
onHide: function(toolTip) {
this.fx.start(0);
}
});
});";
$initial_tooltip_css ='div.tool-tip { max-width: '.$tooltip_width.'px;}';
if(($load_mootools = 'yes') && !$mainframe->get('loadMootoolslib')) {
$doc->addScript($url.'plugins/content/extranews/js/mootools.js');
$mainframe->set( 'loadMootoolslib', true );
}
$doc->addStyleDeclaration($initial_tooltip_css);
$doc->addScriptDeclaration($initial_tooltip);
break;
case 1: //Overlib
if ( !$mainframe->get( 'loadOverlib' ) ) {
$doc->addScript($url.'includes/js/overlib_mini.js');
$doc->addScript($url.'includes/js/overlib_hideform_mini.js');
$mainframe->set( 'loadOverlib', true );
}
break;
default:
if ( !$mainframe->get( 'loadDhtmllib' ) ) {
$doc->addScript($url.'plugins/content/extranews/js/dhtmltooltip.js');
$doc->addStyleSheet($url.'plugins/content/extranews/css/dhtmltooltip.css');
$mainframe->set( 'loadDhtmllib', true );
}
}
}
/**********************************************=================***/
$rows = $moreart;
if (count($rows)) {
$counter = 0;
$content = "";
foreach ( $rows as $row ){
$counter++;
$content .= "<li>";
$link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid.":testset"));
$image = $this->getImage($row, "left", 1, 1, $img_width , $img_height );
$title_tip_str = ($tooltip_title_chars == 0)? strip_tags($row->title) : $this->chars(strip_tags($row->title),$tooltip_title_chars);
$title_str = ($title_chars == 0)? strip_tags($row->title) : $this->chars(strip_tags($row->title),$title_chars);
$tip_desc_str = ($tooltip_desc_chars == 0)? strip_tags($row->introtext):$this->chars(strip_tags($row->introtext), $tooltip_desc_chars);
$tip_desc_str = $this->removetag($this->strip_newline($tip_desc_str));
}
}
}
else return;
}
the tooltips showed up but empty. can you help me how to fix this? (english is not my native language hope you understand my question). thx