dzhax Posted December 8, 2009 Share Posted December 8, 2009 I am making a, kinda basic, blog site for someone i know and I wanna have tags to aid in search.I have it that they type in each tag and in between them they are to put ", " (comma and a space) to separate each tag.I have no problem getting it in the database, it is just printing it out in the format i want it.Basically I am running a query to retrieve all of the blog information (title, body, author, tags...) and I guess I would need to put the tags in an array.I was going to try: $tags = array($row["tags"]); . I was not sure if that would make a correct array or not (according to the format they were typed.My main problem is then making each tags hyperlink and printing to the bottom of the blog post.So when the tag is clicked it will search for similar blogs that have the same tag.ex.video, sony, treevideo would have a hyperlinksony would have a hyperlinkand tree would also have one <a href="?t=video" alt="Tag: video" target="_self">video</a>, <a href="?t=sony" alt="Tag: sony" target="_self">sony</a>, <a href="?t=tree" alt="Tag: tree" target="_self">tree</a> Am I making any sense? Link to comment Share on other sites More sharing options...
Synook Posted December 8, 2009 Share Posted December 8, 2009 You can use explode(). Link to comment Share on other sites More sharing options...
dzhax Posted December 8, 2009 Author Share Posted December 8, 2009 ok i did that to seperate them and now i need to get how many tags there are so it knows when to stop the loop when i echo it to the screen i was using the php manualstr_word_countbut i can not get it to work how i want to.It shows printing 3 arrays of the str_word_count with different parameters and I need the third one. print_r(str_word_count($str, 1, 'àáãç3')); This is the one i need to use so i get the correct amount of tags. can someone help me so i get 6 instead of 7 (like the php manual displays)if i use echo str_word_count($str, 1, 'àáãç3'); all it returns is arraythanks for any help Link to comment Share on other sites More sharing options...
justsomeguy Posted December 8, 2009 Share Posted December 8, 2009 You can use the count function to figure out how many elements there are in the array after you explode the string. Link to comment Share on other sites More sharing options...
dzhax Posted December 9, 2009 Author Share Posted December 9, 2009 wow im retarded... thanks never thought of that. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.