1
xoopdio
code interception
  • 2011/11/24 9:56

  • xoopdio

  • Just popping in

  • Posts: 29

  • Since: 2011/9/27


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

2
wishcraft
Re: code interception

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}>

Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

3
trabis
Re: code interception
  • 2011/11/27 16:40

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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()

4
xoopdio
Re: code interception
  • 2011/11/28 5:36

  • xoopdio

  • Just popping in

  • Posts: 29

  • Since: 2011/9/27


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

Login

Who's Online

152 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 152


more...

Donat-O-Meter

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

Latest GitHub Commits