Jump to content

page_title


anteater

Recommended Posts

Although what you have done is not a good way to create your page header, this should work:

 

On the first line after your "function page_header( $pict='top1.png' ) {" function declaration, add the following:

 

  global $page_title;

 

Note: This is just a hack for your code to make the page title work; as I said it's not really good coding practice.  If you want a more thorough explanation and/or example let me know.

Link to comment
https://forums.phpfreaks.com/topic/195658-page_title/#findComment-1028004
Share on other sites

I usually don't like outputting my template headers from a function, maybe it's just a preference but I find it pretty messy.  What I'll do instead, is something like this:

 

in index.php:

<?
$page_title = "AntEater B.V.";
include "header.php";
?>

All my other body text

<?
include "footer.php";
?>

 

Then, in header.php you would have something like:

 

<?
$page_title = $page_title ? $page_title : 'Default Page Title';
?>
<html>
<head>
<title><?= $page_title ?></title>
....

Link to comment
https://forums.phpfreaks.com/topic/195658-page_title/#findComment-1028490
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.