Forum Moderators: coopster

Message Too Old, No Replies

Formatting a function

         

shimeal

8:16 pm on Apr 18, 2007 (gmt 0)

10+ Year Member



I am trying to display the number of entries present in each category like so: "category" (XX) - where XX is the number of entries in that particular category. Right now, with the following code, the number of entries in each category are incorrectly displaying like so: "category"XX

I am trying to format the following PHP script to correctly display the called information like so: "category" (XX). I don't know how to add that space after the category is displayed nor do I know how to put parenthesis around the number that is returned.

Any help is appreciated!

CODE SNIPPET:

function zm_popular_categories($zmpc_days = 60, $zmpc_title = 0, $zmpc_limit = 3, $zmpc_shownumber = 1, $zmpc_titlename = '', $zmpc_pretags = '<li>', $zmpc_posttags = ' ¦ </li>', $zmpc_prelist = '', $zmpc_postlist = '', $zmpc_countsepstart = '', $zmpc_return = 0, $zmpc_lastupdated = 0) {
global $wpdb, $post;

....

foreach ($zmpc_catcounts as $zmpc_catcount) {
$html_out .=
$zmpc_pretags;
$html_out .=
'<a href="'.$zmpc_permalinks[$zmpc_travelcount].'">'.$zmpc_cattitles[$zmpc_travelcount].'</a>';
if ($zmpc_shownumber) {
$html_out .= $zmpc_countsepstart;
$html_out .= $zmpc_catcount;
$html_out .= $zmpc_countsepend;
}
$html_out .=
$zmpc_posttags;
$zmpc_travelcount++;
if ($zmpc_travelcount >= $zmpc_limit) break;
}

$html_out .=
$zmpc_postlist;
$html_out .=
'';

if($zmpc_return)
return $html_out;
else
echo $html_out;
}

shimeal

8:17 pm on Apr 18, 2007 (gmt 0)

10+ Year Member



I imagine the formatting needs to be changed somewhere around the a href tag as this is where the "category" information is displayed but I am not sure:

$html_out .=
'<a href="'.$zmpc_permalinks[$zmpc_travelcount].'">'.$zmpc_cattitles[$zmpc_travelcount].'</a>';
if ($zmpc_shownumber) {
$html_out .= $zmpc_countsepstart;
$html_out .= $zmpc_catcount;
$html_out .= $zmpc_countsepend;
}

Thoughts?