Topic: newsletter category

Hi

I want to add the category NAME to the newsletter after an item's title (not the category number).

There is (was?) a topic on this (http://www.google.com/url?sa=t&rct=j&q=newsletter%2Bcategory&source=web&cd=1&ved=0CCIQFjAA&url=http%3A%2F%2Fcutephp.com%2Fforum%2Findex.php%3Fshowtopic%3D35839&ei=1DobT8DACsHJhAfx3JnFDA&usg=AFQjCNGYdz1POfw84JEqdHKWskOMzS147Q)

but the lin throws up a page error.

Any help on how to add category name to newsletter would be appreciated.

Rgds

Re: newsletter category

There has been no solution on this question... but maybe someone with good php experience could help. I'll quote the topic from the google web cache:

Newsletter Hack: how to add category name to newsletter?

My own PHP is not good enough to work this one out with the menu hack code ...
hopefully some php aware member will be able to figure this...

Sorry can't help myself

Re: newsletter category

multiple categories didn't exist when the hack was made

from the other topic

function show_cat_name($cat_id){
                      $cats = file("./data/category.db.php");
                      foreach($cats as $cat_line){
                          $cat_line_arr = explode("|", $cat_line);
                          if($cat_line_arr[0] == $cat_id)
                              return $cat_line_arr[1];
                      }
                  }


replace with new function as mentioned

//////////////////////////////////////////
// Function:    Category ID to Name
// Description:    convert to category name from ID
if (!function_exists('catid2name')){
    function catid2name($thecat){
        $cats = file("./data/category.db.php");//<----make sure the path is correct!

        if(strstr($thecat, ',')){
            $thecat_arr = explode(',', $thecat);
            foreach($thecat_arr as $single_thecat){
                if($thecat_not_first){
                    $thecat_str .= ', '. $cat[$single_thecat];
                }
                else{
                    $thecat_str .= $cat[$single_thecat];
                }

                $thecat_not_first = TRUE;
            }

            return $thecat_str;
        }
        else{
            return $cat[$thecat];
        }
    }
}

replace all catid2name
with the old function name show_cat_name