![]() |
| |||||||
| Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum. |
![]() |
| | Thread Tools | Display Modes |
| | #1 |
| 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 | |
| |
| | #2 |
| 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 | |
| |
| | #3 |
| 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 | |
| |
| | #4 |
| Oh no! I'm so sorry. David give Casey my donation please. :lol: __________________ Wenchie | |
| |
| | #5 |
| Join Date: Jan 2006 Posts: 9 | 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 |
| |
| | #6 |
| Join Date: Jan 2006 Posts: 9 | 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 |
| |
| | #7 |
| Join Date: Oct 2005 Posts: 34 | 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'); # |
| |
| | #8 |
| 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 | |
| |
| | #9 |
| Join Date: Oct 2005 Posts: 34 | Anyone online available to help right now? I just need help on the phpMyAdmin step. |
| |
| | #10 | |
| Supporter Moderator Join Date: Dec 2005 Location: Cluj-Napoca/Sighisoara (Romania) Posts: 4,468 | Quote:
Please post your question/problem, I am here and will help you. Boby __________________ wanna say thank you?
| |
| |
| | #11 |
| Join Date: Oct 2005 Posts: 34 | 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. |
| |
| | #12 |
| Administrator phpLD Administrator Supporter Join Date: Jan 2005 Posts: 11,667 | Defintely backup your database first. Then yes, replace what is in the box with this. __________________ Helpful Links: templates supporters forum █ follow me on twitter █ Quality Guidelines for Directories █ Recommended Host |
| |
| | #13 |
| Join Date: Oct 2005 Posts: 34 | Ok, thanks. I figured out the problem. I needed to click on the GO button after pasting that stuff in the white box. |
| |
| | #14 | |
| Supporter | Quote:
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. | |
| |
| | #15 | ||
| Supporter | Quote:
| ||
| |
| | #16 |
| Supporter | 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... |
| |
| | #17 |
| Supporter Join Date: May 2006 Posts: 49 | Does anyone have this working for 3.0.4? |
| |
| | #18 |
| Supporter Join Date: May 2006 Posts: 1,178 | LOVE this mod, thank you so much for making it, I'll donate in a few days! |
| |
| | #19 |
| Supporter Join Date: May 2006 Posts: 49 | 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.. |
| |
| | #20 |
| Supporter Join Date: Dec 2005 Posts: 487 | 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. |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|