Advertisement:
2by2host

Author Topic: Tagging System For Topics (2.4.3 Released)  (Read 227925 times)

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,386
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Re: Tagging System For Topics
« Reply #40 on: December 28, 2006, 09:57:00 PM »
gr8 mod. However during some heavy testing i gave it, it threw up an error in my error log when there are no tags and I visit the tags screen.  When there are tags, this error does not appear.

On a complete brand spanking new install of SMF 1.1.1 (no mods, no custom skins) hosted on VPS. PHP running i think is 5.1.  Hope this helps.

Code: [Select]
admin   Today at 04:12:26 PM 
 86.133.78.125     6229d472c780ab62d866886d3ab22a80 
 http://sdvsraw2.com/index.php?action=tags 
2: min() [<a href='function.min'>function.min</a>]: Array must contain atleast one element
File: /home/sdvsraw2/public_html/Sources/Tags.php
Line: 123
 
   admin   Today at 04:12:26 PM 
 86.133.78.125     6229d472c780ab62d866886d3ab22a80 
 http://sdvsraw2.com/index.php?action=tags 
2: max() [<a href='function.max'>function.max</a>]: Array must contain atleast one element
File: /home/sdvsraw2/public_html/Sources/Tags.php
Line: 122
 
   admin   Today at 04:12:19 PM 
 86.133.78.125     6229d472c780ab62d866886d3ab22a80 
 http://sdvsraw2.com/index.php?action=tags 
2: min() [<a href='function.min'>function.min</a>]: Array must contain atleast one element
File: /home/sdvsraw2/public_html/Sources/Tags.php
Line: 123
 
   admin   Today at 04:12:19 PM 
 86.133.78.125     6229d472c780ab62d866886d3ab22a80 
 http://sdvsraw2.com/index.php?action=tags 
2: max() [<a href='function.max'>function.max</a>]: Array must contain atleast one element
File: /home/sdvsraw2/public_html/Sources/Tags.php
Line: 122
 
   admin   Today at 04:12:16 PM 
 86.133.78.125     6229d472c780ab62d866886d3ab22a80 
 http://sdvsraw2.com/index.php?action=tags 
2: min() [<a href='function.min'>function.min</a>]: Array must contain atleast one element
File: /home/sdvsraw2/public_html/Sources/Tags.php
Line: 123
 
   admin   Today at 04:12:16 PM 
 86.133.78.125     6229d472c780ab62d866886d3ab22a80 
 http://sdvsraw2.com/index.php?action=tags 
2: max() [<a href='function.max'>function.max</a>]: Array must contain atleast one element
File: /home/sdvsraw2/public_html/Sources/Tags.php
Line: 122
 
Fixed
SMF For Free -Free SMF Forum hosting.
SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - A Portal System for SMF
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline chinclub

  • Jr. Member
  • **
  • Posts: 108
  • Gender: Female
Re: Tagging System For Topics
« Reply #41 on: December 29, 2006, 09:27:23 AM »
I am using 1.1 RC3   Is it not compatable with that?  I tryed to download and install and kep getting:
"The package you are trying to download or install is either corrupt or not compatible with this version of SMF."

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,386
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Re: Tagging System For Topics
« Reply #42 on: December 29, 2006, 10:16:39 AM »
Tested only on SMF 1.1 to 1.1.1 and currently will only install for those.
SMF For Free -Free SMF Forum hosting.
SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - A Portal System for SMF
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline WhatsUp

  • Semi-Newbie
  • *
  • Posts: 47
    • History Hunters
Re: Tagging System For Topics
« Reply #43 on: January 02, 2007, 07:37:41 AM »
A great mod and it works well:
http://historyhuntersinternational.org/index.php?action=tags

Now I want to add it to a block...

 ;)
History Hunters: http://historyhuntersinternational.org/
Enter: test/test
SMF and TinyPortal

Offline Patxi

  • Semi-Newbie
  • *
  • Posts: 22
    • Eselwelt
Re: Tagging System For Topics
« Reply #44 on: January 05, 2007, 06:22:05 AM »
Hello,

nice mod! propably it would be nice to enhance the mod with a "TAG" BBCode.
Then it would be much easier to make "table of content" topics using the tags.

for example:

you want to create a "table of contents" for your forum:

1. SMF-mods
  1.1 Tools
  1.2 Enhancements

2. SMF-themes
  2.1 light
  2.2 dark

=> so add appropriate tag to your topics
=> in your "table of content" topic would be good to use the BBC:

Code: [Select]
1. SMF-mods
[TAG=tool]1.1 Tools[TAG]
[TAG=enhancement]1.2 Enhancements[TAG]

2. SMF-themes
[TAG=light-theme]  2.1 light[/TAG]
[TAG=dark-theme]  2.2 dark[/TAG]

the generated topic code should then look like:

Code: [Select]
...
<a href="http://www.simplemachines.org/community/index.php?action=tags;id=1" title="2 things tagged with tool">1.1Tools</a>

what do you think? does this make sense?

Offline @ngel

  • Semi-Newbie
  • *
  • Posts: 61
Re: Tagging System For Topics
« Reply #45 on: January 05, 2007, 06:59:13 AM »
Works great.

How is it possible to display an icon (placed in themes\...\images\icons\) in place of [X] ?

Thanks for any hints and tips

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,386
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Re: Tagging System For Topics
« Reply #46 on: January 05, 2007, 11:07:55 AM »
Works great.

How is it possible to display an icon (placed in themes\...\images\icons\) in place of [X] ?

Thanks for any hints and tips

Yes you could. Check in Display.template.php that's were it adds the X for the tags
SMF For Free -Free SMF Forum hosting.
SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - A Portal System for SMF
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline @ngel

  • Semi-Newbie
  • *
  • Posts: 61
Re: Tagging System For Topics
« Reply #47 on: January 05, 2007, 04:18:10 PM »
I see the position of the [ X ] but i don't known by what to replace and which variable to be used.

Thanks for your help

Offline nitins60

  • Sr. Member
  • ****
  • Posts: 838
  • Gender: Male
  • LoVE mAKeS lIFe bEauTIfUL
    • Simple Mobile Forum - SMF
Re: Tagging System For Topics
« Reply #48 on: January 06, 2007, 06:32:33 AM »
It would be cool, if you add option of searching for tags n Search function!

Offline Patxi

  • Semi-Newbie
  • *
  • Posts: 22
    • Eselwelt
Re: Tagging System For Topics
« Reply #49 on: January 06, 2007, 02:14:20 PM »
Hello,

I guess after deleting a topic you don´t remove regading stuff in the "tags_log" table. or am I wrong? (I was just trying this mod). As I see in your code, you will add some more admin control over the tags in future!?

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,386
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Re: Tagging System For Topics
« Reply #50 on: January 06, 2007, 02:21:38 PM »
That tags are not deleted from the table when a topic is deleted.
SMF For Free -Free SMF Forum hosting.
SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - A Portal System for SMF
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline Patxi

  • Semi-Newbie
  • *
  • Posts: 22
    • Eselwelt
Re: Tagging System For Topics
« Reply #51 on: January 07, 2007, 07:10:11 AM »
hi,

is it now possible or easily integrated to search via the Tag itself not the id?
e.g.

instead of
Code: [Select]
http://yourdomain/index.php?action=tags;id=123do it like
Code: [Select]
http://yourdomain/index.php?action=tags;tag=NameOfTagAsText
with the same result-page.
so it would be easier to use it in posts as direct links. (sorry abou my english)



okay, I looked into the "Tags.php" and tried a little bit.

After
Code: [Select]
if (isset($_REQUEST['id']))
{
// Show the tag results for that tag
$id = (int) $_REQUEST['id'];

// Find Tag Name
$dbresult = db_query("SELECT tag FROM {$db_prefix}tags WHERE ID_TAG = $id LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
mysql_free_result($dbresult);

$context['tag_search'] = $row['tag'];
$context['page_title'] = $mbname . ' - ' . $txt['smftags_resultsfor'] . $context['tag_search'];
// Find Results
$dbresult = db_query("
SELECT t.numReplies,t.numViews,m.ID_MEMBER,m.posterName,m.subject,m.ID_TOPIC,m.posterTime, t.ID_BOARD
FROM {$db_prefix}tags_log as l, {$db_prefix}boards AS b, {$db_prefix}topics as t, {$db_prefix}messages as m
WHERE l.ID_TAG = $id AND b.ID_BOARD = t.ID_BOARD AND l.ID_TOPIC = t.ID_TOPIC AND t.ID_FIRST_MSG = m.ID_MSG AND " . $user_info['query_see_board'], __FILE__, __LINE__);

$context['tags_topics'] = array();
while ($row = mysql_fetch_assoc($dbresult))
{
$context['tags_topics'][] = array(
'ID_MEMBER' => $row['ID_MEMBER'],
'posterName' => $row['posterName'],
'subject' => $row['subject'],
'ID_TOPIC' => $row['ID_TOPIC'],
'posterTime' => $row['posterTime'],
'numViews' => $row['numViews'],
'numReplies' => $row['numReplies'],

);
}
mysql_free_result($dbresult);


$context['sub_template']  = 'results';

}

add

Code: [Select]
elseif (isset($_REQUEST['tag']))
{
// Show the tag results for that tag
$context['tag_search'] = $_REQUEST['tag'];

// Find Tag Name

$context['page_title'] = $mbname . ' - ' . $txt['smftags_resultsfor'] . $context['tag_search'];
// Find Results
$dbresult = db_query("
SELECT t.numReplies,t.numViews,m.ID_MEMBER,m.posterName,m.subject,m.ID_TOPIC,m.posterTime, t.ID_BOARD
FROM {$db_prefix}tags_log as l, {$db_prefix}boards AS b, {$db_prefix}topics as t, {$db_prefix}messages as m
    JOIN {$db_prefix}tags AS TA ON (TA.ID_TAG = l.ID_TAG)
WHERE TA.tag = '" . $context['tag_search'] . "' AND b.ID_BOARD = t.ID_BOARD AND l.ID_TOPIC = t.ID_TOPIC AND t.ID_FIRST_MSG = m.ID_MSG AND " . $user_info['query_see_board'], __FILE__, __LINE__);

$context['tags_topics'] = array();
while ($row = mysql_fetch_assoc($dbresult))
{
$context['tags_topics'][] = array(
'ID_MEMBER' => $row['ID_MEMBER'],
'posterName' => $row['posterName'],
'subject' => $row['subject'],
'ID_TOPIC' => $row['ID_TOPIC'],
'posterTime' => $row['posterTime'],
'numViews' => $row['numViews'],
'numReplies' => $row['numReplies'],

);
}
mysql_free_result($dbresult);


$context['sub_template']  = 'results';
}

and you can use the tag function directly from a link:

http://yourdomain/index.php?action=tags;tag=OneTagText

but I´m no php programmer. nether than mysql.

=> so propably this is a security risk for sql injection!? how can I fix this?
=> does this make problems if wrong tags are used?

Thanks for help,
Patxi
« Last Edit: January 07, 2007, 09:37:13 AM by Patxi »

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,386
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Re: Tagging System For Topics
« Reply #52 on: January 07, 2007, 09:53:35 AM »
Yeah that would lead to an injection
find
Code: [Select]
$context['tag_search'] = $_REQUEST['tag'];
Change to
Code: [Select]
$context['tag_search'] = htmlspecialchars($_REQUEST['tag'],ENT_QUOTES);
SMF For Free -Free SMF Forum hosting.
SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - A Portal System for SMF
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline Patxi

  • Semi-Newbie
  • *
  • Posts: 22
    • Eselwelt
Re: Tagging System For Topics
« Reply #53 on: January 07, 2007, 10:43:15 AM »
Thanks vbgamer45 !

I just tried to add a bbcode to this system and added this code to the Subs.php in the function parse_bbc
Code: [Select]
array(
'tag' => 'tag',
'type' => 'unparsed_content',
'content' => '<a href="http://yourdomain/index.php?action=tags;tag=$1">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
),
array(
        'tag' => 'tag',
        'type' => 'unparsed_equals',
        'before' => '<a href="http://yourdomain/index.php?action=tags;tag=$1">',
        'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
      ),

It´s not very good coding. I was not quite sure how to replace the YOURDOMAIN code with a variable.

with this, you can Link to the TAG site via
[tag]YourTagText[/tag]
or
[tag=YourTagText]something other text[/tag]

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,386
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Re: Tagging System For Topics
« Reply #54 on: January 07, 2007, 10:45:35 AM »
Replace
http://yourdomain/index.php?action=tags
With
' . $scripturl . '?action=tags
SMF For Free -Free SMF Forum hosting.
SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - A Portal System for SMF
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline Patxi

  • Semi-Newbie
  • *
  • Posts: 22
    • Eselwelt
Re: Tagging System For Topics
« Reply #55 on: January 07, 2007, 10:59:47 AM »
incredible! quite fast your response!

Offline @ngel

  • Semi-Newbie
  • *
  • Posts: 61
Replacement of the [ X ] with an icon/image
« Reply #56 on: January 07, 2007, 11:17:40 AM »
After some test, i found my solution.

If you want to replace the [ X ] with an icon/image (in my case : delete_tag.png), do this in the file "Display.Template.php" in your "Themes\[your theme]\":

replace
Code: [Select]
echo '<a href="' . $scripturl . '?action=tags;sa=deletetag;id=' . $tag['ID']  . '"><font color="#FF0000">[X]</font></a>&nbsp;';
with
Code: [Select]
echo '<a href="' . $scripturl . '?action=tags;sa=deletetag;id=' . $tag['ID']  . '"><img src="' . $settings['images_url'] . '/delete_tag.png" alt="" border="0" width=12 height=13/></a>&nbsp;';
If you want to use an alternate name, use this (you need to create the $txt['smftags_deletethistag'] = "delete this tag" entry in your "Modifications.[language].php" :
Code: [Select]
echo '<a href="' . $scripturl . '?action=tags;sa=deletetag;id=' . $tag['ID']  . '"><img src="' . $settings['images_url'] . '/mir_delete_tag.png" alt="' . $txt['smftags_deletethistag'] . '" border="0" width=12 height=13/></a>&nbsp;';
Your icon/image must be set in your "Themes\[your theme]\images". I resized the icon/image too.

Below, the result ;-)
« Last Edit: January 07, 2007, 12:12:19 PM by @ngel »

Offline Slack

  • Jr. Member
  • **
  • Posts: 297
    • WeenieCampbell.com
Re: Tagging System For Topics
« Reply #57 on: January 08, 2007, 07:06:23 PM »
Great mod - thank you very much.

We've been playing around and we are getting some empty tags listed in the Tag Cloud page.  How do we get rid of these tags?

Is it possible to alphabatize the Tag listing in the Cloud page?  Would make it easier to track down and use.

Thanks again,
slack

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,386
    • smfhacks on Facebook
    • @createaforum on Twitter
    • SMF For Free
Re: Tagging System For Topics
« Reply #58 on: January 08, 2007, 07:07:35 PM »
Empty tags hmm. You would need to find the topic that posted them and delete them from there.
SMF For Free -Free SMF Forum hosting.
SMFHacks.com -  Paid Modifications for SMF

Latest Mod:
EzPortal - A Portal System for SMF
Community Suite
Newsletter Pro SMF Gallery Pro SMF Classifieds SMF Store

Offline Slack

  • Jr. Member
  • **
  • Posts: 297
    • WeenieCampbell.com
Re: Tagging System For Topics
« Reply #59 on: January 08, 2007, 07:19:18 PM »
Empty tags hmm. You would need to find the topic that posted them and delete them from there.

Hmm, Well, one of our moderators deleted the posts from our Recycle bin (eg they posts are permanently gone)  :P -- so I'd have to delete them directly from the database then?