Drupal 6.x

Loop all terms in a vocabulary

function list_all_countries($vid) {
$vid = 1; // Set the vid to the vocabulary id of the vocabulary you wish to list the terms from
$pole = array();
$items = array();
$terms = taxonomy_get_tree($vid);

foreach ( $terms as $term ) {
$count = db_result(db_query("SELECT COUNT(nid) FROM {term_node} WHERE tid = %d", $term->tid));
$pole[]=Array (l($term->name, "taxonomy/term/$term->tid") .

Remove CCK field from a view using template file

This is how to remove a CCK-field with a special condition. If you just want to hide the field in hull node and/or teaser view you can configure it at Manage fields / Display fields at your content type.

Don't forget to refresh your them registry before testing, otherwise you wont see any difference. If you are using the admin menu module ( http://drupal.org/project/admin_menu) you find it in the first menu, Flush all cashes /Theme registry.

Create a file, content-field.tpl.php, in your theme folder.

Add the following content to this file:

Estimating time in Drupal project

Estimating time is indeed difficult. We've had success with applying a
strict method of using fixed amounts of time and breaking tasks down. We
estimate in man hours, and use a fixed scale of units: 1, 2, 5, 10, 20,
50, 100. The rule of thumb is to pick the higher of the two if your
estimate lies between two. If unsure, divide and conquer - break down
the task and estimate each subtask.

It's better with a mix of 10's, 20's and 50's than multiple 100 hour
blocks as the risk of error stands in proportion to the size of the

Modify views filter

If you need to modify views filter from your module, e.g when changing settings to a content type, you maybe whant a CCK autocomplete filed to be filtered as well.


/**
* Change views filter according to saved settings
*
* Thank heaven when you can manipulate views arguments in autocomplete CCK :-)
*
*/
function _save_allowed_node_types($node_types) {

$set_types = array();
foreach ($node_types as $key => $value) {
if ($value != "0") {
$set_types[$key] = $value;
}
}

$get_view = db_query('SELECT vid FROM {views_view}

Pages