![]() |
![]() |
![]() |
|
|||||||
| Modifications Simple to complex modifications, made by users or by our team, applied to logic or presentation, all kinds of modifications are discussed and requested here. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Sep 2005
Posts: 1,421
![]() |
Greetings all,
today I have been searching through forums looking for old unanswered posts. And I found several request to implement a mod like stated in subject. Note: this mod is only useful if you have mod_rewrite turned ON. Let me explain what the mod is and how to implement it. Imagine you have a directory in www.mydomain.com/dir/ with two (just an example) top level categories with one subcategory in each main category, like this: Cat_1 \ Subcat_1 Cat_2 \ Subcat_2 Also, let's assume that there is one link in Subcat_1 titled "Test Link" [ID=1]. As you know each listing has a "Link Details" link that leads to a page with detailed link information. Typically, the URL of this link looks like this: http://www.mydomain.com/dir/Cat_1/Subcat_1/test-link-l1.html Now imagine, that you move this link from Cat_1/Subcat_1/ to Cat_2/Subcat_2/ In this case the "Link Details" URL will look like this: http://www.mydomain.com/dir/Cat_2/Subcat_2/test-link-l1.html Finally, imagine that by the time you move the link Google has indexed your pages and assigned some PageRank to this link's details page. After you move the link, the previous Link Details page is now invalid. The result: You loose PageRank. In order for the links to be consistent no matter how you move them between categories it would be good to have Link Details URLs like this: http://www.mydomain.com/link-detail-ID.html where ID is the ID of the link, which in our case will look like http://www.mydomain.com/link-detail-1.html Ok, I think this info is enough to get the point of the mod. Let get down to the mod itself... 1. Modify link-display.tpl Open link-display.tpl (I use GreenLeaves), find this piece: Code:
{if $config.mod_rewrite}
<a href="{$config.base}{$config.dir}{$link.path}/{convert_str string=$link.title}-{$link.id}.html">{$lang.link_details}</a>
{else}
<a href="{$config.base}{$config.dir}view-link.php?id={$link.id}">{$lang.link_details}</a>
{/if}
Code:
{if $config.mod_rewrite}
<a href="{$config.base}{$config.dir}link-details-{$link.id}.html">{$lang.link_details}</a>
{else}
<a href="{$config.base}{$config.dir}view-link.php?id={$link.id}">{$lang.link_details}</a>
{/if}
This will change the URL of Link Details link. You can check it by refreshing any listing page and hovering your mouse over any "Link Details" link. But this change alone is not enough. Now we have to redirect link-details-ID.html to PHP file. This is done with .htaccess Open .htaccess file, find this rule: Code:
# mod_rewrite rules for view link page RewriteRule ^(.*)/(.*)-([0-9]+).html$ view-link.php?cat=$1&title=$2&id=$3 [QSA,L] Code:
# mod_rewrite rules for view link page RewriteRule ^link-details-([0-9]+).html$ view-link.php?id=$1 [QSA,L] Now we have to tweak view-link.php slightly to correctly display category title/path. Open view-link.php, find this snippet: PHP Code:
PHP Code:
That's it there is to it. Play with it and see what happens. Last edited by Vincent Wright; 09-07-2006 at 06:36 PM. |
|
|
|
|
|
#2 |
|
'--------.
|
Vincent,
It's good idea, thank you.. but, there is a small mistake in step 2 [.htaccess] file.. [QSA,L] <-- the mistake in line #2! find: Code:
# mod_rewrite rules for view link page RewriteRule ^(.*)/(.*)-([0-9]+).html$ view-link.php?cat=$1&title=$2&id=$3 [QSA,L] Code:
# mod_rewrite rules for view link page RewriteRule ^link-details-([0-9]+).html$ view-link.php?id=$1 [QSA,L] |
|
|
|
|
|
#3 |
|
Join Date: Sep 2005
Posts: 1,421
![]() |
Ah, yes.
Thanks Samhan. I have edited the post. |
|
|
|
|
|
#4 |
|
Join Date: Dec 2005
Posts: 436
![]() |
That's way too cool. Thanks a lot, I almost forgotten and given up on this, that was my dream ever since I started with eSyndicat.
__________________
regards,Tom |
|
|
|
|
|
#5 |
|
Join Date: Sep 2005
Posts: 1,421
![]() |
I'm glad this mod turns out to be useful
![]() |
|
|
|
|
|
#6 | |
|
Join Date: Nov 2005
Location: Switzerland
Posts: 306
![]() |
Quote:
Indeed! Very useful! But I guess there is a small problem with it: When you click on a crosslink, e.g.: http... then take: @ Wie werden Evaluationsprojekte erfolgreich? Link detail changes its category location to the original one. In my case I clicked the crosslink here: buecher/methoden/allgemein-kurz but link details are shown here: _Qualifikationsarbeiten/Dissertationen/ (not visible at the URL, but at the navigation bar just above the link details). I guess visitors do not recognize this difference (they even do not know that @ means crosslinks), but are confused because they are in a different category then with different links and different topics. Of course they can click the browse-back-button, but if confusion could be avoided it would be better I think. The behaviour before your mod was different: Link details where located in the category a visitor came from, and I guess such a behaviour would be more logical, or what do you think? Greetings, Lars Last edited by lsb; 05-12-2007 at 11:12 PM. |
|
|
|
|
|
|
#7 |
|
Join Date: Feb 2006
Posts: 80
![]() |
Very nice mod! So glad that you guys doing this for the users.
|
|
|
|
|
|
#8 |
|
Join Date: Sep 2005
Posts: 1,421
![]() |
to lsb
First of all, this is how eSyndiCat works and has nothing to do with this mod. And I believe this is how major directories (like DMOZ) work as well. This is even how Linux and Windows work: when you click an alias (filesystem link) you get to where the link points. |
|
|
|
|
|
#9 | |
|
Join Date: Nov 2005
Location: Switzerland
Posts: 306
![]() |
Quote:
to say it clearly: I love this mod, it is a cool feature! I guess I possibly was not clear enough with my issue. The behaviour of the script has changed after the mod: Before the mod a click on details of a crosslink (and only in the case of crosslinks it is important) of course opened the details-page, but this detail page was always located within the category a user comes from. E.g. if a link fits to 5 categories simultanously (and that is what crosslinks are about I think) the detail-pages were located in 5 different categories (visible at the navigation line, in my example "Evaluation Portal: Bücher » Methoden » allgemein (kurz) » Buch betrachten" or "Evaluation Portal: Bücher » _Qualifikationsarbeiten » Dissertationen » Buch betrachten" etc. for the same link depending on the location where you come from. After the mod the same detail-pages are "only" located at one place:At the place the link is originally located. If one comes from category1-subcategory2 and then clicks on a detail page of a crosslink, he lands at category1-subcategory1 if the link originally is located there. And if he comes from category12-subcategory3-subcategory4 and clicks on the same link there, he also lands at category1-subcategory1 (see navigation-line). And this behaviour is new (just after the mod). But I guess the original behaviour is more logical for users. Was I clear enough so it is possible to understand what I mean? Greetings, Lars Last edited by lsb; 09-09-2006 at 09:40 AM. |
|
|
|
|
|
|
#10 |
|
Join Date: Sep 2005
Posts: 1,421
![]() |
Ah, sorry, I was wrong then.
I think this is the case because by default path information is passed along with link id, that's why it is possible to display category breadcrumb. But after you apply the mod only link id is passed that's why the original path is displayed. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|