alconebay Posted April 3, 2008 Share Posted April 3, 2008 Say I have a car website and the structure of the page titles will always be something like: "The Carguide's Camero Information." All my page titles will follow this format so I want to be able to assign the third word of the page title (in this example, "Camero") to a variable that I can use throughout the page. Is this where that "explode" function comes in? Thanks Quote Link to comment Share on other sites More sharing options...
Xil3 Posted April 3, 2008 Share Posted April 3, 2008 Say I have a car website and the structure of the page titles will always be something like: "The Carguide's Camero Information." All my page titles will follow this format so I want to be able to assign the third word of the page title (in this example, "Camero") to a variable that I can use throughout the page. Is this where that "explode" function comes in? Thanks I guess you could use explode... not sure how your code is layed out though... $t = "The Carguide's Camero Information."; $t_arr = explode(" ", $t); echo $t_arr[2]; // Camero Quote Link to comment Share on other sites More sharing options...
alconebay Posted April 3, 2008 Author Share Posted April 3, 2008 Thanks! That works beautifully. Here is how I'm using it in my site: <head> <?php $title="The Carfan Camero Page"; $title_arr = explode(" ", $title);?> <title><? echo $title; ?></title> </head> <html> Welcome to the <? echo $title_arr[2]; ?> page of Carfan. </html> 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.