Go Back   PHP Link Directory Forum > PHP Link Directory (phpLD) > Mods and contribution Discussion

Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum.

Closed Thread
 
Thread Tools Display Modes
Old 11-27-2005   #1
Ap0s7le
 
Join Date: Jun 2005
Location: The world
Posts: 816
Send a message via ICQ to Ap0s7le Send a message via AIM to Ap0s7le Send a message via MSN to Ap0s7le Send a message via Yahoo to Ap0s7le Send a message via Skype™ to Ap0s7le
Default Display URL Mod

Try it out, let me know what you think etc.

If you appreciate this mod, please send me a donation or if you need PHP work done, also feel free to contact me.

Thanks

Code:
##############################################################
## MOD Title: Display URL
## MOD Author: Casey Wilson < at@ap0s7le.com > http://www.ap0s7le.com
## MOD Description: Gives the option to show a different URL than the one the link actually goes to.
## MOD Version: 1.0.0
## 
## Installation Level: Intermediate
## Installation Time: 15 Minutes 
## Files To Edit: 
##		  /admin/dir_links_edit.php
##		  /admin/init.php
##		  /include/tables.php
##		  /templates/admin/dir_links_edit.tpl
##		  /templates/link.tpl
##		  /templates/admin/link_details.tpl
##
##
##############################################################
## Author Notes: 
##		This MOD was written using PHPLD v2 as it's backbone.
##		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.
## 
##############################################################
## 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/init.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 ]------------------------------------------
#
/templates/admin/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/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/admin/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
__________________
Casey Wilson / Ap0s7le
Freelance Programmer
http://www.ap0s7le.com
Need help with PHPLD? PM me
Ap0s7le is offline  
Old 11-28-2005   #2
Wenchie
 
Join Date: Sep 2005
Location: Alabama
Posts: 15
Send a message via Yahoo to Wenchie
Default

Ohhh nice! I needed this and it works perfectly.. thank you for it.

Donation sent.

You didn't say where to send the donation so I used the link from here.. hope that was okay.
__________________
Wenchie
Wenchie is offline  
Old 11-29-2005   #3
Ap0s7le
 
Join Date: Jun 2005
Location: The world
Posts: 816
Send a message via ICQ to Ap0s7le Send a message via AIM to Ap0s7le Send a message via MSN to Ap0s7le Send a message via Yahoo to Ap0s7le Send a message via Skype™ to Ap0s7le
Default

Haha thanks

David actually gets that, my PayPal address can be PM'd upon request.

I'm very glad you liked it!

Thank you

-Casey
__________________
Casey Wilson / Ap0s7le
Freelance Programmer
http://www.ap0s7le.com
Need help with PHPLD? PM me
Ap0s7le is offline  
Old 11-29-2005   #4
Wenchie
 
Join Date: Sep 2005
Location: Alabama
Posts: 15
Send a message via Yahoo to Wenchie
Default

Oh no! I'm so sorry. David give Casey my donation please. :lol:
__________________
Wenchie
Wenchie is offline  
Old 01-18-2006   #5
GiveItaGo
 
Join Date: Jan 2006
Posts: 9
Default Quick Query

Like the sound of this MOD so I am going to give it a go - I just have a quick query regarding the database alteration.

ALTER TABLE `PLD_LINK` ADD `DISPLAYURL` VARCHAR( 255 ) NOT NULL ;

- no problem fully understand that one!

INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES ('ENABLE_DISPLAYURL', '1');

- Does this mean that the current fields ID & Value require altering to the values in brackets respectively or that additional fields with those values need creating?

If it is the former (which I think it is) how do I alter the value of ID to 'ENABLE_DISPLAYURL' - Do I need to change the 'Type' to i.e. - 'CHAR' or perhaps something else?

Once again any help would be appreciated.

regards

Paul
GiveItaGo is offline  
Old 01-18-2006   #6
GiveItaGo
 
Join Date: Jan 2006
Posts: 9
Default Worked it out!

Well managed to work it out - The values discussed need to be entered in the 'default settings' of those particular fields. Other than that this was very easy to implement with some excellent instructions.

If you pm/email me with your paypal details I will gladly make a contribution for this mod and thankyou for making this available.

regards

Paul
GiveItaGo is offline  
Old 02-11-2006   #7
melaniejk
 
Join Date: Oct 2005
Posts: 34
Default First step?

Hi.
I would like to put this Mod on my directory. I read over the directions and think I can handle all the steps except one -- the first one.

How do I edit SQL ?

I went to my Cpanl and clicked on MySQL. The options are Delete, Check, or Repair.

Do I click on Repair? I want to make sure before I do in case I'm wrong and mess something up.

Oh, can anyone who used this mod verify that your affiliate links for Commission Junction were able to work and you got proper credit.

I'll be happy to make a donation if I can get this to work properly.

Thank you.


#-----[ 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');
#
melaniejk is offline  
Old 02-11-2006   #8
Ap0s7le
 
Join Date: Jun 2005
Location: The world
Posts: 816
Send a message via ICQ to Ap0s7le Send a message via AIM to Ap0s7le Send a message via MSN to Ap0s7le Send a message via Yahoo to Ap0s7le Send a message via Skype™ to Ap0s7le
Default

Hello melaniejk,

Once in the MySQL part of CPanel, look for "phpMyAdmin"
When you get there, on the left use the dropdown to find your table, then when it loads on the right, hit "SQL" and it will show a big textarea to add that part in.

If you have any questions, or need help feel free to contact me personally.

Kind Regards,

-Casey
__________________
Casey Wilson / Ap0s7le
Freelance Programmer
http://www.ap0s7le.com
Need help with PHPLD? PM me
Ap0s7le is offline  
Old 02-11-2006   #9
melaniejk
 
Join Date: Oct 2005
Posts: 34
Default phpMyAdmin step

Anyone online available to help right now?

I just need help on the phpMyAdmin step.
melaniejk is offline  
Old 02-11-2006   #10
Boby
Supporter
Moderator
 
Boby's Avatar
 
Join Date: Dec 2005
Location: Cluj-Napoca/Sighisoara (Romania)
Posts: 4,468
Default

Quote:
Anyone online available to help right now?

I just need help on the phpMyAdmin step.
Yes!
Please post your question/problem, I am here and will help you.

Boby
__________________
wanna say thank you?
  • My phpLD Mods
  • I am *not* a phpLD staff member, so please do *not* ask me to grant permissions, sales stuff, for access to the private supporter forums or phpLD 3.0+ download area.
  • Before you report your problems, make sure it happens with the *default* package and not your highly modified code. Don't forget to use the search feature and do not *bump* threads to soon (allow at least 24h).
Boby is offline  
Old 02-11-2006   #11
melaniejk
 
Join Date: Oct 2005
Posts: 34
Default stuck

Hi. I'm stuck in the phpMyAdmin area.
I think I'm supposed to paste the following in a white box.
Do I paste it exactly?

ALTER TABLE `PLD_LINK` ADD `DISPLAYURL` VARCHAR( 255 ) NOT NULL ;
INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES ('ENABLE_DISPLAYURL', '1');


The box already has text in it. So, I'm thinking I should delete it.
But, then how do I add this. Do I click on Insert.

I don't want to make a mistake and mess things up. So, I'm waiting for a thumbs up.
melaniejk is offline  
Old 02-11-2006   #12
David
Administrator
phpLD Administrator
Supporter
 
David's Avatar
 
Join Date: Jan 2005
Posts: 11,667
Default

Defintely backup your database first.
Then yes, replace what is in the box with this.
David is offline  
Old 02-12-2006   #13
melaniejk
 
Join Date: Oct 2005
Posts: 34
Default GO button

Ok, thanks.
I figured out the problem.

I needed to click on the GO button after pasting that stuff in the white box.
melaniejk is offline  
Old 03-06-2006   #14
wtms
Supporter
 
Join Date: Mar 2006
Location: East Coast
Posts: 78
Send a message via Yahoo to wtms Send a message via Skype™ to wtms
Default Re: Display URL Mod

Quote:
Originally Posted by Ap0s7le
Try it out, let me know what you think etc.

If you appreciate this mod, please send me a donation or if you need PHP work done, also feel free to contact me.

Thanks
Thanks for the MOD Casey.

Looks like I got it to work in 3.0.2

I will gladly drop few bucks your way - give me your PayPal e-mail.

I have a question:
What needs to be changed to enable "display URL" field in "Submit link" template and database to store this info. This way when somebody submits new link they could submit both - actual url and display url. If I understand correct - right now "display URL" can be entered only from admin interface?

Thanks
P.S. I was serious about PayPal address.
wtms is offline  
Old 03-06-2006   #15
anon
Supporter
 
anon's Avatar
 
Join Date: Feb 2006
Location: As far from you as humanly possible!
Posts: 2,893
Send a message via Yahoo to anon
Default Re: Display URL Mod

Quote:
Originally Posted by wtms
Quote:
Originally Posted by Ap0s7le
Try it out, let me know what you think etc.

If you appreciate this mod, please send me a donation or if you need PHP work done, also feel free to contact me.

Thanks
Thanks for the MOD Casey.

Looks like I got it to work in 3.0.2

I will gladly drop few bucks your way - give me your PayPal e-mail.

I have a question:
What needs to be changed to enable "display URL" field in "Submit link" template and database to store this info. This way when somebody submits new link they could submit both - actual url and display url. If I understand correct - right now "display URL" can be entered only from admin interface?

Thanks
P.S. I was serious about PayPal address.
last line of his sig where it says: Grateful for my help? Send some cash
anon is offline  
Old 03-16-2006   #16
wtms
Supporter
 
Join Date: Mar 2006
Location: East Coast
Posts: 78
Send a message via Yahoo to wtms Send a message via Skype™ to wtms
Default

Casey,

Any chance to see update for version 3.0?
I tried to modify detailed listing page myself but with no luck...

Could you... Please...
wtms is offline  
Old 05-07-2006   #17
jeeplaw
Supporter
 
Join Date: May 2006
Posts: 49
Default

Does anyone have this working for 3.0.4?
jeeplaw is offline  
Old 05-07-2006   #18
Steven Myers
Supporter
 
Steven Myers's Avatar
 
Join Date: May 2006
Posts: 1,178
Default

LOVE this mod, thank you so much for making it, I'll donate in a few days!
__________________
Hosting Feedback - General Web Directory
Steven Myers is offline  
Old 05-09-2006   #19
jeeplaw
Supporter
 
Join Date: May 2006
Posts: 49
Default

Can anyone cofirm that this works for 3.0.4? I'm sort of hesitant in implementing this if there's a chance it might not work..
jeeplaw is offline  
Old 05-09-2006   #20
Neticus
Supporter
 
Neticus's Avatar
 
Join Date: Dec 2005
Posts: 487
Default

This works on 3.04, however it dosen't transalate to the 'more details' page.

You could always remove

<span class="url"> - {$URL|escape|trim}</span> (the bit that does http://www.domain.com}

from the details.tpl

If I figure out how to transalate it to details.tpl I'll post it.
(This is in amateur non-coder time, not proffessional Know-what-to-look-for time)

Anyone else is welcome to give this a bash.
Neticus is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:42 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.