dynamic meta tag and title app?
dynamic meta tag and title app?
am 18.11.2009 17:30:07 von Jack S
Hello All,
Does anyone have a reference to a program that may be out there to
help with using a single header.php for a site, but then dynamically
loads different keywords , titles etc based on what page is including
the header file?
Sample:
If home page include it knows the title and other variables would be
home, about us would be about etc.
--
Thanks!
Jack
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: dynamic meta tag and title app?
am 18.11.2009 23:18:52 von Daevid Vincent
I usually just use some JS in the footer.php of the page to go back and
change the title based upon other stuff, say the user's name or whatever:
> -----Original Message-----
> From: Jack S [mailto:jacklistmail@gmail.com]
> Sent: Wednesday, November 18, 2009 8:30 AM
> To: php-general@lists.php.net
> Subject: [PHP] dynamic meta tag and title app?
>
> Hello All,
>
> Does anyone have a reference to a program that may be out there to
> help with using a single header.php for a site, but then dynamically
> loads different keywords , titles etc based on what page is including
> the header file?
>
> Sample:
> If home page include it knows the title and other variables would be
> home, about us would be about etc.
>
> --
> Thanks!
> Jack
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: dynamic meta tag and title app?
am 18.11.2009 23:23:33 von Ashley Sheridan
--=-/U+i3LfjYJXCr4PkMClu
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Rather than use Javascript, which would limit your site to only those
browsers that support Javascript, have it enabled and aren't using any
plugins (like Noscript).
You could just use an array with the details in, set the type of page as
one of the first things in your script, and then output what you need
from that.
Thanks,
Ash
http://www.ashleysheridan.co.uk
On Wed, 2009-11-18 at 14:18 -0800, Daevid Vincent wrote:
> I usually just use some JS in the footer.php of the page to go back and
> change the title based upon other stuff, say the user's name or whatever:
>
>
>
> > -----Original Message-----
> > From: Jack S [mailto:jacklistmail@gmail.com]
> > Sent: Wednesday, November 18, 2009 8:30 AM
> > To: php-general@lists.php.net
> > Subject: [PHP] dynamic meta tag and title app?
> >
> > Hello All,
> >
> > Does anyone have a reference to a program that may be out there to
> > help with using a single header.php for a site, but then dynamically
> > loads different keywords , titles etc based on what page is including
> > the header file?
> >
> > Sample:
> > If home page include it knows the title and other variables would be
> > home, about us would be about etc.
> >
> > --
> > Thanks!
> > Jack
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
--=-/U+i3LfjYJXCr4PkMClu--
Re: dynamic meta tag and title app?
am 19.11.2009 02:19:40 von Shawn McKenzie
Jack S wrote:
> Hello All,
>
> Does anyone have a reference to a program that may be out there to
> help with using a single header.php for a site, but then dynamically
> loads different keywords , titles etc based on what page is including
> the header file?
>
> Sample:
> If home page include it knows the title and other variables would be
> home, about us would be about etc.
>
So if you have an index.php that is controlling your site and you use
get params like page=home, then something like this in the header:
switch ($_GET['page']) {
case 'home':
$title = 'Home';
$description = 'Some description';
$keywords = "some, key, words";
break;
case 'about':
$title = 'about';
$description = 'Some description';
$keywords = "some, key, words";
break;
default
$title = 'whatever';
$description = 'Some description';
$keywords = "some, key, words";
break;
}
include('header.php');
include('whatever_file.php');
If you have separate pages like home.php, then something like this:
// home.php
$title = 'Home';
$description = 'Some description';
$keywords = "some, key, words";
include('header.php');
//header.php
// use the vars from the including file
--
Thanks!
-Shawn
http://www.spidean.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: dynamic meta tag and title app?
am 19.11.2009 02:40:30 von Daevid Vincent
------=_NextPart_000_03C5_01CA6876.3A5180D0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
....right, because people can really use a site today without JS enabled...
please. welcome to the 90's. I challenge you to turn off JS on pretty much
any site with any amount of complexity. bah.
But yes, you could shove it in your
tags, but that's not always
convenient. it depends on how you construct your page and the order of
things, and how dynamic you need the title to be.
_____
From: Ashley Sheridan [mailto:ash@ashleysheridan.co.uk]
Sent: Wednesday, November 18, 2009 2:24 PM
To: Daevid Vincent
Cc: 'Jack S'; php-general@lists.php.net
Subject: RE: [PHP] dynamic meta tag and title app?
Rather than use Javascript, which would limit your site to only those
browsers that support Javascript, have it enabled and aren't using any
plugins (like Noscript).
You could just use an array with the details in, set the type of page as one
of the first things in your script, and then output what you need from that.
Thanks,
Ash
http://www.ashleysheridan.co.uk
On Wed, 2009-11-18 at 14:18 -0800, Daevid Vincent wrote:
I usually just use some JS in the footer.php of the page to go back and
change the title based upon other stuff, say the user's name or whatever:
> -----Original Message-----
> From: Jack S [mailto:jacklistmail@gmail.com]
> Sent: Wednesday, November 18, 2009 8:30 AM
> To: php-general@lists.php.net
> Subject: [PHP] dynamic meta tag and title app?
>
> Hello All,
>
> Does anyone have a reference to a program that may be out there to
> help with using a single header.php for a site, but then dynamically
> loads different keywords , titles etc based on what page is including
> the header file?
>
> Sample:
> If home page include it knows the title and other variables would be
> home, about us would be about etc.
>
> --
> Thanks!
> Jack
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
------=_NextPart_000_03C5_01CA6876.3A5180D0--
RE: dynamic meta tag and title app?
am 19.11.2009 02:54:45 von Ashley Sheridan
--=-rFl4weLpxgKaK0EQIthu
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Wed, 2009-11-18 at 17:40 -0800, Daevid Vincent wrote:
> ...right, because people can really use a site today without JS enabled...
> please. welcome to the 90's. I challenge you to turn off JS on pretty much
> any site with any amount of complexity. bah.
>
> But yes, you could shove it in your
tags, but that's not always
> convenient. it depends on how you construct your page and the order of
> things, and how dynamic you need the title to be.
>
>
> _____
>
> From: Ashley Sheridan [mailto:ash@ashleysheridan.co.uk]
> Sent: Wednesday, November 18, 2009 2:24 PM
> To: Daevid Vincent
> Cc: 'Jack S'; php-general@lists.php.net
> Subject: RE: [PHP] dynamic meta tag and title app?
>
>
> Rather than use Javascript, which would limit your site to only those
> browsers that support Javascript, have it enabled and aren't using any
> plugins (like Noscript).
>
> You could just use an array with the details in, set the type of page as one
> of the first things in your script, and then output what you need from that.
>
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>
> On Wed, 2009-11-18 at 14:18 -0800, Daevid Vincent wrote:
>
> I usually just use some JS in the footer.php of the page to go back and
>
> change the title based upon other stuff, say the user's name or whatever:
>
>
>
>
>
>
>
> > -----Original Message-----
>
> > From: Jack S [mailto:jacklistmail@gmail.com]
>
> > Sent: Wednesday, November 18, 2009 8:30 AM
>
> > To: php-general@lists.php.net
>
> > Subject: [PHP] dynamic meta tag and title app?
>
> >
>
> > Hello All,
>
> >
>
> > Does anyone have a reference to a program that may be out there to
>
> > help with using a single header.php for a site, but then dynamically
>
> > loads different keywords , titles etc based on what page is including
>
> > the header file?
>
> >
>
> > Sample:
>
> > If home page include it knows the title and other variables would be
>
> > home, about us would be about etc.
>
> >
>
> > --
>
> > Thanks!
>
> > Jack
>
> >
>
> > --
>
> > PHP General Mailing List (http://www.php.net/)
>
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> >
>
>
>
>
>
>
Actually, you can make a site today that uses JAvascript to enhance
functionality. Something as simple as a title for a page shouldn't be
relying on Javascript to function! It's worth pointing out that in the
UK there is something called the Disability Discrimination Act, in which
it is an offense to unfairly penalise someone based on a disability.
Now, call me stupid, but how many speech or Braille browsers do you know
with Javascript support, and if there are any, do they support all the
Javascript that some people rely on to make their site accomplish basic
functionality
There is an aside to this as well. Javascript is not indexed by search
engines. The closest that even Google comes is to index URL's it find in
the Javascript, but it is not a full Javascript parser itself. How could
any search engine achieve this; the permutations of user interaction are
infinite. So, relying on Javascript to populate basic content means that
it will never be indexed. I mention this last part because most people
don't seem to give a damn about accessibility, but when threatened with
low search rankings they wail like harpies until their site is 'fixed'.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-rFl4weLpxgKaK0EQIthu--
RE: dynamic meta tag and title app?
am 19.11.2009 06:42:27 von Daevid Vincent
> Actually, you can make a site today that uses JAvascript to enhance
> functionality.
I'd say a
fits that category. You can live without it.
> Something as simple as a title for a page shouldn't be
> relying on Javascript to function!
Shouldn't = I agree.
Sometimes the way a page is coded, it does have to be that way.
I'm working on one now, where the way the UX guy made the DIV's (so that
when using
A mobile phone, the menu is at the bottom) it makes it very difficult to
populate
The title with my gui_header.php and gui_footer.php and gui_nav.php
components.
Also, I render in a top down fashion, so I output:
1. the header,
2. then the navigation,
3. body content
4. footer
I can't populate the title when I've already output it and don't know what
page in the navigation the user is currently on. Sure I could jump through
hoops and pre-process the nav and use output buffering or something, but
whatev.
Hence, I use JS to populate at the end of the PHP rendering.
Just sayin'. ;-)
> It's worth pointing out that in the
> UK there is something called the Disability Discrimination
> Act, in which
> it is an offense to unfairly penalise someone based on a disability.
> Now, call me stupid, but how many speech or Braille browsers
> do you know
> with Javascript support, and if there are any, do they support all the
> Javascript that some people rely on to make their site
> accomplish basic
> functionality
Not to sound like a jerk or diminish the plight of disabled people,
but how many Braille browsers can parse Flash? Or use AJAX then?
Or Silverlight? Or umpteen other technologies.
Your point, while good in theory is far from practical or realistic.
> There is an aside to this as well. Javascript is not indexed by search
> engines. The closest that even Google comes is to index URL's
> it find in
> the Javascript, but it is not a full Javascript parser
> itself. How could
> any search engine achieve this; the permutations of user
> interaction are
> infinite. So, relying on Javascript to populate basic content
> means that
> it will never be indexed. I mention this last part because most people
> don't seem to give a damn about accessibility, but when
> threatened with
> low search rankings they wail like harpies until their site
> is 'fixed'.
Having said that, you are correct and if SEO is your goal, then certainly
ranks up there.
http://www.seomoz.org/article/search-ranking-factors
http://www.seobook.com/video-google-seo-friendly-page-titles
For my needs, SEO is NOT a factor as this is a SaaS site and our customers
subscribe to it as an ancillary service to a multi-million dollar product we
sell them. The site is used for reports/statistics the hardware generates.
In fact, we don't even want Google or other engines to know about it -- that
just invites crackers and script kiddies ;-)
Daevid.
http://daevid.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: dynamic meta tag and title app?
am 19.11.2009 12:36:40 von Ashley Sheridan
--=-8tyni2Bsq6LZUl3rG3vV
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Wed, 2009-11-18 at 21:42 -0800, Daevid Vincent wrote:
> > Actually, you can make a site today that uses JAvascript to enhance
> > functionality.
>
> I'd say a
fits that category. You can live without it.
>
> > Something as simple as a title for a page shouldn't be
> > relying on Javascript to function!
>
> Shouldn't = I agree.
>
> Sometimes the way a page is coded, it does have to be that way.
That just means that the code is poorly thought out. Consider:
$body = "html and content here";
Look, now we have the body content, and it's not printed. Do this at the
top of the page before any output and you know what to expect.
Frameworks do it like this, it's not something new and magic I've just
thought up.
> I'm working on one now, where the way the UX guy made the DIV's (so that
> when using
> A mobile phone, the menu is at the bottom) it makes it very difficult to
> populate
> The title with my gui_header.php and gui_footer.php and gui_nav.php
> components.
>
> Also, I render in a top down fashion, so I output:
>
> 1. the header,
> 2. then the navigation,
> 3. body content
> 4. footer
>
> I can't populate the title when I've already output it and don't know what
> page in the navigation the user is currently on. Sure I could jump through
> hoops and pre-process the nav and use output buffering or something, but
> whatev.
That just shows that the code hasn't been thought out as well as it
could be then
>
> Hence, I use JS to populate at the end of the PHP rendering.
>
> Just sayin'. ;-)
>
> > It's worth pointing out that in the
> > UK there is something called the Disability Discrimination
> > Act, in which
> > it is an offense to unfairly penalise someone based on a disability.
> > Now, call me stupid, but how many speech or Braille browsers
> > do you know
> > with Javascript support, and if there are any, do they support all the
> > Javascript that some people rely on to make their site
> > accomplish basic
> > functionality
>
> Not to sound like a jerk or diminish the plight of disabled people,
> but how many Braille browsers can parse Flash? Or use AJAX then?
> Or Silverlight? Or umpteen other technologies.
Exactly, and a site should not be relying solely on them either. The WAI
guidelines clearly show that alternative content should be offered in
the case of plugins such as Flash and Silverlight where possible, like
text transcripts of audio dialogue, and scene descriptions for video.
Sometimes it isn't possible, as in the case of some online games (spot
the difference perhaps) built in Flash, but these are fringe cases and
not the majority.
> Your point, while good in theory is far from practical or realistic.
>
It's not about practicality, but consideration. A blind user can no
longer rely on your javascript-only menus and Ajax-driven content.
Someone with severe arthritis might navigate with their keyboard and not
the mouse, what happens to all those Javascript onmouseover event
handlers now?
I've been arguing this whole point for a few years now to many people.
It's not an issue that will go away with the argument that it's just not
feasible or realistic or practical. There are 1.6million registered
blind in the UK, which is not a small number no matter how you try and
twist the statistics. 3.4 millions people have a disability that
prevents them using a standard keyboard and mouse. Are you really
willing to shun so many people because your work would become more
difficult otherwise?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--=-8tyni2Bsq6LZUl3rG3vV--
Re: dynamic meta tag and title app?
am 19.11.2009 16:09:50 von TedD
At 11:30 AM -0500 11/18/09, Jack S wrote:
>Hello All,
>
>Does anyone have a reference to a program that may be out there to
>help with using a single header.php for a site, but then dynamically
>loads different keywords , titles etc based on what page is including
>the header file?
>
>Sample:
>If home page include it knows the title and other variables would be
>home, about us would be about etc.
>
>--
>Thanks!
>Jack
Jack:
I do this for my site. It's pretty simple -- please follow:
$self = basename($_SERVER['SCRIPT_NAME']);
switch($self)
{
case 'index.php':
?>
Title of Index Page
break;
and so on.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: dynamic meta tag and title app?
am 19.11.2009 16:48:52 von Jack S
Hi Todd,
This looks like a good starting point for me.
I was going to use $_SERVER['PHP_SELF']; but I think
($_SERVER['SCRIPT_NAME']); in your example will always return just the
script info and not additionally passed information, which will save
me trouble shooting later!
Thanks!!!
On Thu, Nov 19, 2009 at 10:09 AM, tedd wrote:
> At 11:30 AM -0500 11/18/09, Jack S wrote:
>>
>> Hello All,
>>
>> Does anyone have a reference to a program that may be out there to
>> help with using a single header.php for a site, but then dynamically
>> loads different keywords , titles etc based on what page is including
>> the header file?
>>
>> Sample:
>> If home page include it knows the title and other variables would be
>> home, about us would be about etc.
>>
>> --
>> Thanks!
>> Jack
>
> Jack:
>
> I do this for my site. It's pretty simple -- please follow:
>
>
>
> $self =3D basename($_SERVER['SCRIPT_NAME']);
>
> switch($self)
> =A0 {
> =A0 case 'index.php':
> =A0 ?>
> =A0 Title of Index Page
> =A0
> =A0
> =A0
> =A0 break;
>
> and so on.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com =A0http://ancientstones.com =A0http://earthstones.com
>
--=20
Thanks!
Jack
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: dynamic meta tag and title app?
am 19.11.2009 19:09:48 von TedD
At 10:48 AM -0500 11/19/09, Jack S wrote:
>Hi Todd,
>
>This looks like a good starting point for me.
>I was going to use $_SERVER['PHP_SELF']; but I think
>($_SERVER['SCRIPT_NAME']); in your example will always return just the
>script info and not additionally passed information, which will save
>me trouble shooting later!
>
>Thanks!!!
No problem -- and I can see that you might have problems keypunching
considering that my name is tedd and not todd. :-)
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: dynamic meta tag and title app?
am 19.11.2009 21:55:22 von Paul M Foster
On Thu, Nov 19, 2009 at 01:09:48PM -0500, tedd wrote:
> At 10:48 AM -0500 11/19/09, Jack S wrote:
>> Hi Todd,
>>
>> This looks like a good starting point for me.
>> I was going to use $_SERVER['PHP_SELF']; but I think
>> ($_SERVER['SCRIPT_NAME']); in your example will always return just the
>> script info and not additionally passed information, which will save
>> me trouble shooting later!
>>
>> Thanks!!!
>
> No problem -- and I can see that you might have problems keypunching
> considering that my name is tedd and not todd. :-)
I think the real question is what did you do with todd? Are those his
feet sticking out from behind that cabinet over there?
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php