NYCPHP Meetup

NYPHP.org

[nycphp-talk] title display based on page view

Chris Bielanski Cbielanski at inta.org
Tue Feb 10 11:09:37 EST 2004


Agreed, a DB-based solution is much better overall :) I spat out the quick
and dirty response!

> -----Original Message-----
> From: Adam Maccabee Trachtenberg [mailto:adam at trachtenberg.com]
> Sent: Tuesday, February 10, 2004 11:02 AM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] title display based on page view
> 
> 
> On Tue, 10 Feb 2004 yury at heavenspa.com wrote:
> 
> > Chris hrmm I guess I'm still 1/2 asleep. I'd like to help 
> some pages get
> > relevant titles based on which page is displayed. So the 
> example is like so:
> >
> > i have 51 pages - each page is a state name : state.php
> >
> > i'd like to have 51 titles that have a few of the major 
> cities from that
> > state.
> >
> > I'd like the title to be displayed based on the state.php 
> page.. I guess i
> > could do a huge swtich/case, but was wondering if there is 
> a smart/simple
> > way..
> 
> Are you saying you have 51 distinct physical pages (new_york.php,
> connecticut.php, etc.) and want to write a PHP function that looks at
> the file name and can generate the correct HTML title? Or that you
> have 1 physical page (state.php) and 51 "virtual" pages?
> 
> If you have the first, try placing something like this in a file
> that's included in all pages:
> 
> $titles = array('new_york.php' => 'New York Title',
>                 'connecticut.php' => 'Connecticut Title',
>                 ...);
> 
> $path_parts = pathinfo($_SERVER['PHP_SELF']);
> $title = $titles[$path_parts['basename']];
> 
> ...
> 
> print "<title>$title</title>";
> 
> However, what you should really do is switch to the second setup and
> pull all content, including the title, out of a database based on a
> passed in page name. That solve the title problem and 
> generalizes the solution.
> 
> -adam
> 
> -- 
> adam at trachtenberg.com
> author of o'reilly's php cookbook
> avoid the holiday rush, buy your copy today!
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 

>From hans not junk at nyphp.com  Tue Feb 10 11:08:43 2004
Return-Path: <hans not junk at nyphp.com>
Received: from ehost011-1.exch011.intermedia.net (unknown [64.78.21.3])
	by virtu.nyphp.org (Postfix) with ESMTP id 65FBBA8666
	for <talk at lists.nyphp.org>; Tue, 10 Feb 2004 11:08:43 -0500 (EST)
X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Subject: RE: [nycphp-talk] Using PEAR?
Date: Tue, 10 Feb 2004 08:08:42 -0800
Message-ID: <41EE526EC2D3C74286415780D3BA9F87772601 at ehost011-1.exch011.intermedia.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: [nycphp-talk] Using PEAR?
Thread-Index: AcPv3E53ZXttJnxLTtarU3Hjg915WAAE8ofg
From: "Hans Zaunere" <hans not junk at nyphp.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
X-BeenThere: talk at lists.nyphp.org
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: NYPHP Talk <talk at lists.nyphp.org>
List-Id: NYPHP Talk  <talk.lists.nyphp.org>
List-Unsubscribe: <http://lists.nyphp.org/mailman/listinfo/talk>,
	<mailto:talk-request at lists.nyphp.org?subject=unsubscribe>
List-Archive: <http://lists.nyphp.org/pipermail/talk>
List-Post: <mailto:talk at lists.nyphp.org>
List-Help: <mailto:talk-request at lists.nyphp.org?subject=help>
List-Subscribe: <http://lists.nyphp.org/mailman/listinfo/talk>,
	<mailto:talk-request at lists.nyphp.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Feb 2004 16:08:43 -0000


> <plug>Coincidently, this month at the LIPHP meeting=20
> (www.liphp.org), we will be having a general discussion on=20
> PEAR, going over the various tools provided by it, and=20
> running through some examples.</plug>

Whow.. that's scary.  NYPHP is having a PEAR::DB presentation feb-24th
at our regular meeting.

I guess great groups think alike :)

H



More information about the talk mailing list