klox7 VIP
Total posts: 914
11 May 2015 18:10

Hi,

because I don't like manually inserting metadata in categories I'm coding it so system will do it for me :)

For now I'm doing it like this:

if ($this->section->id == ID) {
    $this->document->setTitle($this->category->title);
    $this->document->setMetaData( 'description', $this->category->title);
    $this->document->setMetaData( 'keywords', $this->category->title);
}

This suits for categories but I don't want it for section. How can I exclude only section root from this?

I would also like to exclude this metadata in modules that are using this template.

Regards

Last Modified: 19 May 2015


Sergey
Total posts: 13,748
12 May 2015 11:55
if($this->section->id == ID && JFactory::getApplication()->input->getInt('cat_id') > 0)

klox7 VIP
Total posts: 914
12 May 2015 14:37

Thank you. Just to say it doesn't work on empty categories.

How can I display this only on records view (list view)? Now it gives me error if I'm in article and I have some attached articles displayed.

What is condition for "only in list"?


Sergey
Total posts: 13,748
14 May 2015 13:23
$input = JFactory::getApplication()->input;
if($input->getInt('api') == 0 && $this->section->id == ID && $input->getInt('cat_id') > 0)

Where is this code? In list template?


klox7 VIP
Total posts: 914
14 May 2015 21:19

Sergey Where is this code? In list template?

Yes.


Sergey
Total posts: 13,748
19 May 2015 16:21

Works?


klox7 VIP
Total posts: 914
19 May 2015 17:50

When I tested it it didn't work. Then I just said "ah" to myself and pushed a site into production without this. :) I'll try again some time later.

Powered by Cobalt