gotit Posted November 16, 2006 Share Posted November 16, 2006 How do I use this code for my page title.<title><?=$page_title?></title> MY site uses PHP and I want certain things from the page to also show as title of page. For example the City, and Type of listing.for example if I want these two information to show in the title: Don't have experience in PHP<? echo $info[listing_style] ?> (string)and/or<? echo $info[listing_address] ?> (string)And once i get the right combination, where Do i put <title> ..........</title> ?thanks. Quote Link to comment Share on other sites More sharing options...
SharkBait Posted November 16, 2006 Share Posted November 16, 2006 <title></title> needs to be placed in the <head></head> section of your page.[code]<?php$myTitle = "This is my website";?><html><head> <title><?php echo $myTitle;?></title></head><body> This is where the content of the website goes</body></html>[/code]As for where you get the information from, it could be set statically like it is in my above example or pulling from a Database such as MySQL which would/could be more dynamic. Quote Link to comment Share on other sites More sharing options...
gotit Posted November 16, 2006 Author Share Posted November 16, 2006 This is what I did, got no title. .<head><?php$myTitle = "This is my website";?><meta http-equiv="Content-Language" content="en-us"><title><?php echo $listing_style;?></title><META NAME="description" And yes the information I want on the title dynamic/veriable from database Quote Link to comment Share on other sites More sharing options...
doni49 Posted November 16, 2006 Share Posted November 16, 2006 That's because echoing the wrong variable. Re-read gotit's message. Quote Link to comment Share on other sites More sharing options...
gotit Posted November 16, 2006 Author Share Posted November 16, 2006 How am I supposed to write this. I've trying this for few days now.I want "[b]listing_style[/b]" and "[b]listing_city[/b]" to go on title.Can u arrange the lines for me?thanks. Quote Link to comment Share on other sites More sharing options...
doni49 Posted November 16, 2006 Share Posted November 16, 2006 <?php$lStyle = listing_style";$lCity = "listing_city";?><title><?php echo $lStyle . " " . $lCity ;?></title>That's what Sharkbait (I misstated it earlier--gotit is the original poster).Just remember, you're using PHP to create the HTML code nothing more. Quote Link to comment Share on other sites More sharing options...
gotit Posted November 16, 2006 Author Share Posted November 16, 2006 <?php$lStyle = "listing_style";$lCity = "listing_city";?><title><?php echo $lStyle . " " . $lCity ;?></title>The page title I got from the code above is "listing_style listing_city" Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted November 16, 2006 Share Posted November 16, 2006 I think you should pick up a PHP programming book and start there. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted November 16, 2006 Share Posted November 16, 2006 defiently. if you look carefully at the php code given. $lStyle is set as listing_style which explains why it is outputing listing_style on your title, the same for listing_city.listen to roopurt18. go learn the basics of php... Quote Link to comment Share on other sites More sharing options...
chiprivers Posted November 16, 2006 Share Posted November 16, 2006 You imply that you already have the variables set fir listing style and listing address, how ever you don't say where you get the information from. If they are already set, you can use:<head><title><?php echo $info[listing_style]." ". $info[listing_address]; ?></title></head>However, you are going to have to make sure the bit of code that you use to declare these variables are positioned before the head tags. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.