hi all
I've just search and tried to something do all day but i couldn't do it, so i decided to write my issue to the forums.
i have a query that returning just one node info which is the latest article and also having a taxonomy vocabulary condition.
i just want to show body of the node in the content.
because, i have 7 primary link ( content ), they will be the main page for a taxonomy term, and when i add a new content, i want to show just new content body in its primary content ( main page of the taxonomy term ) page.
here is my sql,
select node.nid AS nid,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format
FROM node node
LEFT JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
JOIN ( select max(nid) as nid from (
SELECT node.nid AS nid,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format
FROM node node
LEFT JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (term_data.vid in ('11')) ) foo) faa ON node.nid = faa.nid
WHERE (term_data.vid in ('11'))
i've try to write a snippet;
$result1 = pager_query(db_rewrite_sql("select node.nid AS nid,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format
FROM node node
LEFT JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
JOIN ( select max(nid) as nid from (
SELECT node.nid AS nid,
node_revisions.body AS node_revisions_body,
node_revisions.format AS node_revisions_format
FROM node node
LEFT JOIN term_node term_node ON node.vid = term_node.vid
LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (term_data.vid in ('11')) ) foo) faa ON node.nid = faa.nid
WHERE (term_data.vid in ('11'))"));
$node = db_fetch_object($result1);
$output2 = node_view(node_load(array('nid' => $node->nid)), 1);
print $output2;
and make a page and add snippet to content (of course I've choose "Input format"->"PHP code"
and get some errors...
Comments
Why not use the views module?
Why not use the views module?
how can i change any existing
how can i change any existing content body by view?