Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-25-2007, 04:57 PM
Mosqwik Mosqwik is offline
Newbie
 
Join Date: Sep 2007
Posts: 3
Rep Power: 0
Mosqwik is on a distinguished road
Default Is this possible? (automated browser title)

Hi,
Something that would be really useful for a new project im working on would be to have automated browser titles using some php code in the <title> tags.
The only way I can think of doing this is by having the php code read the url im using for navigation, e.g. /windows/atari2600/ and use that data, edit it and have it display as 'Windows > Atari 2600'
Has this kind of thing been done before? are there any other common ways of doing this? Also are there any tutorials around?
Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 09-25-2007, 10:55 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 19
Posts: 2,736
Last Blog:
Passwords
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John
Default

Assuming you have a file located in the www/windows/atari2600 directory, and the URL is http://www.domain.com/windows/atari2600 here is a possible solution:

PHP Code:
$value $_SERVER['PHP_SELF'
$value will be:
Quote:
/windows/atari2600
Then you can explode the string at the slash:
PHP Code:
$dir explode("/"$value
$dir[0] = windows
$dir[1] = atari2600

Then a simple:
PHP Code:
<title><?php echo $dir[0], "<"$dir[1]; ?></title>
Should do the trick. Of course you can perform string manipulations on $dir[0] and $dir[1] to capitalize the "w" and the "a" but thats a small detail in the big pitcure.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall

Last edited by John; 09-25-2007 at 10:57 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-09-2007, 08:46 AM
fallstoofast fallstoofast is offline
Newbie
 
Join Date: Dec 2007
Location: Belgium
Posts: 2
Rep Power: 0
fallstoofast is on a distinguished road
Default

You could automate that even more and do this

PHP Code:
<?php
$path 
$_SERVER['PHP_SELF'];
$dir explode("/",$path);
$title "";

$z 0;
while(
$z < (count($dir) - 1)){
   if(
$z == (count($dir) -1)){ // you don't want a > on the last dir
      
$title .= $dir[$z];
   }
   else{
     
$title .= $dir[$z]." > ";
   }
}
?>

<title><?=$title;?></title>
That way you could have 10 paths and it'd still work...
__________________


flixey.com, YouTube Downloader
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-09-2007, 11:14 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,135
Rep Power: 16
Lop is on a distinguished road
Default

This may work fine for the page navigation but it is not a very good SEO title. You should think about adding more content.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial - An Internet browser! travy92 VB Tutorials 8 02-17-2008 09:10 PM
Most Used Browser Saint Website Design 54 07-17-2007 07:28 PM
Importance of title tag DevilsCharm Search Engine Optimization 2 04-23-2007 04:47 PM
Visual Studio 2005 and Windows Vista Jordan General Programming 3 01-22-2007 03:21 PM
OidView Pro MIB Browser 2.7 Kernel Software Development Tools 0 09-28-2006 07:12 AM


All times are GMT -5. The time now is 01:36 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
LogicKills ........ 20.00000
sam ........ 20.00000
gaylo565 ........ 18.00000
|pH| ........ 15.00000
WingedPanther ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 67%

Ads