Click to See Complete Forum and Search --> : Page number in Title?


bobafifi
04-17-2006, 11:16 AM
Is there a way to put the page number returned from the dynamically generated pagination ($pageNum) into the Title of the existing HTML?

<?php
echo $first . $prev . "&nbsp; &nbsp; Page <strong>$pageNum</strong> of <strong>$maxPage</strong> &nbsp; &nbsp; " . $next . $last;
?>


Many thanks in advance,


-Bob

NogDog
04-17-2006, 12:38 PM
Do you mean this?

<head>
<title><?php echo $pageNum; ?></title>
</head>

Of course, it means you have to do all your coding that determines the current page before starting to output your HTML.

bobafifi
04-17-2006, 06:27 PM
Do you mean this?

<head>
<title><?php echo $pageNum; ?></title>
</head>

Of course, it means you have to do all your coding that determines the current page before starting to output your HTML.

Thanks NogDog. I figured out this morning that I needed to put the PHP biz above the HTML so that the variables would be accessible. Then it was simply a matter of doing something similar to as you suggested, though I did it like this:

<?=$pageNum ?>

anyhow...

Thanks again! :-)

-Bob

NogDog
04-17-2006, 11:04 PM
The problem with the "short tags" format ("<?= ,,, ?>" instead of "<?php echo ... ?>") is that it will not port to a server that does not have short tags enabled. Therefore if you ever need to move your code to another server, or if you hosting company ever decides to upgrade/change their PHP installation, your code may suddenly stop working.

bobafifi
04-18-2006, 12:14 PM
Thanks NogDog. I've gone ahead and changed them to <?php echo $pageNum; ?> (you obviously know a great deal more about PHP than I do! :-)

Thanks again,

-Bob