Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1660 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

php no "-" in the title of the page

Thread title: php no "-" in the title of the page
Closed Thread    
    Thread tools Search this thread Display Modes  
11-01-2007, 09:12 PM
#1
EnDLeSs is offline EnDLeSs
EnDLeSs's Avatar
Status: Junior Member
Join date: Aug 2007
Location:
Expertise:
Software:
 
Posts: 33
iTrader: 1 / 100%
 

EnDLeSs is on a distinguished road

  Old  php no "-" in the title of the page

ok so I have a php script which uses the pages name as the title using this code

PHP Code:
<title><?php if(!isset($http_title)) { echo $pg_title; } else { echo $http_title; } ?></title>
But if the page is called BLah-Blah.html the title will be "BLah-Blah"

Does anybody know what I can do so that the "-" turns in a empty space for the title.

11-01-2007, 09:20 PM
#2
Jeff Andersen is offline Jeff Andersen
Status: Superstar
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 4,449
iTrader: 10 / 100%
 

Jeff Andersen is on a distinguished road

  Old

PHP Code:
$title "Blah-BLAH";
$newtitle str_replace('-',' '$title); 

[edit, I guess this was my 4000th post]

11-01-2007, 09:37 PM
#3
EnDLeSs is offline EnDLeSs
EnDLeSs's Avatar
Status: Junior Member
Join date: Aug 2007
Location:
Expertise:
Software:
 
Posts: 33
iTrader: 1 / 100%
 

EnDLeSs is on a distinguished road

  Old

Got it to work after missing around with your php code ;]

Thnx a lot Jeff! ;]

11-09-2007, 02:25 AM
#4
bluesaga is offline bluesaga
Status: Member
Join date: Feb 2007
Location:
Expertise:
Software:
 
Posts: 137
iTrader: 1 / 100%
 

bluesaga is on a distinguished road

  Old

Just a word of advice, it is best to do all workings outside the html even if its just above it would be better:

PHP Code:
<?php
if(!isset($http_title)) 

 
$szTitle str_replace(' ''-'$pg_title); 

else 

 
$szTitle str_replace(' ''-'$http_title); 
 }
?>

<title><?php echo $szTitle?></title>
The above is much more readable, and nicer to come back to when you want to make a change 3 years down the line!

Closed Thread    


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

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed