include()

  • astrid+
  • Novice
  • Novice
  • astrid+
  • Posts: 17

Post 3+ Months Ago

Hello all,

I'm trying to set up a webpage that uses the include function, so that instead of going from, say, index.php to index2.php, the visitor will go from index.php to index.php?page=index2

However, I want to know, is there a way to do that and make it so that the
Code: [ Select ]
<title>
of index2 will show up?

Thanks!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

You could use javascript in the 2nd page to change the title...

Code: [ Select ]
document.title = New Page Title";


Search Engines won't get the second title when they crawl your page, but users will.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

You could use something like this in "index.php".

PHP Code: [ Select ]
<title><?php
 
$_GET['page'] = empty($_GET['page']) ? 'index' : $_GET['page'];
 
switch($_GET['page'])
{
    case 'index2':
        echo 'Index Two';
    break;
 
    case 'index3':
        echo 'Index Three';
    break;
 
    case 'index':
    default:
        echo 'Index';
    break;
}
 
?></title>
  1. <title><?php
  2.  
  3. $_GET['page'] = empty($_GET['page']) ? 'index' : $_GET['page'];
  4.  
  5. switch($_GET['page'])
  6. {
  7.     case 'index2':
  8.         echo 'Index Two';
  9.     break;
  10.  
  11.     case 'index3':
  12.         echo 'Index Three';
  13.     break;
  14.  
  15.     case 'index':
  16.     default:
  17.         echo 'Index';
  18.     break;
  19. }
  20.  
  21. ?></title>

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 156 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.