PDA

View Full Version : Advice Needed: Handling Link Count The Right Way


Vincent Wright
09-08-2006, 05:22 AM
Greetings all,

recently several customers reported problems with link count. Namely, counts differ in admin panel and user front end.

I started to expore the problem and that's what I found out.

Counts show the same number of links in both user pages and admin pages until you start copying links, i.e. creating cross links, or duplicating links.

This is where problems start to arise.

Admin panel counts all the links, without differentiating originals and copies. Whereas front-end only takes into account original links and ignores copies.

So, we need your opinion on what you think would be the best practice in counting links. Should it count only original links (in admin panel as well as on site pages) or should it count all the links?

Thanks in advance.

WTM
09-08-2006, 05:37 AM
I would think it should be total amount of links including crossed.

When you open certain category - you see related links in there and I don't really care if this link is listed in other category also.
What I do care is how many links I have in this particular category.
So I think all links should be added and counted as individual.

Did I make any sense?

Vincent Wright
09-08-2006, 05:58 AM
Sure, what you say does make sense. I lean towards this way as well.

Let's see what others have to say about it.

safatweb
09-08-2006, 11:35 AM
me too agree with it :), but can u tell me in flat_structure why each record is listed 5 times. (5 copy of same record)

Vincent Wright
09-08-2006, 12:10 PM
This is probably because you executed convert_flat.php several times: this file has a little flaw -- it DOES NOT clean dir_flat_structure before filling it again.

Cougar
09-09-2006, 03:31 AM
I would have to agree with WTM. The total # of links, including crossed would be fine on the outside as well. It does inflate the total link count, but does that matter? I don't think so...

Btw, thanks for fixing my category counts Vincent :good:

Cheers!
Mike

Vincent Wright
09-09-2006, 08:04 AM
In order to count cross-links as well you have to do this...

Open classes/Dir.php, find the function getNumLinks() and change the first line:


$sql = "SELECT COUNT(DISTINCTROW t4.`id`) num_links ";


to


$sql = "SELECT COUNT(t4.`id`) num_links ";


Save changes and close the file.

Mark Brookes
09-09-2006, 01:14 PM
Hi Vincent:

Concerning link counts. Would you try
* moving a category so that it is a sub category of another
* moving a subcategory from one parent category to another parent category.

The reason is ... I don't think the parent categories calculate the correct number of links after sub categories are moved around.

- If you can repeat this count error then I guess it is a general problem. Otherwise I guess it is a result of my various changes and experiments.

regards
Mark