Tagging System For Topics

Started by SMFHacks.com Team, December 19, 2006, 10:59:20 AM

Previous topic - Next topic

glennk

I have been using this mod for a couple of years and built up a considerable list of tagged topics. I use them to link to topics relating to a specific topic of conversation. I link to the tags from areas of my static site.

Recently I upgraded this mod. Sadly I note that the urls have changed ??? And so all my links into the tags are now of no use.

/forum/?action=tags;id=28

Has now become

forum/index.php?action=tags;tagid=28

Could you advise me if there is anyway I can alter the code to go back to the first url.

viulian

I am also about to upgrade Tagging System. My version does not strip spaces after the separator comma - and usually people do put spaces "tag1, tag2" and then the first tag is "tag1 " which is considered different than "tag1".

vbgamer45

Quote from: glennk on October 19, 2008, 05:28:03 AM
I have been using this mod for a couple of years and built up a considerable list of tagged topics. I use them to link to topics relating to a specific topic of conversation. I link to the tags from areas of my static site.

Recently I upgraded this mod. Sadly I note that the urls have changed ??? And so all my links into the tags are now of no use.

/forum/?action=tags;id=28

Has now become

forum/index.php?action=tags;tagid=28

Could you advise me if there is anyway I can alter the code to go back to the first url.
That's how it has allways been index.php?action=tags;tagid=28
Even without the index.php that old url would still work.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

glennk

Thanks for your reply.

The first url just seems to take me to the recently tagged page whereas the second one takes me to the list of topics for tag 28, which is where the first url used to take me.

http://www.whitbyseaanglers.co.uk/forum/?action=tags;id=28


Not sure why this update is creating different urls ?? Could it be anything to do with the update of the pretty url mod ?


vbgamer45

Yeah we change the urls from id to tagid because there was an issue with mod_security blocks ;id in the url
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

glennk

Ok. Is there anything I can do to revert to the old syatem, or should I change the links to the new ones  and 301 the old ones ?

Thanks Glenn

vbgamer45

Quote from: glennk on October 19, 2008, 03:51:53 PM
Ok. Is there anything I can do to revert to the old syatem, or should I change the links to the new ones  and 301 the old ones ?

Thanks Glenn
You could modify the code but for each update for the tag system you would need to redo those changes.

I would change the links to the new ones and redirect the olds ones.
Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

viulian

I've just finished the upgrade (to 1.1.1) and it works!

However, I had to do some tweaks to the code to suite my needs:
1) it did not put the tags to lower case and trim them. "tag1, tag2" added to the list of tags when creating a new post means creating the second tag as " tag2" with a space before, and will not find if other "tag2" or "Tag2" where entered before.

For these I've modified:

Tags.php:

Inserted:
$tag = trim(strtolower($tag)); after
      if (empty($tag))
                fatal_error($txt['smftags_err_notag'],false);


Post.php:

Inserted:
$tags = array_map('strtolower', array_map('trim', $tags)); after
$tags = explode(',',htmlspecialchars($_REQUEST['tags'],ENT_QUOTES));

Also, I had to cleanup the duplicates that were previously created, and for these I did these steps:

a) Ran two SQL queries using phpmyadmin:

update {$db_prefix}tagstags set tag=trim(tag)
update {$db_prefix}tagstags set tag=lower(tag)


(this trims and lower cases the tag list).

b) Ran this small script from the folder's directory (this script is not thoroughly tested though, but seems to work for me):

<?php
       
require "SSI.php";

       
$result = mysql_query("SELECT * FROM {$db_prefix}tags",$db_connection);
       
$tags = array();
       while (
$myrow = mysql_fetch_assoc($result))
       {
               if (isset(
$tags[$myrow['tag']]))
               {
                       
$previd = $tags[$myrow['tag']];
                       
$currid = $myrow['ID_TAG'];
                       
mysql_query("UPDATE {$db_prefix}tags_log set ID_TAG=$previd WHERE ID_TAG=$currid");
                       
mysql_query("DELETE FROM {$db_prefix}tags where ID_TAG=$currid");
               }
               else
                       
$tags[$myrow['tag']] = $myrow['ID_TAG'];
       }

       
mysql_free_result($result);
?>


Lastly, I found out that removing a topic from the trash does not also clear its tags from the database (will investigate why) and post back. Also, if you get an error when posting and the forum redirects you back to the post, the value for the subject is kept, but the value for the tags is not kept after the page is reloaded. Will also investigate this and post back.

glennk

Quote from: vbgamer45 on October 19, 2008, 03:55:36 PM
Quote from: glennk on October 19, 2008, 03:51:53 PM
Ok. Is there anything I can do to revert to the old syatem, or should I change the links to the new ones  and 301 the old ones ?

Thanks Glenn
You could modify the code but for each update for the tag system you would need to redo those changes.

I would change the links to the new ones and redirect the olds ones.

Thanks for your help. I will change the urls to avoid future problems.

Great mod by the way.

Best Regards - Glenn


Pwn Kyuubi

Quote from: NIBOGO on October 23, 2008, 10:06:24 PM
Spanish Translation

I need for spanish_es what can i do?

this works for smf 2.0beta4 ?

Sorry Im novice in this  :-[



glennk

Not sure whats gone wrong but I am currently unable to add tags and keep getting this error

No topic selected.

glennk

Currently getting this error in 2b4

Fatal error: Cannot redeclare autosuggest_search_tags() (previously declared in /home/glennk/public_html/forum/Sources/Subs-Editor.php:1697) in /home/glennk/public_html/forum/Sources/Subs-Editor.php on line 1768

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

edi67

This mod is very useful but is possible have MORE BLANK space around the TAG WORDS? because having many TAGS these show everybody near and attached there is confusion reading them, some white space around words TAG will be very more nice to view and clean for read
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

vbgamer45

Community Suite for SMF - Grow your forum with SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com - Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

edi67

yes, as you can see TAGS are all near and words are in confusion , users cannot read them better, may be adding space around words and have more blank space arount them, reading these words will be more clean
look scree
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Advertisement: