xoopdio xoopdio
  • Just popping in
  • Just popping in
  • Joined: 2011/9/26 22:53
  • From thailand
  • Group: Registered Users
  • Posts: 29
  • Posted on: 2011/11/24 4:56
code interception #1
Hello

I'd like to intercept the code, to make a treatment on the user and main menu links after that the template has made its job (fill and render the block content) but before the sending to the user.

Or in other words : I'd like to transform a link from the user menu for example from that :

<a class="menuMain " title="Private Messaging" href="http://www.xoops.try/modules/pm/">Private Messaging</a>

to this :

<a class="menuMain href="http://www.xoops.try/modules/pm/" title="Private Messaging" onmouseover="showmenu('menu_1');" onfocus="showmenu('menu_1');">Private Messaging<span> :</span></a>

All while staying in the theme modifications capabilities (without modifying code elsewhere), I thought about php dom modifications but I don't see where to place the interception.

Does anyone knows if it is possible and if yes, where can I do that ?

Thank you
"A tree is made of non-tree elements" Thich Nhat Hanh
wishcraft wishcraft
  • Module Developer
  • Module Developer
  • Joined: 2007/5/18 16:56
  • From Marrickville South, NSW, Australia
  • Group: Registered Users
  • Posts: 3652
  • Posted on: 2011/11/26 12:57
Re: code interception #2
Yeah annuaki, all you have to do is edit the mainmen and usermenu block template in system. You can for example if you want it for just a user have an if clause seperating one menu for anonomous, one for users and one for admin like so


<{if $xoops_isuser}>

   <{if 
$xoops_isadmin}>

<!-- 
admin smarty template here -->


   <{else}>


<!-- 
standard user template here -->

   <{/if}>

<{else}>

<!-- 
anonymous template here -->


<{/if}>

trabis trabis
  • Core Developer
  • Core Developer
  • Joined: 2006/9/1 14:10
  • From Portugal
  • Group: Webmaster Registered Users
  • Posts: 2253
  • Posted on: 2011/11/27 11:40
Re: code interception #3
It is possible to hook just after the blocks generation and manipulate the objects(blocks), all you need is a preload.

'Defacer' module has a preload that is able to assign blocks to a smarty var and unset those blocks from the blocks array(so they do not show in on the blocks layout). You can look into it for ideas.

The defacer method is:
function eventCoreClassTheme_blocksRetrieveBlocks($args)

The preload is being triggered in class/theme_blocks.php method retriveBlocks()
xoopdio xoopdio
  • Just popping in
  • Just popping in
  • Joined: 2011/9/26 22:53
  • From thailand
  • Group: Registered Users
  • Posts: 29
  • Posted on: 2011/11/28 0:36
Re: code interception #4
Quote:
Yeah annuaki




Quote:
all you have to do is edit the mainmen and usermenu block template in system.


Thanks but it's actually what I didn't want to do : I'd like to keep it simple, like in a theme installation, for the user convenience.

Quote:
'Defacer' module has a preload that is able to assign blocks to a smarty var and unset those blocks from the blocks array(so they do not show in on the blocks layout). You can look into it for ideas.


Thanks for the tip, I'll need to have a look but it seems to look more to what I need.

I actually find on the smarty forum another one which would involved a outputfilter plugin but I still need, too, to figure out how to insert it in the application.

With all that, I should work out something. Thanks again.
"A tree is made of non-tree elements" Thich Nhat Hanh
How to effectively post a question in the Xoops forums? - Read here...
Design by: XOOPS UI/UX Team