dhakim

MySQL Query to find tag rank

Vote 0 Votes

Hi,

Does anyone know the query for how to find the tag rank for the tags in mt? I can make the count query to mt_tag table but that will just return me number of time a tag record present in the database but not the rank.

Can anyone help me please? Following doesn't work.

SELECT count(tag_id) as num, tag_name FROM `mt_tag` group by tag_name order by num desc

Thanks,
Danish

Reported on Movable Type 4.261

10 Replies

| Add a Reply
  • Hi Danish,

    You could reconstruct the query following the logic from:
    _hdlr_tag_rank

    However, why don't you use the tag:

    <$mt:TagRank$>

    Eventually with the max argument, like this:

    <$mt:TagRank max="10"$>

    ----------------------------------
    Mihai Bocsaru

    Web Development
    Movable Type Consulting
    Six Apart Partner

    http://www.pro-it-service.com/
    ----------------------------------

    Movable Type Demo
    http://www.movabletypedemo.org/

  • Hi Mihai,

    Actually I need to create a RSS Atom Feed for my blogs tags, which is the requirement of one of our clients. I am making the feed in PHP, which I think is easier for me to work with then MT code. So, what is _hdlr_tag_rank and where I can find it in which table of db?

    Thanks,
    Danish

  • Hi Danish,

    You could see the logic behind it written in PERL on:
    /lib/MT/Template/Tags/Tag.pm

    Kind Regards,
    Mihai Bocsaru

  • Miahi,

    I can't find MT in /lib/. Can't you tell me the way the tag rank is calculated? Appreciate your help.

    Thanks,
    Danish

  • Which exact version of movable type are you using?

  • I am using Movable Type Enterprise version 4.21-en with: Community Pack 1.6, Enterprise Pack 1.1, Professional Pack 1.2

  • If that's the case, then look at:

    /lib/MT/Template/ContextHandlers.pm

    Look for:
    =head2 TagRank

    Read that and continue with:
    sub _hdlr_tag_rank

    Cheers,
    Mihai

  • Mihai,

    I can't find MT in /lib/

    sixapart@sixapart1:/lib$ cd MT
    -bash: cd: MT: Aucun fichier ou dossier de ce type
    sixapart@sixapart1:/lib$

    Is this the correct path to the perl script?

    Thanks,
    Danish

  • sixapart@sixapart1:~$ cd /
    sixapart@sixapart1:/$ ls
    bin boot dev etc home initrd initrd.img lib lib64 lost+found media mnt opt proc root sbin srv sys tmp usr var vmlinuz
    sixapart@sixapart1:/$ cd lib
    sixapart@sixapart1:/lib$ cd MT
    -bash: cd: MT: Aucun fichier ou dossier de ce type
    sixapart@sixapart1:/lib$

    Can't find MT ... :). I don't know why.

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1774 6167

Last Topic: Template modules by Zielun on Feb 16, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1434 5088

Last Topic: Maintenance announcement by Nick on Feb 17, 2012

695 2912

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

174 740

Last Topic: Captcha images rendering slowly by ScottM on Feb 12, 2012

190 568

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012