1
rewwer
URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/14 21:07

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


Good day comrades xoopers!
Iv got some problems with "how to mark current link on web site". For example, here is a situation: -

We`v got a "main menu" (/Home/News/Info/Partners/e.t.c./), "User menu"(/profile links/), "smartsection menu (/Categories/1,2,3, e.t.c.)" at the left column,... and at the top of page we`v got "hot link menu"(/Home/News/Info/Contacts/Partners/E.T.C/) some of them point to modules and some of them points to some documents in modules such as "SmartSection module" cous logical placing positon of that doc about 2-4 levels deep, but it should be easy accesible from "home" page...

Question - How to mark-highlight current links on a page when user clicks on it and go to "news" for example or "partners" e.t.c.? So what we need to get if user clicks on a "news" - the "news links" are highlighted, or user click on "partners" -result now "partners" link highlighted...


I`v tried to play with CSS pseudo class - a:active, a:hover, a.current ... and few more things...
/acceptable thing was a JavaScript - SlideBall how it works You can see here / but I could not get it work on a XOOPS theme.

part of my CSS may be help you to point right way

Quote:

/* block main menu */
#mainmenu { font-size: 13px;}
#mainmenu a {display: block; margin: 0; padding: 4px;border-bottom: 1px solid #e9e9e9;}
#mainmenu a:hover, a:focus, a:active { color:#FF0000;}
#mainmenu a.menuTop {}
#mainmenu a.menuMain {}
#mainmenu a.menuSub {padding-left: 12px; background-color: #FFFFFF; font-size:.9em; font-style:italic; border-right: 1px solid #666; border-bottom: 1px solid #666; border-left: 1px solid #ccc;}
#mainmenu a.menuSub:hover {background-color: #e6e6e6;}

/* block user menu */
#usermenu { font-size: 13px;}
#usermenu a {display: block; margin: 0; padding: 4px;border-bottom: 1px solid #e9e9e9;}
#usermenu a:hover, a:focus, a:active { color:#FF0000;}
#usermenu a.menuTop {}
#usermenu a.highlight {background-color: #66CC00;}


few more info

XOOPS Version: 2.3.1
Module Name/Version: any
PHP Version: 5.xx
MySQL Version: 5.xx
Web Server Software (Apache/IIS/Other): apache
Operating System: RedHat
Theme you are using: Buisnex
Custom template: (Yes/No) not sure
PHP Debug Messages: none
MySQL Debug Messages: none
Smarty Debug Messages: none
_____________________
With best regards to xoopers

2
ghia
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 1:45

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


I think the effect you're looking for is in this users website.

3
rewwer
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 8:41

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


Quote:

by ghia on 2008/12/15 1:45:15

I think the effect you're looking for is in this users website.


YES MOSTLY CORRECT, but how to do that at XOOPS theme?

4
ghia
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 9:38

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


It is a XOOPS theme: xpro_066_sparkles_v1.

5
rewwer
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 12:02

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


eny more ideas? xpro_066_sparkles_v1 - its pay theme..., there is should be a simple solution with small JS and CSS...

6
Burning
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 12:34

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi,

Take a look to XL-One theme. If I'm not wrong, there is some innovative menus inside : https://xoops.org/modules/extgallery/public-album.php?id=6

Or you could adapt your theme like this :

1. How to identify active module ?

Edit theme.html and just after tag add
(do not forget to close
just before )

2. Now your theme knows wich module is active.

Edit your style.css like this :
Quote:

#system #mainmenu a {color: red;}
#news #mainmenu a {color: red;}
#mylinks #mainmenu a {color: red;}
#oledrion #mainmenu a {color: red;}
#... #mainmenu a {color: red;}


... I think it should work
Still learning CSS and... english

7
trabis
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 13:54

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Another way is:
Edit system/blocks/system_blocks and use this:
function b_system_main_show()
{
    global 
$xoopsUser,$xoopsModule;
    
$block = array();
    
$block['lang_home'] = _MB_SYSTEM_HOME;
    
$block['lang_close'] = _CLOSE;
    
$module_handler =& xoops_gethandler('module');
    
$criteria = new CriteriaCompo(new Criteria('hasmain'1));
    
$criteria->add(new Criteria('isactive'1));
    
$criteria->add(new Criteria('weight'0'>'));
    
$modules $module_handler->getObjects($criteriatrue);
    
$moduleperm_handler =& xoops_gethandler('groupperm');
    
$groups is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
    
$read_allowed $moduleperm_handler->getItemIds('module_read'$groups);
    foreach (
array_keys($modules) as $i) {
        if (
in_array($i$read_allowed)) {
            
$block['modules'][$i]['name'] = $modules[$i]->getVar('name');
            
$block['modules'][$i]['directory'] = $modules[$i]->getVar('dirname');
            
$sublinks $modules[$i]->subLink();
            
// trabis hack
            
if ((!empty($xoopsModule)) && ($i == $xoopsModule->getVar('mid'))) {
                
$block['modules'][$i]['highlight'] = true;
                
$block['nothome'] = true;
            }
            
//end of trabis hack
            
if ((count($sublinks) > 0) && (!empty($xoopsModule)) && ($i == $xoopsModule->getVar('mid'))) {
                foreach(
$sublinks as $sublink){
                    
$block['modules'][$i]['sublinks'][] = array('name' => $sublink['name'], 'url' => XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url']);
                }
            } else {
                
$block['modules'][$i]['sublinks'] = array();
            }
        }
    }
    return 
$block;
}


Then edit system/templates/blocks/system_block_mainmenu.html and use this:
<table cellspacing="0">
  <
tr>
    <
td id="mainmenu">
      <
class="menuTop" href="<{$xoops_url}>/" <{if !$block.nothome}>style="color:red;"<{/if}>><{$block.lang_home}>a>
      
      <{foreach 
item=module from=$block.modules}>
      <
class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/" <{if $module.highlight}>style="color:red;"<{/if}>><{$module.name}>a>
        <{foreach 
item=sublink from=$module.sublinks}>
          <
class="menuSub" href="<{$sublink.url}>"><{$sublink.name}>a>
        <{/foreach}>
      <{/foreach}>
      
    td>
  tr>
table>


You can style it the way you want.


8
Burning
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 15:49

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi,

Bookmarked !!

Thanks
Still learning CSS and... english

9
trabis
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 19:33

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Quote:

Burning wrote:
hi,

Bookmarked !!

Thanks


Cool! I posted here for better tracking!

10
rewwer
Re: URGENT - Problem with marking(highlighting) "current link" - How to mark it correctly?
  • 2008/12/15 23:18

  • rewwer

  • Just popping in

  • Posts: 24

  • Since: 2007/10/2


2Burning, iv tried that variant, looks simply nice and right at examole, but, damn(sorry), not working on actual theme... arghhh...
2trabis, is there any other way to do that without touching any system files? i sow somewhere the module which allows you to upload hacks and use them without touching any system files... or is it possible to make a small hacks module?

Login

Who's Online

205 user(s) are online (114 user(s) are browsing Support Forums)


Members: 0


Guests: 205


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits