How do I create block content that shows a list of links to all my pages from a certain category?
I am vaguely familiar with making blocks and I know how to write sql statements in the traditional sense but I do not know how to write quieries *for drupal*.
The query would look something like this:
Select * from page.nodes where category ='navigation';
And the output I want to look like this:
< a href="page1 url" >page1< / a >
< a href="page2 url" >page2< / a >
< a href="page3 url" >page3< / a >
< a href="page4 url" >page4< / a >
I think I would need an example. I do not know how to write the code to get a query or manipulate the results. I do not know how to format the query for drupal (I do not know the table structures to select from).
Comments
example
here is a block that pulls profile info for a user and displays the array key/values
You get the idea?
mostly
i get the idea. i don't know how to write out the query. does this code, as it is, work in a block? i trimmed it down to what i think i need but the sql is wrong because i made it up out of thin air. i don't know how to write the sql still.
maybe...
This does not add any formatting. I'd suggest NOT using brs but ul li and using CSS. If you have only one term named yourtermnamehere you can replace DISTINCT(n.nid) with the simpler and faster n.nid
--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.
Doh!
Doh! I think I made a mistake. I meant a query to show a list of all the subcategory nodes under a category term.
I'll clarify a little bit more now.
I have a category called, "Subject Matter"
and under that is:
Children & Families (edit term)
Civil Rights (edit term)
Economy (edit term)
Education (edit term)
etc.
Thank you!
hm
there is no such thing as a subcategory node. However, there are things which can be called children of a term. These are printed as
You may want to delete the line marked by /**/, if you do so, delete the +1 from the depth, too. Basic idea for this block comes from the function taxonomy_overview.
--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.
I see
This has been very helpful. Thank you.
I think I got what I needed.