Template : Hot News
I don't know for sure if this is a bug, here is what i found :
When I edit the link, after click submit, the link became with a number after this (To solve the duplicate URL)
For examples :
Before edit, the link is :
linkraovat.com/trang-suc-my-pham-phu-kien/trang-suc-nam-soi-bac/
But after update or edit the link, it is :
linkraovat.com/trang-suc-my-pham-phu-kien/trang-suc-nam-soi-bac-1
This is not good for google to index the site, or for those who copy the link for other user to see the story.
I think we need to update the function makeUrlFriendly in Utils.php. We need to check if there is any story that is not the same id and have the same url like the story we edit, we just changed, if no, just leave it alone.
So this is what i have changed :
1/ Add a new function in Utils.php called function
makeUrlFriendlyEdit($input,$id)
2/ This function is copied exactly from the function makeUrlFriendly with a modification in the last when checking duplicate.
PHP Code:
if(function_exists('utils_makeUrlFriendlyEdit')) {
$output = utils_makeUrlFriendly($output,$id);
}
// check to see if the story title already exists. If so, add an integer to the end of the title
$n = $db->get_var("SELECT count(*) FROM " . table_links . " WHERE link_title_url like '$output%' and link_id <> '$id'" );
if ($n > 0) {
return $output . "-$n";}
else {
return $output;
}
I tested it on my site, it worked okie. If you found something that is not good, please tell me know.
Thanks for your reading
P/s : Sorry for my not good English
Visit my site : Link Rao Vặt / Link HOT




Linear Mode




