Sorting Issue With Incremental Content Plugin

Discussion in 'Integration' started by healthbusiness, Apr 23, 2010.

  1. healthbusiness

    healthbusiness New Member

    Joined:
    Mar 29, 2009
    Messages:
    2
    I'm using the following code to sort incremental content by number (Week 1, Week 2, Week 3, etc) and it has worked fine until I hit Week 10 then it started ordering it like this: Week 1, Week 10, Week 11, Week 2, Week 3, etc.) I can't for the life of me figure out how to fix this and was hoping someone here could help me out?

    PHP:
    <?php
    session_start
    ();
    function 
    cmp($a$b)
    {
    if (
    $a['link_url'] == $b['link_url']) {
    return 
    0;
    }
    return (
    $a['link_url'] < $b['link_url']) ? -1;
    }

    if (
    $_SESSION['_amember_links'])
    {
    usort($_SESSION['_amember_links'],'cmp');
    foreach (
    $_SESSION['_amember_links'] as $link_id => $link
        {    
            if(
    $link['link_group_id'] == "0" && preg_match("/\bIntensive\b/i"$link['link_title'])) {
            echo 
    "<a href=\"".$link['link_url']."\"><font face=\"Arial\" size=\"5\">".$link['link_title']."</font></a><br><br>";
            }
        }
    }
    ?>
  2. miso

    miso aMember Pro Customer

    Joined:
    Aug 22, 2006
    Messages:
    543
    Rename the content to Week 01, Week 02...
  3. healthbusiness

    healthbusiness New Member

    Joined:
    Mar 29, 2009
    Messages:
    2
    Already tried that it doesn't work either. Still does the same thing...weird?
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    As I can see from code you sort by urls and not by titles, What url format you use?
    This will be possible to modify function cmp($a, $b) and sort depending on url format.

Share This Page