Jump to content

The Dreaded Arrays


dzhax

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...