I have been trying to learn how to do this but I just can't seem to get my head around this concept. I have tried it in Views. I have tried writing PHP. I have struggled with the database abstraction layer. I just can't seem to grasp it. Here's what I am specifically trying to do.

At http://www.kfol.org/wiki/ I have pages that give instructions on how to do or create things. Each of these pages have a field called PREREQUISITES, which link back to articles describing how to make the prerequisites. For example an article on how to make a peanut butter and jelly sandwich would have a prerequisite of peanut butter, which would link to an article on how to make peanut butter. These links are created by the author when the article is written.

I would like to create a block which dynamically points out possible uses of the product of an article. If peanut butter were listed as a prerequisite for an article, this block would find every instance where peanut butter is listed as a prerequisite and return the page title of those articles. There is a catch here too as I am using revisioning.

This seems like it should be simple, but I just kind seem to find the proper syntax anywhere. Please help me fill in the blanks. Things in {} brackets are things I don't know the syntax for. Numbering is only done for clarity. I think it would go something like this, yes?


1) {GET CURRENT PAGE TITLE}
2) SELECT * FROM {TABLE} WHERE {FIELD PREREQUISITES} LIKE "[["{CURRENT PAGE TITLE}"]]"
3) {OUTPUT RESULT}

Really simple I think. I am just a dummy who can't figure it out. Thanks in advance to anyone who can help with this.

Comments

pyutaros’s picture

What? Does my breath smell? Are my teeth crooked? Or is this really that complicated of a problem?

Drupal's so easy, even I could do it.
http://www.kfol.org/

pyutaros’s picture

Is this one of those cases where one needs to offer a bounty?

Drupal's so easy, even I could do it.
http://www.kfol.org/

pyutaros’s picture

Okay, two cookies for the first person who at least comments on this thread.

Drupal's so easy, even I could do it.
http://www.kfol.org/

pyutaros’s picture

Maybe just a link to the right handbook page to look at? "How to query your database using Drupal's database abstraction layer."

Drupal's so easy, even I could do it (kind of).
http://www.kfol.org/

pyutaros’s picture

I think I have created this thread in the wrong forum, as I'm not getting any bites. My apologies for clogging the General forum with what I now realize is a post installation support question. I have made progress. If you are interested in seeing the solutions, future updates will be in this thread:

http://drupal.org/node/141458

Drupal's so easy, even I could do it.
http://www.kfol.org/