Question about string_replace

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.

Someone gave me a tip of trying to add in the
somewhere but i don’t know where. Tried various but none worked .

Can somebody help my out please?


Posting in all forums will not get you the answer any quicker… Just tick people, like me, off.

Sponsor our Newsletter | Privacy Policy | Terms of Service