Make each box (not the pages) a separate node with it's own content.
I am using this approach and it's 95% done. I made a new content type, let's call it box and then I made a page. The page is PHP code which fetches the correct box nodes from the DB and displays them.
The page in question is setup like a FAQ where at the top are the questions, each with a link to the answer. The answers are on the same page. I thus loop through the result set twice, once to generate the links and once to generate the answers. OK, I could store the answers in a variable in the first loop and print at the end, agreed.
My question is, however, regarding the body text of my box nodes. I am fetching it thusly:
$result5 = db_query("SELECT body from node_revisions where nid = ".$row->nid.";");
which works, but it returns the raw text, without the <p> tags added. Is there a Drupal function that will add them in for me?
I thought about using contemplate for this, but I don't know how I could do it because I need to loop through the result set twice, or at the least, present the data twice.
Any ideas are appreciated. :)
Thanks.