I am trying to make a block which shows all the nodes in the category the current node is in. I am not sure what is not working. All I know is that the block never displas. Note that I am using 4.7rc-4. Here is my code:
//limit for number of nodes
$limit = 30;
//the function to get nodes from a certain taxonomy
function get_nodes($tid, $limit) {
$result = db_query(db_rewrite_sql("SELECT node.title, node.nid FROM node INNER JOIN term_node ON node.nid = term_node.nid WHERE term_node.tid = %d AND node.status = 1 AND node.moderate = 0 AND node.promote = 1 ORDER BY node.created DESC LIMIT %d"), $tid, $limit);
while ($anode = db_fetch_object($result)) {
$items[] = l($anode->title, "node/". $anode->nid);
}
if(!$items) {
return;
} else {
$output = "<ul>";
foreach ($items as $item) {
$output .= '<li>'. $item .'</li>';
}
$output .= "</ul>";
return $output;
}
}
//the function to get the taxonomy from the current node
function get_taxonomy()
{
$result = db_query("SELECT tid FROM {term_node} WHERE nid = %n", arg(1));
return db_fetch_object($result)->tid;
}
//the code to display
$result = db_query("SELECT name FROM {term_data} WHERE tid = %d", get_taxonomy());
$t = db_fetch_object($result))
$nodes = get_nodes(get_taxonomy(), $limit);
if ($nodes) {
print $nodes;
print "<br>\n<br>";
}
I want to add color to one of my content node Titles. the html code is not recognized.
is there a workaround for this, or do I have to change some php template somewhere?
Perhaps we need to ensure the code drupal core and conrtibs output valid source....or perhaps it is way past sleep time for me..... :P
Below are the results of checking this document for XML well-formedness and validity.
Error Line 177 column 274: ID "edit-form_id" already defined.
...pe="hidden" name="edit[form_id]" id="edit-form_id" value="user_login_block" .
An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).
✉
Info Line 35 column 46: ID "edit-form_id" first defined here.
...pe="hidden" name="edit[form_id]" id="edit-form_id" value="search_theme_form"
Error Line 184 column 725: element "wbr" undefined.
...ic theming for the taxonomy_menu module
You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:
incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "" element),