Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
1.3k views
in Q2A Core by
edited by

Hi everyone,

HELP: Where can I Edit => "Popular Tags"?

I am looking for the file to edit "Popular Tags"  in order to uppercase Popular Tags' urls! (in my new q2a, because I already uppercase Tags urls everywhere, but popular tags are still in lower case).

Thanks for your answer!

1 Answer

+3 votes
by
selected by
 
Best answer
Well, I'm not sure how you're uppercasing tags right now so that you don't uppercase all of them. If I wanted to uppercase all of them I would do the following:
 
1. Look for qa_tag_html function in qa-app-format.php file
2. Replace the whole function with:
 
/*
Convert textual $tag to HTML representation, with microformats if
$microformats is true. Set $favorited to true to show the tag as favorited
*/
 
function qa_tag_html($tag, $microformats=false, $favorited=false) {
    if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
 
    $uppercaseTag = function_exists('mb_strtoupper')
        ? mb_strtoupper($tag, 'UTF-8')
        : strtoupper($tag);
 
    return
        '<a href="'.qa_path_html('tag/'.$uppercaseTag).'"'.
        ($microformats ? ' rel="tag"' : '').' class="qa-tag-link'.
        ($favorited ? ' qa-tag-favorited' : '').'">'.
        qa_html($tag).'</a>';
}
 
This should uppercase only the URLs but leave the texts the way they come from the core... which if you haven't performed any core hack should come in lowercase.
 

In order to change the tags in the Tag Cloud widget plugin you need to change file qa-tag-cloud.php. Locate function output_widget and add the lines in green and remove the ones in red:

$uppercaseTag = function_exists('mb_strtoupper')
    ? mb_strtoupper($tag, 'UTF-8')
    : strtoupper($tag);
 
if (($size>=5) || !$scale)
    $themeobject->output('<a href="'.qa_path_html('tag/'.$tag).'" style="font-size:'.$size.'px; vertical-align:baseline;">'.qa_html($tag).'</a>');
    $themeobject->output('<a href="'.qa_path_html('tag/'.$uppercaseTag).'" style="font-size:'.$size.'px; vertical-align:baseline;">'.qa_html($tag).'</a>');
 
by
Hi Pupi, No, it's not working, I already done that but your code only uppercase Tags url, but forget to uppercase "Popular tags url" in the sidepanel, so my question is where can I edit this?
by
Ok, you meant the tag cloud plugin. The title from that plugin happens to be shared with the title in the tags section. "sidepanel" was the keyword. I've just updated the answer
by
edited by
Oh thats its! I didn't think it was a plugin, so I was looking on the wrong file, thanks a lot! PS: I find an easy way bu adding "stroupper"
by
strtoupper is OK if you know you won't have special characters in the tags (actually, multibyte characters). If you are not 100% sure about that then mb_strtoupper is the right way to go. However, mb_strtoupper might not be installed in every server so you need to check for its existance before using it and, if it doesn't exist, then fall back to strtoupper. I played with it with some Chinese characters and it DID make a huge difference
...