NOTE: This guide is for "legacy" versions of phpLD, prior to v4.0. For recent versions, please take a look at the newest phpLD integration guide here.
********************************************************************
*** INSTRUCTIONS FOR LEGACY VERSIONS OF PHPLD ***
********************************************************************
If you want to use STW's FREE service only, please continue on to the "STW FREE USERS - Preview Verification Page integration" at the bottom of this post. Either way, you will need to register an account to obtain your request credentials:
https://shrinktheweb.com
Once you have your credentials, you will replace [KEY] with your access key in the code below. Be sure to remove the brackets [ ] too!
STW SPECIFIC-PAGE PRO USERS
If you have the PRO feature of "specific pages" ($9.95/mo), then you can use the following to support affiliate links AND "specific page captures" (i.e. www.domain.tld/specificpage.htm) without having to install a mod:
for links.tpl :
<img src="http://images.shrinktheweb.com/xino.php?stwembed=1&stwaccesskeyid=[KEY]&stwinside=1&stwsize=lg&stwurl={if $smarty.const.ENABLE_DISPLAYURL and $link.DISPLAYURL ne ''}{$link.DISPLAYURL|escape}{else}{$link.URL|escape}{/if}" alt="{$link.TITLE|escape}" border="1">
for detail.tpl :
<img src="http://images.shrinktheweb.com/xino.php?stwembed=1&stwaccesskeyid=[KEY]&stwinside=1&stwsize=lg&stwurl={if $smarty.const.ENABLE_DISPLAYURL and $DISPLAYURL ne ''}{$DISPLAYURL|escape}{else}{$URL|escape}{/if}" alt="{$TITLE|escape}" border="1">
BEGIN STW AFFILIATE LINK SUPPORT MOD (OPTIONAL)
Here's a quick update on an old mod released by Casey and Dawzz of phpLD that will allow you to get accurate thumbnails -even for affiliate program links that won't link properly.
##############################################################
## MOD Title: Display URL
## MOD Author: Casey Wilson
## Last Updated 2-29-2008 by Dawzz
## MOD Description: Gives the option to show a different URL than the one the link actually goes to.
## MOD Version: 1.0.3
##
## Installation Level: Intermediate
## Installation Time: 15 Minutes
## Files To Edit:
## /admin/dir_links_edit.php
## /admin/init.php
## /include/tables.php
## /detail.php
## /templates/Core/admintemplateinuse/dir_links_edit.tpl
## /templates/templateinuse/link.tpl
## /templates/templateinuse/detail.tpl
## /templates/Core/admintemplateinuse/link_details.tpl
## NOTE: when you see templateinuse or admintemplateinuse that means
## the name of the template you are using.
##############################################################
## Author Notes:
## This MOD was written using PHPLD v2 as it's backbone.
## Now updated for 3.3
## YMMV, if you have any issues feel free to email me.
## Paid services are also available.
##############################################################
## MOD History:
##
## 2005-11-19 - Version 1.0.0 - Initial release.
## 2008-02-29 - Version 1.0.3
##
##
##############################################################
## Before Adding This MOD To Your Directory, You Should Back Up All Files Related To This MOD
##############################################################
##
#
#-----[ SQL ]------------------------------------------
# Where 'PLD_' is your table prefix
ALTER TABLE `PLD_LINK` ADD `DISPLAYURL` VARCHAR( 255 ) NOT NULL ;
INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES ('ENABLE_DISPLAYURL', '1');
#
#-----[ OPEN ]------------------------------------------
#
/admin/dir_links_edit.php
#
#-----[ FIND ]------------------------------------------
#
$data['URL'] = "http://".$data['URL'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
if (strlen(trim($data['DISPLAYURL'])) > 0 && !preg_match("`^http(s?)://`", $data['DISPLAYURL']))
{
$data['DISPLAYURL'] = "http://".$data['DISPLAYURL'];
}
elseif ($data['DISPLAYURL'] == '' || $data['URL'] == $data['DISPLAYURL'])
{
$DU = parse_url($data['URL']);
$data['DISPLAYURL'] = $DU['scheme'] . "://" . $DU['host'];
}
#
#-----[ FIND ]------------------------------------------
#
$data['PAGERANK'] = get_page_rank($data['URL']);
#
#-----[ REPLACE WITH ]------------------------------------------
#
if (ENABLE_DISPLAYURL)
{
$data['PAGERANK'] = get_page_rank($data['DISPLAYURL']);
}
else
{
$data['PAGERANK'] = get_page_rank($data['URL']);
}
#
#-----[ OPEN ]------------------------------------------
#
/admin/conf_options.php
#
#-----[ FIND ]------------------------------------------
#
# Blank Window option
array('ID' => 'ENABLE_BLANK',
'NAME' => _L('New Windows'),
'DESCRIPTION' => _L('Enable links to open in a new window.'),
'CONFIG_GROUP' => '2',
'TYPE' => 'LOG',
'REQUIRED' => '1'),
#
#-----[ AFTER, ADD ]------------------------------------------
#
# Alt DISPLAY URL Mod
array('ID' => 'ENABLE_DISPLAYURL',
'NAME' => _L('Enable Alternate URL'),
'DESCRIPTION' => _L('Enable the display of an alternate URL.'),
'CONFIG_GROUP' => '2',
'TYPE' => 'LOG',
'REQUIRED' => '1'),
#
#-----[ OPEN ]------------------------------------------
#
/include/tables.php
#
#-----[ FIND ]------------------------------------------
#
'LINK_TYPE' => 'I NOTNULL DEFAULT 0',
#
#-----[ AFTER, ADD ]------------------------------------------
#
'DISPLAYURL' => 'C(255) NOTNULL',
#-----[ OPEN ]------------------------------------------
#
/detail.php
#
#-----[ FIND ]------------------------------------------
#
$data['URL'] = $rdata['URL'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$data['DISPLAYURL'] = $rdata['DISPLAYURL'];
#
#-----[ OPEN ]------------------------------------------
#
/templates/Core/admintemplateinuse/dir_links_edit.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="label"><span class='req'>*</span>{l}URL{/l}:</td>
<td class="smallDesc">
<input type="text" name="URL" value="{$URL}" size="40" maxlength="255" class="text"/>
{validate form="dir_links_edit" id="v_URL" message=$smarty.capture.invalid_url}
{validate form="dir_links_edit" id="v_URL_U" message=$smarty.capture.url_not_unique}
</td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
{if $smarty.const.ENABLE_DISPLAYURL}
<tr>
<td class="label">{l}Display URL{/l}:</td>
<td class="smallDesc">
<input type="text" name="DISPLAYURL" value="{$DISPLAYURL}" size="40" maxlength="255" class="text"/>
</td>
</tr>
{/if}
#
#-----[ OPEN ]------------------------------------------
#
/templates/templateinuse/link.tpl
#
#-----[ FIND ]------------------------------------------
#
{if $smarty.const.ENABLE_BLANK} target="_BLANK"{/if}>
#
#-----[ REPLACE WITH ]------------------------------------------
#
{if $smarty.const.ENABLE_BLANK} target="_BLANK"{/if}{if $smarty.const.ENABLE_DISPLAYURL} onMouseOver="self.status='{if $link.DISPLAYURL ne ''}{$link.DISPLAYURL}{else}{$link.URL}{/if}'; return true" onMouseOut="self.status=''; return true"{/if}>
#
#-----[ FIND ]------------------------------------------
#
<span class="url">- {$link.URL}</span>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<span class="url">- {if $smarty.const.ENABLE_DISPLAYURL and $link.DISPLAYURL ne ''}{$link.DISPLAYURL}{else}{$link.URL}{/if}</span>
#
#-----[ OPEN ]------------------------------------------
#
/templates/templateinuse/detail.tpl
#
#-----[ FIND ]------------------------------------------
#
{if $smarty.const.ENABLE_BLANK} target="_BLANK"{/if}>
#
#-----[ REPLACE WITH ]------------------------------------------
#
{if $smarty.const.ENABLE_BLANK} target="_BLANK"{/if}{if $smarty.const.ENABLE_DISPLAYURL} onMouseOver="self.status='{if $DISPLAYURL ne ''}{$DISPLAYURL}{else}{$URL}{/if}'; return true" onMouseOut="self.status=''; return true"{/if}>
#
#-----[ FIND ]------------------------------------------
#
<span class="url">- {$link.URL}</span>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<span class="url">- {if $smarty.const.ENABLE_DISPLAYURL and $DISPLAYURL ne ''}{$DISPLAYURL}{else}{$URL}{/if}</span>
#
#-----[ OPEN ]------------------------------------------
#
/templates/Core/admintemplateinuse/link_details.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr><td>{l}Owner IP{/l}:</td><td> {$row.IPADDRESS}</td></tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr><td>{l}Display URL{/l}:</td><td> {$row.DISPLAYURL}</td></tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM__________________
STW FREE USERS - Preview Verification Page integration
If you are using a template with ShrinkTheWeb's FREE thumbnail service, then here is the code for that:
for header.tpl :
<script type="text/javascript" src="https://shrinktheweb.com/scripts/pagepix.js?{php}echo time();{/php}"></script>
*goes anywhere between the "HEAD" tags at the top of the template file
for links.tpl :
<script type="text/javascript"> stw_pagepix('{if $smarty.const.ENABLE_DISPLAYURL and $link.DISPLAYURL ne ''}{$link.DISPLAYURL|escape}{else}{$link.URL|escape}{/if}', '[KEY]', 'sm', 0); </script>
for detail.tpl :
<script type="text/javascript"> stw_pagepix('{if $smarty.const.ENABLE_DISPLAYURL and $link.DISPLAYURL ne ''}{$link.DISPLAYURL|escape}{else}{$link.URL|escape}{/if}', '[KEY]', 'lg', 0); </script>
Please note: The Free PVP (preview verification page) method will automatically link to our preview verification page and there is no way to put your own link. This also inadvertently breaks any link count/tracking code, which is not by design but is unavoidable. Learn more about the PVP method.
You can thank Casey and Dawzz of phpLD for the original version of this great mod!
Best regards,
Brandon