dzhax Posted December 8, 2009 Report Share Posted December 8, 2009 (edited) 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? Edited December 8, 2009 by dzhax Link to comment Share on other sites More sharing options...
Synook Posted December 8, 2009 Report 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 Report Share Posted December 8, 2009 (edited) 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 Edited December 8, 2009 by dzhax Link to comment Share on other sites More sharing options...
justsomeguy Posted December 8, 2009 Report 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 Report 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
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now