include()

  • astrid+
  • Novice
  • Novice
  • No Avatar
  • Joined: Jul 13, 2009
  • Posts: 17
  • Status: Offline

Post January 3rd, 2010, 1:23 pm

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
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 3rd, 2010, 1:23 pm

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Joined: Jul 25, 2005
  • Posts: 2735
  • Loc: Nashville, TN
  • Status: Offline

Post January 4th, 2010, 6:21 am

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.
I'd love to change the world, but they won't give me the source code.
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post January 4th, 2010, 10:33 am

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>
Strong with this one, the sudo is.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: Bigwebmaster and 152 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.