1
snakes
xoopsparnters hardlink support
  • 2005/10/14 14:00

  • snakes

  • Just popping in

  • Posts: 69

  • Since: 2004/8/8 0


Hi there.
Here is a hack that I use for Weblinks and ported to xoopspartners. The first part of this hack is to add a javascript into the theme.html files of your theme. This will allow using this script in any other modules than xoopspartner.

First edit your /themes/yourThemeDir/theme.html, find the line with "</head>" and add this code before that line:
<script language="javascript">
function 
snx_hardlink(linkredirect) {
    
link.href='<{$xoops_url}>' redirect;
    return 
true;
}
</
script>


go to the /modules/xoopspartners/ folder and edit index.php. At line 76, replace
$ImagePartner "<a href='vpartner.php?id=".$array_partners[$i]["id"]."' target='_blank'>";

with this code
$ImagePartner "<a href='{$array_partners[$i]['url']}' onMouseDown='snx_hardlink(this, "/modules/xoopspartners/vpartner.php?id=".$array_partners[$i]["id"]."")' target='_blank'>";


Now edit templates/blocks/xoopspartners_block_site.html.
At line 38, replace:
<a href="<{$xoops_url}>/modules/xoopspartners/vpartner.php?id=<{$partner.id}>" target="_blank">

with this code:
<a href="<{$partner.url}>" onMouseDown="snx_hardlink(this, '/modules/xoopspartners/vpartner.php?id=<{$partner.id}>')" target="_blank">


What's happened ?
We replace each redirection URL of Xoopspartners with the real hardlink of the partner and add a javascript call when a mouse button is pressed (even before it is released). In normal situation, the partner's URL is called when the left mouse button is pressed AND THEN released. Here the javascript is called just before it is released to change the hardlink URL into an redirection URL.

The javascript function should be called like this:
<a href="[A HARD LINK URL]" onMouseDown="snx_hardlink(this, '/path/to/redir_script.php?id=[partnerID]')">[TEXT]</a>

2
script_fu
Re: xoopsparnters hardlink support

Very nice indeed. Could you also post the web links code or is it the same? Thank you for a very much needed hack.

Login

Who's Online

274 user(s) are online (167 user(s) are browsing Support Forums)


Members: 0


Guests: 274


more...

Donat-O-Meter

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

Latest GitHub Commits