This is the deep links mod for phpld 3.3.
The changes needed for the template files are applied to the default template “Professional”. If you use another template you will have to modify your template files (submit.tpl, detail.tpl and header.tpl).
UPGRADE: If you have already installed the mod for 3.2 all you have to do is overwrite the files and apply the required modifications for your template files.
FRESH INSTALL: you need to upload and overwrite the files in the package and then rerun the install script for the directory (/install/index.php, if already deleted, reupload it again and then delete it after installation). Don’t forget to apply the required changes to your template files.

Download phpld 3.3 Deeplinks mods - easy install Version 1.0

Downloaded a total of 3824 times

If you prefer not to rerun the phpld install script, you can create a php file in the admin folder with the following lines:

<?php 
require_once 'init.php';

$db->Execute("ALTER TABLE `PLD_LINK` ADD `TITLE1` VARCHAR( 255 ) NULL ;");
$db->Execute("ALTER TABLE `PLD_LINK` ADD `TITLE2` VARCHAR( 255 ) NULL ;");
$db->Execute("ALTER TABLE `PLD_LINK` ADD `TITLE3` VARCHAR( 255 ) NULL ;");
$db->Execute("ALTER TABLE `PLD_LINK` ADD `TITLE4` VARCHAR( 255 ) NULL ;");
$db->Execute("ALTER TABLE `PLD_LINK` ADD `TITLE5` VARCHAR( 255 ) NULL ;");


$db->Execute("ALTER TABLE `PLD_LINK` ADD `URL1` VARCHAR( 255 ) NULL ;");
$db->Execute("ALTER TABLE `PLD_LINK` ADD `URL2` VARCHAR( 255 ) NULL ;");
$db->Execute("ALTER TABLE `PLD_LINK` ADD `URL3` VARCHAR( 255 ) NULL ;");
$db->Execute("ALTER TABLE `PLD_LINK` ADD `URL4` VARCHAR( 255 ) NULL ;");
$db->Execute("ALTER TABLE `PLD_LINK` ADD `URL5` VARCHAR( 255 ) NULL ;");

echo "done";
?>

save it as db_deeplinks.php in /admin/ and open it in your browser http://www.yourdirectory/admin/db_deeplinks.php

This will add the required fields to the database.

January 4th, 2008phpLD Better Display URL

Most phpLD templates show the url of the listing along with the title and description. In the default template it looks like this:

rakCha Directory - http://www.rakcha.com/
rakCha premium directory. - [Read more]

This is fine when the url is the domain name. However listings may link to internal pages and the url can be very long and it is no longer convenient to show the whole url. Example:

Painting Directory - http://www.enquira.com/arts-humanities/painting/
enQuira paintings links and resources. - [Read more]

Sometimes the internal link is even longer than this and can include many parameters and can break the template. The proposed solution is to always display only the main url in the display url field, like this:

Painting Directory - http://www.enquira.com
enQuira paintings links and resources. - [Read more]

To implement this you should replace

<span class="url">- {$link.URL|escape|trim}

BY

<span class="url">- 
{assign var="parsed_url" value=$link.URL|escape|trim|parse_url}
 {$parsed_url.host}

in link.tpl

Make sure NOT to replace the instance of {$link.URL|escape|trim} in the actual URL (href=”{$link.URL|escape|trim}”)

Also, in some templates the featured links are implemented in a separate file (like flink.tpl), you should do the same thing in that file.

Directories that rank high in the SERPS for a certain keyword provide not only targetted traffic but also a quality relevent backlink. This is the kind of links Google recommands in its guidelines. So If you want to submit your real estate related website, instead of choosing the directory with highest PR, you should choose the directory that ranks best for that specific keyword.

I used the Google custom search to restrict the search on directories. So far 1277 directories are listed.
Strongest Directories for the Shopping Niche
Strongest Directories for the Real Estate Niche
Strongest Directories for the Jewelry Niche
Strongest Directories for the Celebrities Niche

You can do this search for any keyword you are targetting using the
Directories Link Quality Search: http://tools.enquira.com/link-quality.php

Your feedback is appreciated.

This is a one step install of the deep links mod. It is assumed that the defaut template is used. If you use another template you can still use this easy install and then modify just 3 template files (submit.tpl, header.tpl and detail.tpl)

This MOD will add 2 payment options Featured+ with 5 deep links and Regular+ with 3 deep links. The Featured and Regular will have no deep links. demo

To install the deep links mod, all you have to do is unzip the content of zip file below in the folder where your directory is installed (usually public_html). Overwrite all existing files and then run the installer by pointing to yourdirectory/install/index.php
You are done!

Download Deep Links MOD

Downloaded a total of 3929 times

If you use a template that is not the default one, you still have some work to do. You will have to edit 3 files.
More details can be found here.

Important: This is for version 3.2

After installing the 1 step deep links mod, you need to modify the following template files:
/templates/yourtemplate/submit.tpl
/templates/yourtemplate/detail.tpl
/templates/yourtemplate/header.tpl

Template coders can apply these changes to their templates and offer deep links ready templates.

1. edit header.tpl
Right before </head>, add

{* Deep Links by rakCha http://blog.rakcha.com *}
<script type="text/javascript" 
src="{$smarty.const.DOC_ROOT}/javascripts/deeplinks.js"></script>

2. edit.submit.tpl
FIND

{if $price.featured}

ABOVE that, ADD

{if $price.featured_adv}
<tr><td><input type="radio" name="LINK_TYPE" value="featured_adv"
{if $LINK_TYPE eq 'featured_adv'}checked="true"{/if} 
 onclick="featured();"; >
Featured links +
</td>
<td>{$smarty.const.HTML_CURRENCY_CODE}{$price.featured_adv}
</td>
</tr>
{/if}

FIND

{if $price.normal gt 0}

ABOVE that, ADD

{if $price.normal_adv gt 0}
<tr>
<td><input type="radio" name="LINK_TYPE" value="normal_adv"
{if $LINK_TYPE eq 'normal_adv'}checked="true"{/if} onclick="regular();"; >
{l}Regular links +{/l}
</td>
<td>{$smarty.const.HTML_CURRENCY_CODE}{$price.normal_adv}
</td>
</tr>
{/if}

FIND:

<input type="radio" name="LINK_TYPE" value="featured"
 {if $LINK_TYPE eq 'featured'}checked="true"{/if}>

REPLACE BY:

<input type="radio" name="LINK_TYPE" value="featured"
 {if $LINK_TYPE eq 'featured'}checked="true"{/if}
  onclick="no_deeplinks();"; >

FIND:

<input type="radio" name="LINK_TYPE" value="normal"
 {if $LINK_TYPE eq 'normal'}checked="true"{/if}>

REPLACE BY:

<input type="radio" name="LINK_TYPE" value="normal"
 {if $LINK_TYPE eq 'normal'}checked="true"{/if}
 onclick="no_deeplinks();"; >

There are 2 Instances of this, for free and paid regular links.

FIND:

<input type="radio" name="LINK_TYPE" value="reciprocal"
 {if $LINK_TYPE eq 'reciprocal'}checked="true"{/if}>

REPLACE BY:

<input type="radio" name="LINK_TYPE" value="reciprocal"
 {if $LINK_TYPE eq 'reciprocal'}checked="true"{/if}
 onclick="no_deeplinks();"; >

FIND:

<tr>
   <td class="label">{l}Description{/l}:</td>

ABOVE it, ADD:

<tr id="field1_title" style="display:none">
<td class="label">TITLE 1</td>
<td class="field"><input type="text"  id="TITLE1"  
name="TITLE1" value="{$TITLE1|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr>
<tr id="field1_url" style="display:none">
<td class="label">URL 1</td>
<td class="field"><input type="text"  id="URL1" 
name="URL1" value="{$URL1|escape|trim}"
size="40" maxlength="255" class="text"/>
</td>
</tr> 
<tr id="field2_title" style="display:none">
<td class="label">TITLE 2</td>
<td class="field"><input type="text" id="TITLE2" 
name="TITLE2" value="{$TITLE2|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr>
<tr id="field2_url" style="display:none">
<td class="label">URL 2</td>
<td class="field"><input type="text"  id="URL2"  
name="URL2" value="{$URL2|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr> 
<tr id="field3_title" style="display:none">
<td class="label">TITLE 3</td>
<td class="field"><input type="text"  id="TITLE3"  
name="TITLE3" value="{$TITLE3|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr>
<tr id="field3_url" style="display:none">
<td class="label">URL 3</td>
<td class="field"><input type="text"  id="URL3"  
name="URL3" value="{$URL3|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr> 
<tr id="field4_title" style="display:none">
<td class="label">TITLE 4</td>
<td class="field"><input type="text"  id="TITLE4"  
name="TITLE4" value="{$TITLE4|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr>
<tr id="field4_url" style="display:none">
<td class="label">URL 4</td>
<td class="field"><input type="text"  id="URL4"  
name="URL4" value="{$URL4|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr> 
<tr id="field5_title" style="display:none">
<td class="label">TITLE 5</td>
<td class="field"><input type="text"  id="TITLE5"  
name="TITLE5" value="{$TITLE5|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr>
<tr id="field5_url" style="display:none">
<td class="label">URL 5</td>
<td class="field"><input type="text"  id="URL5"  
name="URL5" value="{$URL5|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr>

3. in detail.tpl
FIND:

<tr>
<td class="label">{l}Description{/l}:</td>
<td class="smallDesc" align="left">
{$DESCRIPTION|escape|trim}</td>
</tr>

BELOW, ADD:

{if $TITLE1}   
<tr>
<td class="label">{l}Quick Links:{/l}</td>
<td class="smallDesc" align="left">
<a href="{$URL1|escape|trim}">
{$TITLE1|escape|trim}</a>&nbsp;
<a href="{$URL2|escape|trim}">
{$TITLE2|escape|trim}</a>&nbsp;
<a href="{$URL3|escape|trim}">
{$TITLE3|escape|trim}</a>&nbsp;
<a href="{$URL4|escape|trim}">
{$TITLE4|escape|trim}</a>&nbsp;
<a href="{$URL5|escape|trim}">
{$TITLE5|escape|trim}</a>&nbsp;
</td>
</tr>   
{/if}

September 13th, 2007Cron job for database backup

This cron job allows you make automatic backups of your database and delete the backup files older than 7 days. You can set the backups to occur daily and use the following command for the cron:

cd BACKUPS_PATH; /usr/bin/mysqldump --opt -u DBUSER -pPASSWD DBNAME | gzip > DBNAME_`date "+%Y%m%d"`.sql.gz ; /usr/bin/find *.gz -mtime +7 | xargs /bin/rm -f

You should replace DBUSER, PASSWD, DBNAME with their respective values. Also BACKUPS_PATH should be replaced by the folder where you want to store your backup files (/home/yourdomain/public_html/backups or /var/www/vhosts/backups, …)

There is no space between -p and PASSWD.

With this MOD, your article pages urls will contain the title of the article for better search engine optimization.

1 in .htaccess
FIND

##Article Page Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)articles/article-(.*)\.htm[l]?$ article.php [QSA,NC]

REPLACE BY

##Article Page Rewrite
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteRule (.*)articles/(.*)\.html$ article.php [NC,QSA,L]

If you have installed the mod for seo friendly details pages, please place this code above the rewrite rules for the details pages which begin with

##Details Link Page Rewrite

2. in /article.php
FIND

preg_match ('#(.*)article(_|-)(\d+)\.htm[l]?$#i', request_uri(), $matches);

REPLACE BY

preg_match('#articles/(.*)(_|-)(\d+)\.htm[l]?$#i',request_uri(),$matches);

in /templates/your_template/articlelink.tpl
FIND

article-{$article.ID}.html

REPLACE BY

{$article.TITLE|replace:" ":"-"}-{$article.ID}.html

August 23rd, 2007phpLD Custom Category Titles

If you want to customize the titles of the categories pages and not limit it to the name of the category you can use the following modification.
Example:
Category: Internet
Custom Title: Web resources.

Category: Employment
Custom Title: Find you next job

1.

In phpMyadmin, run the following mysql query:

ALTER TABLE `PLD_CATEGORY` ADD `CUSTOM_NAME` TEXT NULL ;

2.

OPEN /templates/Code/admin/dir_categs_edit.tpl

FIND:

{if $symbolic ne 1}
      <tr>

BEFORE THAT, ADD:

<tr>
<td class="label"><label for="CUSTOM_NAME">
Custom Name:</label></td>
<td class="smallDesc">
<input type="text" id="CUSTOM_NAME" name="CUSTOM_NAME" 
 value="{$CUSTOM_NAME|escape|trim}" class="text" />      
</td>
</tr>

3.

OPEN /admin/dir_categs.php

FIND

//Determine columns
$columns = array ('TITLE' => _L('Title'), 'TITLE_URL' => _L('URL Title'),
'DESCRIPTION' => _L('Description'), 'PARENT' => _L('Parent'),
'SYMBOLIC' => _L('Type'), 'STATUS' => _L('Status'),
'HITS' => _L('Hits'), 'DATE_ADDED' => _L('Date Added'));

REPLACE BY

//Determine columns
$columns = array ('TITLE' => _L('Title'), 'TITLE_URL' => _L('URL Title'),
'CUSTOM_NAME' => _L('Custom Name'), 'DESCRIPTION' => _L('Description'),
'PARENT' => _L('Parent'), 'SYMBOLIC' => _L('Type'), 'STATUS' => _L('Status'),
 'HITS' => _L('Hits'), 'DATE_ADDED' => _L('Date Added'));

4.
To add the custom category name in the page title or the body of the page, ADD {$category.CUSTOM_NAME|escape|trim}
to the appropriate template file (header.tpl, top_bar.tpl, main.tpl, …)

Some time we have to collect last 7 or 15 days or X days (or month, year or week) data from MySQL table. For example let us find out who are the new members joined in our forum in last week. One shop may be interested in knowing new products added in last one month. What are the books arrived in last one year. Here irrespective of the date values we want the records of last X days from today, or we can say that the records between today and last X days ( month , year or week) are required.

We will use the MySQL function CURDATE() to get the today’s date.

To get the difference in today date and previous day or month we have to use the MySQL function DATE_SUB

DATE_SUB is a MySQL function which takes date expression, the interval and the constant to return the date value for further calculation.

Here are some sample queries on how to get the records as per requirements .

select * from dt_tb where `dt` >= DATE_SUB(CURDATE(), INTERVAL 15 DAY)

The above query will return last 15 days records. Note that this query will return all future dates also. To exclude future dates we have to modify the above command a little by using between query to get records. Here is the modified one.

SELECT * FROM dt_tb WHERE `dt` BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 15 DAY ) AND CURDATE( )

Let us try to get records added in last one month

select * from dt_tb where `dt` >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)

Here also future records will be returned so we can take care of that by using BETWEEN commands if required.

select * from dt_tb where `dt` >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)

You can easily make out what the above query will return.

We can collect records between a particular date ranges by using between command and DATE_SUB. Here are some queries to generate records between two date ranges.

select * from dt_tb where `dt` BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 3 MONTH ) AND DATE_SUB( CURDATE( ) ,INTERVAL 0 MONTH )

This query will return records between last three months. This query again we will modify to get the records between three moths and six months.

select * from dt_tb where `dt` BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 6 MONTH ) AND DATE_SUB( CURDATE( ) ,INTERVAL 3 MONTH )

Now let us change this to get records between 6 month and 12 month.

select * from dt_tb where `dt` BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 12 MONTH ) AND DATE_SUB( CURDATE( ) ,INTERVAL 6 MONTH )

With this you can understand how the records between a month range or a year range can be collected from a table. Note that the months ranges are calculated starting from current day. So if we are collecting records of last three months and we are in 15th day of 9th month then records of 15th day of 6th month we will get but the records of 14th day of 6th month will be returning on next query that is between 3 months and 6 months.

Now let us try a different requirement. How to get the records of the working days of the week so far ? If today is Thursday then records from Monday to Thursday should be returned. We will discuss this in our next section >>.

Here is the sql code to create and fill the table with records

CREATE TABLE `dt_tb` ( `id` int(2) NOT NULL auto_increment, `dt` datetime NOT NULL default ‘0000-00-00 00:00:00′, `dt2` date NOT NULL default ‘0000-00-00′, UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;

INSERT INTO `dt_tb` VALUES (1, ‘2007-02-15 00:00:00′, ‘2005-01-25′);
INSERT INTO `dt_tb` VALUES (2, ‘2007-02-12 23:56:54′, ‘2005-06-12′);
INSERT INTO `dt_tb` VALUES (3, ‘2005-12-08 13:20:10′, ‘2005-06-06′);
INSERT INTO `dt_tb` VALUES (5, ‘2005-02-10 00:00:00′, ‘2006-01-02′);
INSERT INTO `dt_tb` VALUES (6, ‘2006-11-26 00:00:00′, ‘2006-12-25′);
INSERT INTO `dt_tb` VALUES (7, ‘2006-11-26 00:00:00′, ‘2007-02-25′);
INSERT INTO `dt_tb` VALUES (8, ‘2007-10-20 00:00:00′, ‘2007-10-25′);
INSERT INTO `dt_tb` VALUES (9, ‘2007-02-11 00:00:00′, ‘2007-01-25′);
INSERT INTO `dt_tb` VALUES (10, ‘2007-01-22 00:00:00′, ‘2007-01-15′);

Source: plus2net

With this mod you can add two new payment plans, 1 featured we will call Featured+ and one regular, we call Regular+. You can adapt this tutorial to add as many payment plans as you would like to.

1. In this step you should add two rows in the PLD_CONFIG. You can use one of the following two methods.

Method 1: run the following Mysql query in phpMyadmin:

INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES
 ('PAY_NORMAL_ADV', '20'), ('PAY_FEATURED_ADV', '50');

Here 20 and 50 are the prices of the different plans, either change them before running the query or can just edit them in the admin panel when you are done adding the MOD.

Method 2:
in include/tables.php
FIND:

array ('ID' => 'PAY_NORMAL', 'VALUE' => '0'),
array ('ID' => 'PAY_FEATURED', 'VALUE' => '0'),
array ('ID' => 'PAY_RECPR', 'VALUE' => '0'),

REPLACE BY:

array ('ID' => 'PAY_NORMAL', 'VALUE' => '0'),
array ('ID' => 'PAY_FEATURED', 'VALUE' => '0'),
array ('ID' => 'PAY_NORMAL_ADV', 'VALUE' => '0'),
array ('ID' => 'PAY_FEATURED_ADV', 'VALUE' => '0'),
array ('ID' => 'PAY_RECPR', 'VALUE' => '0'),

Now rerun the installer by pointing the browser to /install/index.php. You might have to put that file back if you removed it or renamed it. You should also set the writing permissions of /include/config.php.
Now that the new fields are added to the database, remove the install script.

2. in admin/conf_options.php

FIND:

array ('ID'            => 'PAY_NORMAL',
         'NAME'          => _L('Regular price'),
         'DESCRIPTION'   => _L('Unit price for regular links...'),
         'CONFIG_GROUP'  => '9',
         'TYPE'          => 'NUM',
         'REQUIRED'      => '1'),
array ('ID'            => 'PAY_FEATURED',
         'NAME'          => _L('Featured price'),
         'DESCRIPTION'   => _L('Unit price for featured links...'),
          'CONFIG_GROUP'  => '9',
          'TYPE'          => 'NUM',
          'REQUIRED'      => '1'),

REPLACE BY:

array ('ID'            => 'PAY_NORMAL_ADV',
         'NAME'          => _L('Regular price +'),
         'DESCRIPTION'   => _L('Unit price for regular links+ ...'),
         'CONFIG_GROUP'  => '9',
         'TYPE'          => 'NUM',
         'REQUIRED'      => '1'),
array ('ID'            => 'PAY_FEATURED_ADV',
         'NAME'          => _L('Featured price +'),
         'DESCRIPTION'   => _L('Unit price for featured links+ ...'),
         'CONFIG_GROUP'  => '9',
         'TYPE'          => 'NUM',
         'REQUIRED'      => '1'),
array ('ID'            => 'PAY_NORMAL',
         'NAME'          => _L('Regular price'),
         'DESCRIPTION'   => _L('Unit price for regular links...'),
         'CONFIG_GROUP'  => '9',
         'TYPE'          => 'NUM',
         'REQUIRED'      => '1'),
array ('ID'            => 'PAY_FEATURED',
         'NAME'          => _L('Featured price'),
         'DESCRIPTION'   => _L('Unit price for featured links...'),
         'CONFIG_GROUP'  => '9',
         'TYPE'          => 'NUM',
         'REQUIRED'      => '1'),

3. in submit.php

FIND:

if (FTR_ENABLE == 1 && PAY_FEATURED > 0)
      $price['featured'] = PAY_FEATURED;
   if (PAY_NORMAL > 0)
   {
      $price['normal'] = PAY_NORMAL;
      if (PAY_ENABLE_FREE)
         $price['free'] = 0;
   }

REPLACE BY:

if (FTR_ENABLE == 1 && PAY_FEATURED > 0)
      $price['featured'] = PAY_FEATURED;
  
   if (FTR_ENABLE == 1 && PAY_FEATURED_ADV > 0)
      $price['featured_adv'] = PAY_FEATURED_ADV;

   if (PAY_NORMAL > 0)
   {
      $price['normal'] = PAY_NORMAL;
      if (PAY_ENABLE_FREE)
         $price['free'] = 0;
   }
      if (PAY_NORMAL_ADV > 0)
   {
      $price['normal_adv'] = PAY_NORMAL_ADV;
   }

FIND:

switch (strtolower ($link_type))
      {
         case 'free' :
            $data['NOFOLLOW'] = 1;
            break;
         case 'featured' :
            $data['FEATURED'] = 1;
            break;
         default :
            break;
      }

REPLACE BY:

switch (strtolower ($link_type))
      {
         case 'free' :
            $data['NOFOLLOW'] = 1;
            break;
         case 'featured' :
            $data['FEATURED'] = 1;
            break;
         case 'featured_adv' :
            $data['FEATURED'] = 1;
            break;			
         default :
            break;
      }

4. in payment.php

FIND:

if (FTR_ENABLE == '1' && PAY_FEATURED > 0)
   $price[$link_type_int['featured']] = PAY_FEATURED;

if (PAY_NORMAL > 0)
{
   $price[$link_type_int['normal']] = PAY_NORMAL;
   if (PAY_ENABLE_FREE)
      $price[$link_type_int['free']] = 0;
}

REPLACE BY:

if (FTR_ENABLE == '1' && PAY_FEATURED > 0)
   $price[$link_type_int['featured']] = PAY_FEATURED;

if (FTR_ENABLE == '1' && PAY_FEATURED_ADV > 0)
   $price[$link_type_int['featured_adv']] = PAY_FEATURED_ADV;   

if (PAY_NORMAL > 0)
{
   $price[$link_type_int['normal']] = PAY_NORMAL;
   if (PAY_ENABLE_FREE)
      $price[$link_type_int['free']] = 0;
}

if (PAY_NORMAL_ADV > 0)
{
   $price[$link_type_int['normal_adv']] = PAY_NORMAL_ADV;
}

5. in include/constants.php
FIND:

$link_type_int   = array ( 'none' => 0, 'free' => 1, 'normal' => 2,
                        'reciprocal' => 3, 'featured' => 4);
$link_type_str=array ( 0 => _L('None'), 1 => _L('Free'), 2 => _L('Normal'),
                     3 => _L('Reciprocal'), 4 => _L('Featured'));

REPLACE BY:

$link_type_int   = array ( 'none' => 0, 'free' => 1, 'normal' => 2,
              'reciprocal' => 3, 'featured' => 4, 'normal_adv' => 5,
              'featured_adv' => 6);
$link_type_str   = array ( 0 => _L('None'), 1 => _L('Free'),
                  2 => _L('Normal'), 3 => _L('Reciprocal'),
                  4 => _L('Featured'), 5 => _L('Normal+'),
                  6 => _L('Featured+'));

6. in include/functions.php
FIND:

function determine_link_type($type = 0)
{
   if (!preg_match ('`^[\d]+$`', $type))
      return false;

   $type = ($type < 0 || $type > 6 ? 0 : intval ($type));

   switch ($type) {
      case 4  :
         $return = 'featured';
         break;
      case 3  :
         $return = 'reciprocal';
         break;
      case 2  :
         $return = 'normal';
         break;
      case 1  :
         $return = 'free';
         break;
      case 0  :
      default :
         $return = 'none';
         break;
   }

   return (!empty ($return) ? $return : false);
}

REPLACE BY

function determine_link_type($type = 0)
{
   if (!preg_match ('`^[\d]+$`', $type))
      return false;

   $type = ($type < 0 || $type > 6 ? 0 : intval ($type));

   switch ($type) {
      case 6  :
         $return = 'featured_adv';
         break;
      case 5  :
         $return = 'normal_adv';
         break;
      case 4  :
         $return = 'featured';
         break;
      case 3  :
         $return = 'reciprocal';
         break;
      case 2  :
         $return = 'normal';
         break;
      case 1  :
         $return = 'free';
         break;
      case 0  :
      default :
         $return = 'none';
         break;
   }

   return (!empty ($return) ? $return : false);
}

We are almost done, we only need to modify the submit form to show the additional payment plans.

in submit.tpl
FIND

{if $price.featured}

ABOVE that, ADD:

{if $price.featured_adv}
<tr><td>
<input type="radio" name="LINK_TYPE" value="featured_adv"
            {if $LINK_TYPE eq 'featured_adv'}checked="true"{/if}>
            {l}Featured links +{/l}
</td><td>
{$smarty.const.HTML_CURRENCY_CODE}{$price.featured_adv}
</td>
</tr>
{/if}

FIND

{if $price.normal gt 0}

ABOVE that, ADD:

{if $price.normal_adv gt 0}
<tr>
   <td><input type="radio" name="LINK_TYPE" value="normal_adv"
         {if $LINK_TYPE eq 'normal_adv'}checked="true"{/if}>
         {l}Regular links +{/l}
   </td>
   <td>{$smarty.const.HTML_CURRENCY_CODE}{$price.normal_adv}
   </td>
</tr>
{/if}

You are done! If you are combining this with the deep links mod, you should place onclick="regular();";, onclick="featured();";, onclick="no_deeplinks();"; in the appropriate radio buttons.
Below is the javascript needed

{literal}
<script language="JavaScript">
function setVisibility(id, visibility) {
document.getElementById(id).style.display = visibility;
}
function featured(){
setVisibility('field1_title', '');
setVisibility('field1_url', '');
setVisibility('field2_title', '');
setVisibility('field2_url', '');
setVisibility('field3_title', '');
setVisibility('field3_url', '');
setVisibility('field4_title', '');
setVisibility('field4_url', '');
setVisibility('field5_title', '');
setVisibility('field5_url', '');
}
function regular(){
setVisibility('field1_title', '');
setVisibility('field1_url', '');
setVisibility('field2_title', '');
setVisibility('field2_url', '');
setVisibility('field3_title', '');
setVisibility('field3_url', '');
setVisibility('field4_title', 'none');
setVisibility('field4_url', 'none');
setVisibility('field5_title', 'none');
setVisibility('field5_url', 'none');
}
function no_deeplinks(){
setVisibility('field1_title', 'none');
setVisibility('field1_url', 'none');
setVisibility('field2_title', 'none');
setVisibility('field2_url', 'none');
setVisibility('field3_title', 'none');
setVisibility('field3_url', 'none');
setVisibility('field4_title', 'none');
setVisibility('field4_url', 'none');
setVisibility('field5_title', 'none');
setVisibility('field5_url', 'none');
}
</script> 
{/literal}

Please refer to the deep links mod for more details on this. fieldX_title and fieldX_url are the ids of the rows corresponding the deep links fields, as explained in the deeplinks mod.


© 2007 rakCha resources | Powered by Wordpress | rakCha web directory