Fork me on GitHub

Search

Donat-O-Meter

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

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

- 2 2.5 2.6 4 6 Abuse adslight Android AntiHarvesting AntiSpam API Apple Battlefield billige Blocks Bootstrap Captcha cell cent chronolabs CHUNG Clicks content CĂN demo docek download Dresses facebook Fat floor for free Gateway Google Guide herre Honeypot HP html5 Human HỘ IP iPhone jQuery Language List log Loss module modules Monster new newbb news NHÀ online PARK Payment phone PHP Prevention profile project Protector publisher RESIDENCE responsive review Rights rmcommon Room security Sentry site Smartphone Smarty Smoking Spam stem Studio support tag tags tdmcreate template The Theme themes User userlog web weight xoops Xortify XPayment ZendFramework

New Users

Registering user

# 137804

DigitalEdito

Welcome to XOOPS!




Bottom   Previous Topic   Next Topic  Register To Post



#1 Posted on: 2011/11/24 3:56 code interception
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

Top


"A tree is made of non-tree elements" Thich Nhat Hanh
xoopdio
Just popping in
Just popping in
Joined:
2011/9/26 21:53
From thailand
Group:
Registered Users
Posts: 29
(Show More) (Show Less)


#2 Posted on: 2011/11/26 11:57 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}>



Top


Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

* www.twitter.com/NegativityGear
* www.sourceforge.net/projects/chronolabs/
* www.facebook.com/epsacey
wishcraft
Module Developer
Module Developer
Joined:
2007/5/18 15:56
From Marrickville South, Sydney, Australia
Group:
Registered Users
Posts: 2121
(Show More) (Show Less)


#3 Posted on: 2011/11/27 10:40 Re: code interception
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()

Top


Xoops User Utilities | Xoops Search Engine | vil3/trabisdementia
trabis
Core Developer
Core Developer
Joined:
2006/9/1 13:10
From Portugal
Group:
Webmaster
Registered Users
Posts: 2198
(Show More) (Show Less)


#4 Posted on: 2011/11/27 23:36 Re: code interception
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.

Top


"A tree is made of non-tree elements" Thich Nhat Hanh
xoopdio
Just popping in
Just popping in
Joined:
2011/9/26 21:53
From thailand
Group:
Registered Users
Posts: 29
(Show More) (Show Less)







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.

[Advanced Search]