PLEASE NOTE: This article may be out-of-date. Please visit the Support site for the latest information.

STW Thumbnails with phpLD (php Link Directory)

30 posts / 0 new
Letzter Beitrag
Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite

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:

http://www.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="http://www.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! Wink

Best regards,

Brandon

bbrian017
Offline
Beigetreten: 10/29/2008
Besuchen bbrian017's Webseite

Hi puravida,

Thanks for the solution. Yes I used this mod for my affiliate link. One question: the last two codes above where should I update? in link.tpl file? I tried that but got a FATAL ERROR in the smarty code. Can you let me know where should I put those code in? Thanks

Calugarul666
Offline
Beigetreten: 12/14/2011
Besuchen Calugarul666's Webseite

what about Arfooo Link Directory ... does anyone know how the link in the settings menu showd look like? I have no ideea, and I have a paid account at shrinktoweb ! Please anyone help...

Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite

Yes, that depends on where you want to show the thumbnails. If you want to show in the standard link listings, then yes, link.tpl is where you would paste that code.

I noticed that there was an extra space in that block of code (on the word 'escape') and I have corrected that. If you try again, it should work. Wink

-Brandon

bbrian017
Offline
Beigetreten: 10/29/2008
Besuchen bbrian017's Webseite

Hi puravida,

Smashing...it work perfectly. Thanks for your help Smile

Anonymous

Hi,
Im having major issues and cant get the code to work in my template ... No matter what i do i keep getting over the limit pic. I just gota new account and pro account paid.....

My orginal code in my templates link.tpl already had some other thumbnail site which i dont want to use. How can I get this stw code into this template? Here is the twemplate orginal code:

{strip}
	<tr>
	<td style="padding:5px 3px;">
	<img alt="site preview" class="thumb" src="http://open.thumbshots.org/image.pxf?url={$link.URL|escape|trim}" />
   <div class="linkdesc">
{if !empty($link.URL)}
	<a id="id_{$link.ID}" href="{$link.URL|escape|trim}" title="{$link.TITLE|escape|trim}"

	{* nofollow *}
	{if $link.NOFOLLOW or ($link.RECPR_VALID eq 0 and ($smarty.const.RECPR_NOFOLLOW eq 2 or ($smarty.const.RECPR_NOFOLLOW eq 1 and $link.RECPR_REQUIRED eq 1)))} rel="nofollow"{/if}
	{if $smarty.const.ENABLE_BLANK} target="_blank"{/if}>{$link.TITLE|escape|trim}</a> 
{/if}

       [ 
      {if $link.FEATURED}
		<span class="featurl">{$link.URL|escape|trim}</span>
      {else}
		<span class="url">{$link.URL|escape|trim}</span>
	{/if}
	 ]
      <br />
	{if $smarty.const.SHOW_PAGERANK}
      	{include file="pagerank.tpl" pr=$link.PAGERANK}
	{/if}

      {$link.DESCRIPTION|escape|trim} - [ <a href="{if !$smarty.const.ENABLE_REWRITE}
                                                {$smarty.const.DOC_ROOT}/detail.php?id={$link.ID}
                                             {else}
                                                {$smarty.const.DOC_ROOT}/detail/link-{$link.ID}.html{/if}" title="{l}Read more about{/l}: {$link.TITLE|escape|trim}">{l}Read more{/l}</a>

					   {if ($smarty.const.REQUIRE_REGISTERED_USER == 1 || $smarty.const.REQUIRE_REGISTERED_USER_ARTICLE == 1) and !empty ($regular_user_details) and ($regular_user_details.ID == $link.OWNER_ID)}
                                    , <a href="{$smarty.const.DOC_ROOT}/submit.php?linkid={$link.ID}" title="{l}Edit or Remove your link{/l}">{l}Review{/l}</a>
                                 {/if}
                                  ]

   {if !empty ($search) or !empty ($uid)}
      <br />{l}Category{/l}: <a href="{$smarty.const.DOC_ROOT}/{$link.CATEGORY_URL|escape|trim}" title="{$link.CATEGORY_TITLE|escape|trim}">{$link.CATEGORY_TITLE|escape|trim}</a>
   {/if}

</div>
</td>
</tr>
{if !$smarty.foreach.links.last}<tr><td><hr /></td></tr>{/if}

{/strip}

I got to show the picture and stay in line nice but I keep getting over limit pic..... Am i doing this wrong... I tried and tried cant get it to work.....
Would you be able to tell me how to add it to that template....

Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite

Hi Jerzeeman,

It appears that you got this working, because I see our thumbnails on your homepage. Do you still require assistance?

If you are still seeing the "over the limit" pic, it could be that your IP is banned or you are not looking at the page "live."

Best regards,

Brandon

Anonymous

Yes, I did get it working...... for some reason it just started working.... Just left it the way it was and the overlimit went away....

I dont know lol

But thanks for the quick response....

Just incase it helps this is what code I used:

<tr>
	<td style="padding:5px 3px;">
	<img src="http://images.shrinktheweb.com/xino.php?stwembed=1&stwaccesskeyid={mykey}&stwsize=lg&stwurl={$link.URL|escape|trim}" alt="site preview" width="195" height="150" class="thumb" />
   <div class="linkdesc">
Anonymous

First time using this on a phpLD website and I'm getting the "over the limit" message too.

Any idea how long you had to wait before the thumbnails updated correctly?

~Cindy

Bild von puravida
puravida
Jedi Warrior
Online
Beigetreten: 09/01/2007
Besuchen puravida's Webseite

Hi Cindy,

"Over the limit" will not go away on its own.

There is a problem with your code or you are trying to use a PRO feature without having upgraded. If you are trying to make a basic request, you must be sure to replace the "stwaccesskeyid=[KEY]" part with your account credentials.

Best regards,

Brandon

Calugarul666
Offline
Beigetreten: 12/14/2011
Besuchen Calugarul666's Webseite

what about Arfooo Link Directory ... does anyone know how the link in the settings menu showd look like? I have no ideea, and I have a paid account at shrinktoweb ! Please anyone help...

can you show me a link...and i can replace the ID and security !

Topic locked

ShrinkTheWeb® (About STW) is another innovation by Neosys Consulting

Kontakt | PagePix Benefits | Learn More | Our Partners | Datenschutzrichtlinie | Nutzungsbedingungen

©2014 ShrinkTheWeb. Alle Rechte vorbehalten. ShrinkTheWeb ist ein eingetragenes Handelszeichen von ShrinkTheWeb.