CCK

Drupal Execute progrmatically

  1.  // Insert default user-defined node types into the database.
  2.   // For a complete list of available node type attributes, refer to the node
  3.   // type API documentation at:

custom node template

  1.  <div class="content">
  2.         <?php print content_format('field_buildings_img', $field_buildings_img[0]); ?>
  3.         <?php print check_markup($node->content['body']['#value']) ?>
  4.        

cck variables get printed as null in Drupal 5 view

  1. //in template.php----------------------------
  2.  
  3.  
  4. function phptemplate_views_view_list_promotion_box($view, $nodes, $type) {
  5.   /*
  6.   $fields = _views_get_fields();
  7.  

Inserting a nodereference field into a view.

  1.  // Add the nodereference field if it's not present.
  2.   $nodereference_table = content_views_tablename($nodereference_field);

hook_nodeapi used for validation of CCK fields

  1. <?php
  2. function sitehelper_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  3.    if($node->type == 'cinfo') {
  4.       switch ($op) {
  5.          case 'update':
  6.          break;

Random non-colliding computed field values

  1. $rand = mt_rand(0, 1000000000);
  2. while ((int) db_result(db_query('SELECT COUNT(*) FROM content_type_<content_type_name> WHERE field_<fieldname> = %d', $rand)) > 0) {

Insterting cck multiple value fields into a views list.

  1. ok i have this in my views.tpl.php file
  2.  
  3. <?php print $field_property_images_fid['views_image']['0']['view'] ?>
  4.  
  5. and i did a <?php print_r($field_property_images_fid); ?>

Group By problem

  1. I have a problem when trying to group by a field in my view.

Fix for Display block on specific node type, and set current node ID as view argument for node reference.

  1. <?php  
  2. // Make sure this is a block version of the view, and the current page is a node
  3. if ($view->build_type == 'block' && arg(0) == 'node' && is_numeric(arg(1))) {
  4.        

Fix for cck regex widget

  1. - Widget settings ----------------------------
  2. |
  3. | Widget
  4. | o Text Field
  5. | o Text Area
  6. |
  7. | Label
  8. | [textfield]
  9. | Rows
  10. | [textfield]
  11. | Help text:
  12. | [textarea]
  13. |
  14. | -> Default value
Syndicate content