1
dargosch
Hacking Mainmenu?
  • 2006/5/2 18:53

  • dargosch

  • Friend of XOOPS

  • Posts: 118

  • Since: 2004/12/21


Hi,

I am trying to hack the main menu so that it will not display itself when coming from a specific module (i.e. HTTP_REFERER contains a specific module name). Instead, I want it to refer back to the refering page.

This is the template i use:

<table cellspacing="0">
  <
tr>
    <
td id="mainmenu">
    <{if 
$block.LinkBack != 1}>
      <
class="menuTop" href="<{$xoops_url}>/"><{$block.lang_home}>a>
      
      <{foreach 
item=module from=$block.modules}>
      <{if 
$module.directory == "piCal"}>
<
class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/?cid=1&smode=Monthly"><{$module.name}>a>      
      <{else}>
<
class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/"><{$module.name}>a>
     <{/if}>
        <{foreach 
item=sublink from=$module.sublinks}>
          <
class="menuSub" href="<{$sublink.url}>"><{$sublink.name}>a>
        <{/foreach}>
      <{/foreach}>
      
   <{else}>
     <
a href="<{$block.BackLink}>">[en]Back to club page[/en][sv]Tillbaka till klubbsidan[/sv]a>
    <{/if}>
   td>
  tr>
table>


So, the menu does not show when LinkBack is set. Now, I have modified the system_blocks.php like this:

#Link back
    
if( isset($_SESSION['klubbsida']) ){
        
$ref parse_url($_SERVER['HTTP_REFERER']);
    
$refpath pathinfo($ref['path']);
    
$refdir $refpath['dirname'];

        
$curr parse_url($_SERVER['QUERY_STRING']);
    
$currpath pathinfo($curr['path']);
    
$currdir $currpath['dirname'];

    if(
strcmp($currdir,$refdir) == 0){
        
#Same module
       
$block['LinkBack'] = 1;
       
$block['BackLink'] = $_SESSION['klubbsida'];
    }


    }
    else{
# ------- This works ------------
        
if( substr_count($_SERVER['HTTP_REFERER'],"content") > && strcmp($XOOPS_URL,$_SERVER['QUERY_STRING']) != ){
            
$block['LinkBack'] = 1;
        
        
$_SESSION['klubbsida'] = $_SERVER['HTTP_REFERER'];
        
$block['BackLink'] = $_SESSION['klubbsida'];
        }
# ------- End This works ------------
  # }
    
return $block;
}


With this code, I get a link back, but when I click on a link internal to the module, I would like the link back to remain what it was when I entered the module. This does not work.

As you can see, I am trying to get this behaviour to work when entering a module from the 'content' module.

Any ideas?

/Fredrik
My Gentoo + PVR-350 + IVTV + MythTV blog is on
http://gentoomythtv.blogspot.com/

Login

Who's Online

319 user(s) are online (247 user(s) are browsing Support Forums)


Members: 0


Guests: 319


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