Sweets287 Posted July 27, 2008 Share Posted July 27, 2008 for the keywords of my site I pull the information from my database, but i'm struggling to spilt field down into seperate words, so that each word is a keyword as well as a key phrase. It works fine but except for it only uses the last word from the phrase. Any ideas? $string = $title_name; $split_title = explode(" ",$string); foreach ($split_title as $subtitle) { $meta_keywords = ' '.$name .', '.$title_name.', '.$cat1. ', '.$cat2. ', '.$subtitle. ', '.$name.' '.$subtitle.', '.$cat1. ' '.$subtitle. '; } Link to comment https://forums.phpfreaks.com/topic/116841-meta-tag-keyword-help/ Share on other sites More sharing options...
trq Posted July 27, 2008 Share Posted July 27, 2008 For each iteration of the foreach loop you are overiding the $meta_keywords variable. if you would like to add to it use... $meta_keywords .= ' '.$name .', '.$title_name.', '.$cat1. ', '.$cat2. ', '.$subtitle. ', '.$name.' '.$subtitle.', '.$cat1. ' '.$subtitle; Link to comment https://forums.phpfreaks.com/topic/116841-meta-tag-keyword-help/#findComment-600835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.