Tag tittle

Phoca Gallery - image gallery extension
ierofant
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Oct 2021, 05:34

Tag tittle

Post by ierofant »

You can tag to make headlines and meta description? Maybe you can add a tag header ?
Sorry for my english!

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47723
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Tag tittle

Post by Jan »

Hi, what do you exactly mean with "add a tag header"?

Jan
If you find Phoca extensions useful, please support the project
ierofant
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Oct 2021, 05:34

Re: Tag tittle

Post by ierofant »

Jan wrote: 19 Oct 2021, 22:37 Hi, what do you exactly mean with "add a tag header"?

Jan
Hi

Code: Select all

tag?tagid=1 - car
Title (car), h1 (car)...
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47723
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Tag tittle

Post by Jan »

Hi, for now there is no such option, so this needs to be customized directly in the view :idea:

components/com_phocagallery/views/category/tmpl/default.php

line 54+

Jan
If you find Phoca extensions useful, please support the project
ierofant
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Oct 2021, 05:34

Re: Tag tittle

Post by ierofant »

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>';
	} 
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47723
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Tag tittle

Post by Jan »

Hi, what exactly don't you understand?

Jan
If you find Phoca extensions useful, please support the project
ierofant
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Oct 2021, 05:34

Re: Tag tittle

Post by ierofant »

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!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47723
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Tag tittle

Post by Jan »

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:

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';
In your code you are using variable which does not exist: $tagId, there is $this->tagId

Jan
If you find Phoca extensions useful, please support the project
ierofant
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 13 Oct 2021, 05:34

Re: Tag tittle

Post by ierofant »

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);
Thanks for the tip, it's a working option!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47723
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Tag tittle

Post by Jan »

Ok, thank you for the info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply