View Full Version : link counter
rmvannoort
11-25-2006, 09:19 PM
On my website http://www.turkijelinks.nl I have a directory named Ataturk. The strange thing is, that this directory doesnt count the underlying links. Do you have any idea how come?
Dave Baker
11-25-2006, 09:41 PM
Hello rmvannoort,
I have visited your directory and all seems normally.
Total of links displayed in statistics 157
Total of links displayed in user side 157
rmvannoort
11-28-2006, 07:19 PM
Thanks for your reply.
I mean something else. When you look at my homepage you see the directory link 'Ataturk'. After this link you see (0). This is not correct because there are 3 underlying directories with a total of 19 links.
Best regards,
Ricardo
Sergey Ten
11-28-2006, 10:16 PM
Hi, Ricardo!
May be you have the problem with table flat_structure. Please create the php file with follow code and run it on your server.
<?php
require_once('includes/config.inc.php');
require_once('classes/DirDb.php');
$db = new Database();
$db->mDbhost = $gDirConfig['dbhost'];
$db->mDbname = $gDirConfig['dbname'];
$db->mDbuser = $gDirConfig['dbuser'];
$db->mDbpwd = $gDirConfig['dbpwd'];
$db->connect();
$sql = "TRUNCATE TABLE `{$gDirConfig['prefix']}flat_structure`;";
$db->query($sql);
// Get categories
$sql = "SELECT `id`,`id_parent` FROM `{$gDirConfig['prefix']}categories` WHERE `id_parent` > -1";
$cats =& $db->getAll($sql);
if ($cats)
{
foreach ($cats as $key => $value)
{
$sql = "INSERT INTO `{$gDirConfig['prefix']}flat_structure` (`id_parent`,`id_category`)";
$sql .= "VALUES ('{$value['id']}', '{$value['id']}')";
$db->query($sql);
add_flat($value['id'], $value['id_parent']);
}
}
function add_flat($id, $id_parent)
{
global $db;
global $gDirConfig;
// Insert record into "flat" table
$sql = "INSERT INTO `{$gDirConfig['prefix']}flat_structure` (`id_parent`,`id_category`)";
$sql .= "VALUES ('{$id_parent}','{$id}')";
$db->query($sql);
// Check if parent > 0 and call itself recursively
if ($id_parent > 0)
{
// Get parent's parent
$sql = "SELECT `id_parent` FROM `{$gDirConfig['prefix']}categories` WHERE `id` = {$id_parent}";
$id_parent2 = $db->getOne($sql);
add_flat($id, $id_parent2);
}
}
?>
rmvannoort
11-29-2006, 08:28 PM
Thanks! Maybe a foolish question, but which file do I need to override on my server?
Regards,
Ricardo
Michael Hill
11-30-2006, 06:16 AM
Hi, Ricardo!
Don't override any file. You have to create (for example) flat.php file in directory with script's files and insert code above. Then save it and run from your browser as your_script_url/flat.php.
rmvannoort
11-30-2006, 07:38 PM
Thanks Michael. It works :)
Regards,
Ricardo
Michael Hill
12-01-2006, 08:45 AM
Allways at yor services! Do not hesitate to ask our support team!
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.