仅显示动态生成的页面标题的路径数组中的最后一项

I'm still relatively new working with PHP and am working on a site that's constantly over my head, so I apologize if this question is stupid - if so, please just point me in the right direction.

I'll try to explain. I'm working on a site that uses PHPmyDirectory to dynamically generate pages and thus page titles and breadcrumbs. I'm trying to find a way to generate a custom page title - either a truly custom page title based upon a certain page's url, or even just modify the existing script so that it doesn't include the entire path in the title.

Right now - it will generate a page title like this: Chicagoland - Illinois - United States - Caricature artists - About Faces Entertainment

I want it to either just say "Chicagoland Caricature Artists - About Faces Entertainment" or else allow me to substitute a custom page title on certain key locations and categories using the page url. The "Illinois" and "United States" are parent locations of "Chicagoland".

I've identified the relevant code, I think, but it seems to generate both the breadcrumb and the page title, and I don't want to mess up the breadcrumb.

Can anyone suggest the best way for me to accomplish either of these alternatives?

Here's what I believe is the code:

    $category_template_id = $listing['primary_category_id'];

$listing_categories = $PMDR->get('Listings')->getCategories($listing['id']);

foreach($listing_categories as $key=>$category) {
    $category_path = $PMDR->get('Categories')->getPath($category['id']);
    if($category['id'] == $listing['primary_category_id']) {
        // Set page title, and breadcrumb
        foreach((array) $category_path as $category) {
            $PMDR->setAdd('page_title',$category['title']);
            $template_content->set('category_name', $category['title']);
            $PMDR->setAddArray('breadcrumb',
array('link'=>
$PMDR->get('Categories')->getURL($category['id'],$category['friendly_url_path']),
'text'=>$category['title']));
        }
    }
    $listing_categories[$key]['path_url'] = 
$PMDR->get('Categories')->getPathDisplay($category_path,'»');
}
unset($category_path);
// Set page title
$PMDR->setAdd('page_title',$listing['title']);

//Set Unique Listing ID

$template_content->set('unique_listing_id', $listing['unique_listing_id']);

// Set META description
if(!empty($listing['meta_description'])) {
    $PMDR->set('meta_description',$listing['meta_description']);    
} elseif(!empty($listing['description_short'])) {
    $PMDR->set('meta_description',$listing['description_short']);    
} else {
    $meta_description = $listing['title'];
    foreach((array) $category_path as $category) {
        $meta_description .= ' '.$category['title'];
    }
    foreach((array) $listing_locations as $location) {
        $meta_description .= ' '.$location['title'];
    }
    $PMDR->set('meta_description',$PMDR->getConfig('meta_description_default').' '.$meta_description.'.');
    unset($meta_description);    
}

I'm thinking I could just isolate the last item in the location path array, that might be easiest, but I don't see where the location information is being called in the page title section of the code. I do see it further down - where it sets up the meta descriptions, but not where the page title is set. Am I just missing it?

in the admin panel go to http://yourdomain.com/cp/admin_settings.php?group=listings

and under search engine optimization add the following

Default META Title (meta_title_listing_default) The default META title that will be used if an individual listing does not have a specific META title entered. The following variables may be used: title, category_X where "X" is the category level, location_X where "X" is the location level, "location_text_X" where "X" is the location text level, zip, and "custom_X" where "X" is the custom field ID.