Meta tags & Page titles in components
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
- zigzag
- Joomla! Enthusiast
- Posts: 249
- Joined: Tue Sep 20, 2005 9:03 pm
- Location: Elsewhere
Meta tags & Page titles in components
Hi,
A lot of good components don't have page titles & meta tags, is there a way round this or a way to code them into the component files?
For example how would I go about doing this in the extcal component?
A lot of good components don't have page titles & meta tags, is there a way round this or a way to code them into the component files?
For example how would I go about doing this in the extcal component?
- Websmurf
- Joomla! Hero
- Posts: 2230
- Joined: Fri Aug 19, 2005 2:23 pm
- Location: The Netherlands
- Contact:
Re: Meta tags & Page titles in components
There's a way to code them in yourself
using the setPageTitle & appendMetaTag functions:
usage:
[edit: typo]
using the setPageTitle & appendMetaTag functions:
usage:
Code: Select all
<?php
$mainframe->setPageTitle('This is my title');
$mainframe->appendMetaTag('description', 'This content will be added to the description');
$mainframe->appendMetaTag('keywords', 'This will be added to the keywords');
?>
Last edited by Websmurf on Tue Oct 18, 2005 8:12 am, edited 1 time in total.
Adam van Dongen - Developer
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- zigzag
- Joomla! Enthusiast
- Posts: 249
- Joined: Tue Sep 20, 2005 9:03 pm
- Location: Elsewhere
Re: Meta tags & Page titles in components
Brilliant - thank you
- DeanMarshall
- Joomla! Hero
- Posts: 2352
- Joined: Fri Aug 19, 2005 2:26 am
- Location: Lancaster, Lancashire, United Kingdom
- Contact:
Re: Meta tags & Page titles in components
Adam,
$mainframe->appendMetaTag('description', 'This content will be added to the description');
Is there a way to set a new description rather than appending.
Dean.
$mainframe->appendMetaTag('description', 'This content will be added to the description');
Is there a way to set a new description rather than appending.
Dean.
Dean Marshall Consultancy - six Joomla experts - http://www.deanmarshall.co.uk/
Joomla Experts - Joomla Support http://www.deanmarshall.co.uk/joomla-se ... pport.html
Joomla Experts - Joomla Support http://www.deanmarshall.co.uk/joomla-se ... pport.html
- Websmurf
- Joomla! Hero
- Posts: 2230
- Joined: Fri Aug 19, 2005 2:23 pm
- Location: The Netherlands
- Contact:
Re: Meta tags & Page titles in components
i'm afraid there's no such thing currently that i'm aware of.
the only xxxMetaTag functions i've found add (meaning a double one) or append it.
the only xxxMetaTag functions i've found add (meaning a double one) or append it.
Adam van Dongen - Developer
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- zigzag
- Joomla! Enthusiast
- Posts: 249
- Joined: Tue Sep 20, 2005 9:03 pm
- Location: Elsewhere
Re: Meta tags & Page titles in components
Well they worked well on extcal and a few other components
I had to change
I had to change
to$mainframe->addPageTitle('This is my title');
$mainframe->setPageTitle('This is my title');
-
- Joomla! Enthusiast
- Posts: 157
- Joined: Mon Aug 22, 2005 1:39 am
Re: Meta tags & Page titles in components
is this setpagetitle/appendMetaTag functions only available in joomla, or is it available in mambo 4.5.2.3?Websmurf wrote: There's a way to code them in yourself
using the setPageTitle & appendMetaTag functions:
usage:Code: Select all
<?php $mainframe->addPageTitle('This is my title'); $mainframe->appendMetaTag('description', 'This content will be added to the description'); $mainframe->appendMetaTag('keywords', 'This will be added to the keywords'); ?>
- Websmurf
- Joomla! Hero
- Posts: 2230
- Joined: Fri Aug 19, 2005 2:23 pm
- Location: The Netherlands
- Contact:
Re: Meta tags & Page titles in components
No, it's available in mambo as well as far as i know
Adam van Dongen - Developer
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- Websmurf
- Joomla! Hero
- Posts: 2230
- Joined: Fri Aug 19, 2005 2:23 pm
- Location: The Netherlands
- Contact:
Re: Meta tags & Page titles in components
That's indeed a small typo i've made.zigzag wrote: Well they worked well on extcal and a few other components
I had to changeto$mainframe->addPageTitle('This is my title');$mainframe->setPageTitle('This is my title');
the function is setPageTitle and NOT addPageTitle
Adam van Dongen - Developer
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
-
- Joomla! Enthusiast
- Posts: 157
- Joined: Mon Aug 22, 2005 1:39 am
Re: Meta tags & Page titles in components
pardon my ignorance here, but could you please give me a step by step on how and where to add those in mambo 4.5.2.3?Websmurf wrote: No, it's available in mambo as well as far as i know
thanks
- Websmurf
- Joomla! Hero
- Posts: 2230
- Joined: Fri Aug 19, 2005 2:23 pm
- Location: The Netherlands
- Contact:
Re: Meta tags & Page titles in components
in what component exactly?
Adam van Dongen - Developer
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
-
- Joomla! Enthusiast
- Posts: 157
- Joined: Mon Aug 22, 2005 1:39 am
Re: Meta tags & Page titles in components
i thought it would be the same for all components, anyways, its a custom component that a someone made for me.
but here are the files i have access to via ftp
/httpdocs/components/ com_ctmedia/ctmedia.html.php
/httpdocs/components/ com_ctmedia/ctmedia.php
question is, do i add the meta tags / page title in any of those php files?
but here are the files i have access to via ftp
/httpdocs/components/ com_ctmedia/ctmedia.html.php
/httpdocs/components/ com_ctmedia/ctmedia.php
question is, do i add the meta tags / page title in any of those php files?
Last edited by gamesport on Tue Oct 18, 2005 4:21 pm, edited 1 time in total.
- Websmurf
- Joomla! Hero
- Posts: 2230
- Joined: Fri Aug 19, 2005 2:23 pm
- Location: The Netherlands
- Contact:
Re: Meta tags & Page titles in components
Well, it's generally the same for each component.
you can add it in any of those files you like, there's only one small but, if you put $mainframe->setPage.. inside a function, you'll have to set $mainframe as a global object:
I normally use the last variant. It will be easier to locate a title if you're searching for it.
Hope this helps..
you can add it in any of those files you like, there's only one small but, if you put $mainframe->setPage.. inside a function, you'll have to set $mainframe as a global object:
Code: Select all
<?php
//normal procedure, can be inserted anywhere
$mainframe->setPageTitle('This pagetitle will appear on this page');
//with a function:
function myFunction(){
global $database, $option, $mainframe; //i've added $mainframe to the list here...
$mainframe->setPageTitle('pagetitle');
}
?>
Hope this helps..
Adam van Dongen - Developer
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
-
- Joomla! Enthusiast
- Posts: 157
- Joined: Mon Aug 22, 2005 1:39 am
Re: Meta tags & Page titles in components
i added you code to the ..html.php thingy, and it still didnt work, do you have an msn or yahoo handle, so we can talk over messenger?
- Websmurf
- Joomla! Hero
- Posts: 2230
- Joined: Fri Aug 19, 2005 2:23 pm
- Location: The Netherlands
- Contact:
Re: Meta tags & Page titles in components
Check my profile on this forum. MSN address is in there.
Adam van Dongen - Developer
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
- Blocklist, ODT Indexer, EasyFAQ, Easy Guestbook, Easy Gallery, YaNC & Redirect -
http://www.joomla-addons.org - http://www.bandhosting.nl
-
- Joomla! Apprentice
- Posts: 29
- Joined: Tue Jan 22, 2008 8:04 pm
Re: Meta tags & Page titles in components
Hi, this solution will work with joomla 1.5?
-
- Joomla! Fledgling
- Posts: 2
- Joined: Fri Nov 25, 2011 10:13 pm
Re: Meta tags & Page titles in components
Came to this via search engine, not sure if this has the right information for J1.6+. I believe mainframe brings up an error, and you need to use JFactory to do what $mainframe used to do, like this:
$mainframe = JFactory::getApplication();
Could be wrong though, I am not an expert yet.
$mainframe = JFactory::getApplication();
Could be wrong though, I am not an expert yet.