It looks like you're new here. If you want to get involved, click one of these buttons!
Is there a way of showing tags created for a thread, under the discussions title on main forum index page ?
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
Comments
If you copy
/applications/vanilla/views/discussions/helper_functions.phpto
/themes/[YOURTHEME]/views/discussions/helper_functions.phpyou can add the tags string to the discussions by adding:
if($Discussion->Tags != '') { echo '<span class="DiscussionTags">Tags: '.$Discussion->Tags.'</span>'; }directly before
$Sender->FireEvent('DiscussionMeta');located at the bottom of the file.
Tried that, but does not display:
I have:
if (C('Vanilla.Categories.Use') && $Discussion->CategoryUrlCode != '') echo Wrap(Anchor($Discussion->Category, '/categories/'.rawurlencode($Discussion->CategoryUrlCode), 'Category')); if($Discussion->Tags != '') { echo 'Tags: '.$Discussion->Tags.''; } $Sender->FireEvent('DiscussionMeta');♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
Strike that it does work ! Apologies...
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
Would be nice to make them clickable.
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
Somehow think i need to use this:
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
So need to:
SO far I have.
if($Discussion->Tags != '') { echo ''.$Discussion->Tags.''; }Obviously, the tagWrap wraps all tags, not each tag with css. So need to fix that. Also need to add url to each tag
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
Try this:
if($Discussion->Tags != '') { $Tags = explode(' ',$Discussion->Tags); $String = ""; foreach($Tags as $t) { $String .= "<a href='index.php?p=discussions/tagged/".rawurlencode($t)."'>$t</a> "; } echo '<span class="DiscussionTags">Tags: '.$String.'</span>'; }The above is assuming you are NOT using URL Rewriting. If you are, change the $String variable in the foreach loop to:
$String .= "<a href='discussions/tagged/".rawurlencode($t)."'>$t</a> ";hahah you are good. Cheers. Will get styling, and post screeny soon. Cheers !!!
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
For anyone in the future looking to do this; here is a slightly less hackish way that will automatically adjust for rewrite URLs being either on or off:
`
`
Do you know what the code would be to also add tags to first post in thread ?
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
Move:
/applications/vanilla/views/discussion/helper_functions.phpTo:
/themes/[YOURTHEME]/views/discussion/helper_functions.phpAdd:
<? if($Sender->Discussion->Tags != '' && $Type != 'Comment') { $Tags = explode(' ',$Sender->Discussion->Tags); $String = ""; foreach($Tags as $t) { $String .= "<a href='"; $String .= (strstr($Sender->Form->Action, "index.php?p=") ? "index.php?p=" : ""); $String .= "discussions/tagged/".rawurlencode($t)."'>$t</a> "; } echo '<span class="DiscussionTags">Tags: '.$String.'</span>'; } ?>Directly Before:
<div class="CommentInfo">@kastang i will try this first thing in the mornng, thanks mate
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
@kastang , works perfectly. Small adjustment to String, and its perfect. Thanks.
♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads
@kastang
I was looking for this as well. But I don't see
<div class="CommentInfo">in helper_functions.phpHas it changed recently? Could you help me figure out where to insert this. I'm on Vanilla 2.0.18.3. Sorry I'm not a php developer. Thanks for your help.