Jump to content


Photo

Loops With Smarty


  • Please log in to reply
No replies to this topic

#1 Danny2k5

Danny2k5
  • Members
  • Pip
  • Newbie
  • 1 posts

Posted 25 April 2006 - 07:30 PM

Right my query will show "There are 4 results in the download section" after a search but underneath it says "No Results, can anyone see anything wrong with my code?

$SEARCH_DOWN_ARRAY = array();

$download_query = @mysql_query("SELECT * FROM ti_downloads WHERE d_title LIKE '%$search%' OR d_small_description LIKE '%$search%' OR d_long_description LIKE '%$search%'");

$num_downloads = @mysql_num_rows($download_query);
        $dow = @mysql_fetch_array($download_query);

$SEARCH_DOWN_ARRAY[] = array(
"title" => '<a href="/index.php?action=downloads&cat=' . $catid . '&file=' . $dow["id"] . '" title="' . htmlentities($dow["d_title"]) . '">' . htmlentities($dow["d_title"]) . ' by ' . htmlentities($dow["d_creator"]) . '</a>',
"creator" => htmlentities($dow["d_creator"])
);
$smarty -> assign("NUM_DOWNLOADS", $num_downloads);
$smarty -> assign("SEARCH_DOWN_ARRAY", $SEARCH_DOWN_ARRAY);
$smarty -> assign("THE_INCLUDE", $smarty -> fetch(SROOT . "templates/search.tpl"));
}

Then the template looks like:

                                {section name=down loop=$SEARCH_DOWN_ARRAY}
                                {$SEARCH_DOWN_ARRAY[down].title}<br />
                                {sectionelse}
                                No Results
                                {/section}

Thanks People
Dan




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users