|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello
Currently, I use include(header.inc) to add the HTML header to each page, but I need to customize the TITLE bit "Some page": ========== <html> <head> <link rel="STYLESHEET" href="display.css" type="text/css"> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>Some page</title> </head> <body> ========== Before I replace each include() with fopen/fread/fclose/str_replace/echo, I was wondering if there were an easier solution to this? Thank you. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mon, 25 Feb 2008 14:48:09 +0100, Gilles Ganault <nospam@nospam.com>
wrote: >Hello > > Currently, I use include(header.inc) to add the HTML header to each >page, but I need to customize the TITLE bit "Some page": > >========== ><html> <head> <link rel="STYLESHEET" href="display.css" >type="text/css"> > <meta http-equiv="content-type" content="text/html; >charset=iso-8859-1"> > <title>Some page</title> ></head> ><body> >========== > >Before I replace each include() with >fopen/fread/fclose/str_replace/echo, I was wondering if there were an >easier solution to this? > >Thank you. include_header_inc($title) { include(header_part1.inc); echo $title; include(header_part2.inc); } include_header_inc('Your title text') -- Regards, Paul Herber, Sandrila Ltd. http://www.sandrila.co.uk/ http://www.pherber.com/ |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Mon, 25 Feb 2008 14:48:09 +0100, Gilles Ganault <nospam@nospam.com>
wrote: > Hello > > Currently, I use include(header.inc) to add the HTML header to each > page, but I need to customize the TITLE bit "Some page": > > ========== > <html> <head> <link rel="STYLESHEET" href="display.css" > type="text/css"> > <meta http-equiv="content-type" content="text/html; > charset=iso-8859-1"> > <title>Some page</title> > </head> > <body> > ========== > > Before I replace each include() with > fopen/fread/fclose/str_replace/echo, I was wondering if there were an > easier solution to this? > > Thank you. script.php: $title = 'foo'; include('header.inc'); header.inc: <html> <head> <link rel="STYLESHEET" href="display.css" type="text/css"> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title><?php echo isset($title) ? $title : 'Some page'; ?></title> </head> <body> -- Rik Wasmus |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Feb 25, 8:59 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Mon, 25 Feb 2008 14:48:09 +0100, Gilles Ganault <nos...@nospam.com> > wrote: > > > > > Hello > > > Currently, I use include(header.inc) to add the HTML header to each > > page, but I need to customize the TITLE bit "Some page": > > > ========== > > <html> <head> <link rel="STYLESHEET" href="display.css" > > type="text/css"> > > <meta http-equiv="content-type" content="text/html; > > charset=iso-8859-1"> > > <title>Some page</title> > > </head> > > <body> > > ========== > > > Before I replace each include() with > > fopen/fread/fclose/str_replace/echo, I was wondering if there were an > > easier solution to this? > > > Thank you. > > script.php: > $title = 'foo'; > include('header.inc'); > > header.inc: > <html> > <head> > <link rel="STYLESHEET" href="display.css" type="text/css"> > <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> > <title><?php echo isset($title) ? $title : 'Some page'; ?></title> > </head> > <body> > -- > Rik Wasmus Or use a function: function getHeader($title) { return <<<EOD <html> <head> <link rel="STYLESHEET" href="display.css" type="text/css"> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>$title</title> </head> <body> EOD; } |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On Mon, 25 Feb 2008 14:59:19 +0100, "Rik Wasmus"
<luiheidsgoeroe@hotmail.com> wrote: >script.php: >$title = 'foo'; >include('header.inc'); > > >header.inc: > <title><?php echo isset($title) ? $title : 'Some page'; ?></title> Thanks guys for the tip. However, the variable isn't passed to header.inc. I assume it's due to the way PHP was compiled. Is there another way to get the content of $title? //index.php $title = "List of calls"; include("header.inc"); //header.inc <title><?php echo isset($title) ? $title : "Change me!"; ?></title> => Browser says "Change me!". |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Gilles Ganault wrote:
> On Mon, 25 Feb 2008 14:59:19 +0100, "Rik Wasmus" > <luiheidsgoeroe@hotmail.com> wrote: >> script.php: >> $title = 'foo'; >> include('header.inc'); >> >> >> header.inc: >> <title><?php echo isset($title) ? $title : 'Some page'; ?></title> > > Thanks guys for the tip. However, the variable isn't passed to > header.inc. I assume it's due to the way PHP was compiled. Is there > another way to get the content of $title? > > //index.php > $title = "List of calls"; > include("header.inc"); > > //header.inc > <title><?php echo isset($title) ? $title : "Change me!"; ?></title> > > => Browser says "Change me!". > No, it's not the way PHP is compiled. It does work. What's the actual code you're using? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Gilles Ganault wrote:
> On Mon, 25 Feb 2008 14:59:19 +0100, "Rik Wasmus" > <luiheidsgoeroe@hotmail.com> wrote: >> script.php: >> $title = 'foo'; >> include('header.inc'); >> >> >> header.inc: >> <title><?php echo isset($title) ? $title : 'Some page'; ?></title> > > Thanks guys for the tip. However, the variable isn't passed to > header.inc. I assume it's due to the way PHP was compiled. Is there > another way to get the content of $title? > > //index.php > $title = "List of calls"; > include("header.inc"); > > //header.inc > <title><?php echo isset($title) ? $title : "Change me!"; ?></title> > > => Browser says "Change me!". That should work. Are you sure that you aren't seeing a cached version? |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
On Tue, 26 Feb 2008 09:23:45 +0000, Robin <anon@somewhere.com> wrote:
>That should work. Are you sure that you aren't seeing a cached version? Sorry guys, it works now. I have no idea why Firefox kept displaying "Change me" even though I hit F5. |
|
![]() |
| Outils de la discussion | |
|
|