Tag tittle
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Oct 2021, 05:34
Tag tittle
You can tag to make headlines and meta description? Maybe you can add a tag header ?
Sorry for my english!
Sorry for my english!
Tags:
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Tag tittle
Hi, what do you exactly mean with "add a tag header"?
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Oct 2021, 05:34
Re: Tag tittle
Hi
Code: Select all
tag?tagid=1 - car
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Tag tittle
Hi, for now there is no such option, so this needs to be customized directly in the view ![Idea :idea:](./images/smilies/icon_idea.gif)
components/com_phocagallery/views/category/tmpl/default.php
line 54+
Jan
![Idea :idea:](./images/smilies/icon_idea.gif)
components/com_phocagallery/views/category/tmpl/default.php
line 54+
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Oct 2021, 05:34
Re: Tag tittle
Hi, i can't understand it in any way, it doesn't work out
Code: Select all
echo '<div class="page-header"><h1>'. $this->escape($heading);
if (isset($tagId) && $tagId != '') {
echo ' - ' . $this->escape($tagId);
}
echo '</h1></div>';
}
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Tag tittle
Hi, what exactly don't you understand?
Jan
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Oct 2021, 05:34
Re: Tag tittle
Hi, I was wondering if there's a way to display both the title and h1 for tags. In our previous conversation, we discussed using tags in the URL (tag?tagid=1 - car). Is there a way to incorporate this into the title and h1 for better SEO? I'm having some difficulty understanding the customization process you mentioned in components/com_phocagallery/views/category/tmpl/default.php, starting from line 54+. Could you provide more guidance or perhaps an example? Thanks!
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Tag tittle
Hi, I didn't do such customization yet, so unfortunately, I cannot add any clude advice how to do this.
- first you will get information about tag ID
- then you ask database for the title of such tag
- then this title will be displayed in header tag.
So this is not only about displaying the tag title but you need to get the title too.
e.g., getting info about tag id:
In your code you are using variable which does not exist: $tagId, there is $this->tagId
Jan
- first you will get information about tag ID
- then you ask database for the title of such tag
- then this title will be displayed in header tag.
So this is not only about displaying the tag title but you need to get the title too.
e.g., getting info about tag id:
Code: Select all
$query = 'SELECT a.id, a.title, a.link_ext, a.link_cat'
.' FROM #__phocagallery_tags AS a'
.' WHERE a.id = '.(int)$tagId
.' ORDER BY a.id';
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Newbie
- Posts: 5
- Joined: 13 Oct 2021, 05:34
Re: Tag tittle
Code: Select all
echo '<div class="page-header"><h1>'. $this->escape($heading);
$pageTitle = $heading;
if (isset($this->tagId) && $this->tagId != '') {
$db = JFactory::getDbo();
$tagQuery = $db->getQuery(true)
->select($db->quoteName('title'))
->from($db->quoteName('#__phocagallery_tags'))
->where($db->quoteName('id') . ' = ' . (int)$this->tagId);
$db->setQuery($tagQuery);
$tagTitle = $db->loadResult();
if ($tagTitle) {
echo ' - ' . $this->escape($tagTitle);
$pageTitle = $this->escape($tagTitle) . ' - ' . $pageTitle;
}
}
echo '</h1></div>';
JFactory::getDocument()->setTitle($pageTitle);
- Jan
- Phoca Hero
- Posts: 48227
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Tag tittle
Ok, thank you for the info.
Jan
Jan
If you find Phoca extensions useful, please support the project