Name of parent category and current category

More
12 years 3 months ago #21599 by Codrut
Hello,

I have two main categories, Type and Keeper, both with subcategories:
Type
-SubCatType1
-SubCatType2
-...

Keeper
-SubCatKeeper1
-SubCatKeeper2
-...

What do I want to achieve is to have the Page Title in Category (Items list) view like:
Type: SubCatType2 (aka ParentCat: CurrentCat)

Can this be done?
Thank you!

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #21611 by ggppdk
You can use the following code to set html document title to be all category ancestors

You can use it in both FLEXIcontent category and FLEXIcontent item view (place inside the template files (e.g. inside template files: category_category.php or item.php for category and item views respectively):
Code:
global $globalcats; $cid = JRequest::getInt('cid'); if ($cid) { foreach ($globalcats[$cid]->ancestorsarray as $ancestor_catid) { $ancestor_title_arr[] = $globalcats[$ancestor_catid]->title; } $page_title = implode(" :: ", $ancestor_title_arr); //$page_title .= $this->item->title; $jdoc = & JFactory::getDocument(); $jdoc->setTitle($page_title); }

Of course if current view is an item view you can also add item title by uncommenting the line:
//$page_title .= $this->item->title;

What i suggest above will set the title of html document, the same text you can use in category_category.php of your template to replace the printed title of your page

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #21620 by Codrut
Greetings,

I think it was my fault, I didn't mean "page title" but the category title. Nevermind, using your suggestion I changed
Code:
<?php echo $this->escape($page_title); ?>
instead of
Code:
<?php echo $this->escape($this->category->title); ?>

Thank you for your support!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.546 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline