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:

le="color: #000000"><?php <table cellspacing="0"> <tr> <td id="mainmenu"> <{if $block.LinkBack != 1}> <a class="menuTop" href="<{$xoops_url}>/"><{$block.lang_home}></a> <!-- start module menu loop --> <{foreach item=module from=$block.modules}> <{if $module.directory == "piCal"}> <a class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/?cid=1&smode=Monthly"><{$module.name}></a> <{else}> <a class="menuMain" href="<{$xoops_url}>/modules/<{$module.directory}>/"><{$module.name}></a> <{/if}> <{foreach item=sublink from=$module.sublinks}> <a class="menuSub" href="<{$sublink.url}>"><{$sublink.name}></a> <{/foreach}> <{/foreach}> <!-- end module menu loop --> <{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:

le="color: #000000"><?php #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") > 0 && strcmp($XOOPS_URL,$_SERVER['QUERY_STRING']) != 0 ){ $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

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits