str_replace question

Hello there,

im trying to develop a webshop with some code i picked up somewhere, cosmicshoppingchart (very easy to set up).

Now in the scripts all is parsed into templates by php so the catalog is completely dynamic build.

Now comes my problem: in 1 of the included files the parsing of the category names is done:

if (strpos($template, “::category_links::”)) {
$cats = db_get_cats_result();
while ($cat = mysql_fetch_assoc($cats)) {
$cat_lnk = $templates[“category_link”];
$cat_lnk = str_replace("::category_id::", $cat[“cat_id”], $cat_lnk);
$cat_lnk = str_replace("::category_name::", $cat[“cat_name”], $cat_lnk);
$rtn_cats_lnk .= $cat_lnk;
}
$template = str_replace("::category_links::", $rtn_cats_lnk,$template);
}

What this does is replace the ::category_link:: with all the categorys printed after another.

I want the categories displayed beneath eachother so i have to break the category_links into 1,2,3 etc.

Omeone gave me a tip of trying to add in the
somewhere but i didn’t get that to work.

Can somebody help my out please?

Please Don’t Double Post…Check here for the answer…

http://www.phphelp.com/phpBB2/viewtopic.php?t=6475

Sponsor our Newsletter | Privacy Policy | Terms of Service