Skip to main content

Home/ Drupal for Developers/ Group items tagged function

Rss Feed Group items tagged

Hendy Irawan

Drupal Development - 0 views

  •  
    Drupal Development - Presentation Transcript Drupal Code: Day 1 where am i, and how did i get all these arrays Hi. I'm eaton. Drupal is... http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Drupal Core http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Theme Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ Drupal is... Theme Views Five Star CCK Node Drupal Core User http://www.flickr.com/photos/druclimb/282597447/ name = Demo description = Just a simple demo module. core = 6.x function demo_nodeapi(&$node, $op) { global $user; if ($op == 'view') { if ($node->uid == $user->uid) { $node->title . ' [YOUR ARTICLE]'; } } } demo.info demo.module name = Tricky description = A slightly trickier module. core = 6.x function tricky_form_alter(&form, $form_state, $id) { if ($id == 'node_form') { $title['#required'] = FALSE; } } function tricky_install() { drupal_set_message('You just installed Tricky!'); } tricky.info tricky.module tricky.install views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install sprout.install sprout.admin.inc sprout.inc CHANGELOG README views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install sprout.install sprout.admin.inc sprout.inc CHANGELOG README views.info views.module views.inc user.inc node.inc blog.inc comment.inc ui.info ui.module arguments.inc handlers.inc filters.inc query.inc sprout.info sprout.module forum.inc views.pages.inc table.inc views.install
Daniel Gregoire

Nick Sergeant :: Drupal 6ers… register your theme functions! Here's how. - 3 views

  • <? function name_of_module_theme() { return array( 'name_of_theme_function' => array( 'arguments' => array('items' => NULL) ) ); }
  • <? function theme_name_of_theme_function($items = NULL) { $output = 'hey, this is some output that gets generated when theme_name_of_theme_function($items) is called from somewhere'; return $output; }
Scott Blackburn

Form generation | drupaldocs.org - 0 views

  •  
    Functions to enable output of HTML forms and form elements. Drupal uses these functions to achieve consistency in its form presentation, while at the same time simplifying code and reducing the amount of HTML that must be explicitly generated by modules.
anonymous

Free your content of PHP: Moving PHP code out of blocks, views and nodes | 2bits.com, I... - 2 views

  • From the early days, Drupal had the ability to embed PHP code in its content. This provides flexibility and functionality, most importantly, nodes and blocks can contain dynamically fetched data from the database using custom queries and displayed them in other content. This is an easy approach to get such data without writing a module. All you need to do is assign the PHP input format filter to the node or block and paste your PHP code in it, and voila, you have dynamic content. Code in Content: the issues However, this approach is suboptimal and has serious drawbacks, including:
  •  
    From the early days, Drupal had the ability to embed PHP code in its content. This provides flexibility and functionality, most importantly, nodes and blocks can contain dynamically fetched data from the database using custom queries and displayed them in other content. This is an easy approach to get such data without writing a module. All you need to do is assign the PHP input format filter to the node or block and paste your PHP code in it, and voila, you have dynamic content.
Scott Blackburn

Remove 'Formatting guidelines' | drupal.org - 0 views

  • <?php/** Override filter.module's theme_filter_tips() function to disable tips display.*/function phptemplate_filter_tips($tips, $long = FALSE, $extra = '') {  return '';}function phptemplate_filter_tips_more_info () {  return '';}?>
Daniel Gregoire

drupal_hash_base64 | Drupal API - 0 views

  •  
    Drupal 7 function for generating url-safe sha-2 hashes.
Daniel Gregoire

Apache Solr and Drupal Default's Search | Trellon - 0 views

  • One issue that comes up from ApacheSolr being a separate search page is that the search form does not go to it by default. This is the $search_box in the page.tpl.php template. The way we change this behavior is to add a new submission handler to that form. You can create a custom module for this or put it in your custom theme. <?php/*** Implementation of hook_form_alter()*/function custommodule_form_alter(&$form, $form_state, $form_id) {  // Add submission handler to redirect to apachesolr  if ($form_id == 'search_theme_form') {    // Add a submit, because the search form redirects to a specific place    $form['#submit'][] = 'custommodule_search_submit';  }}/*** Implementation of form submit function*/function custommodule_search_submit($form, &$form_state) {  // Get form ID  $form_id = $form['form_id']['#value'];  // Create new redirect  $form_state['redirect'] = 'search/apachesolr_search/'. trim($form_state['values'][$form_id]);}?>
Csaba Kovács

Perform bulk operations on a custom database table with views | Wunderkraut - 0 views

  •  
    "/** * Implementation of hook_action_info(). */ function mymodule_action_info() { return array( 'mymodule_mytype_delete_action' => array( 'description' => t('Delete mytype'), 'type' => 'mytype', 'configurable' => FALSE, 'hooks' => array( 'mytype' => array('delete'), ), ), ); }"
Hendy Irawan

Eclipse SQL Explorer - 0 views

  •  
    "Eclipse SQL Explorer is a thin SQL client that allows you to query and browse any JDBC compliant database. It supports plugins with specialized functionality for individual databases (Oracle, DB2 and MySQL) and can be extended to include specialized support for other databases. The project started as a fork from the original JFaceDb project which has gone commercial and uses some of the core libraries of SQuirreL SQL. The application is available as a standalone client or as a plugin for Eclipse 3.2."
Hendy Irawan

phplist Integration Module | drupal.org - 0 views

  •  
    This module provides a basic level of integration between Drupal and phplist. one-way synchronisation of user accounts from Drupal to phplist targetting of mailshots using Drupal user profiles users can manage their phplist subscriptions in "My Account" bulk import to phplist for existing Drupal installations anonymous sign-up (via a block), confirm and unsubscribe access to lists based on role NEW in D6-DEV - send mailshots directly from within Drupal (thanks to seutje #449024: future direction) All the functionality of PHPlist is retained - this is just a way of automatically getting Drupal users into the phplist database and incorporating them into any mailshots that get sent.
Scott Blackburn

Wikitools | drupal.org - 0 views

  •  
    This is my wiki module of choice at the moment. It is often useful when developing intranet site to include wiki like functionality.
Daniel Gregoire

Multi-step Forms in Drupal 6 using variable functions | pingVision - 1 views

  •  
    Unique method for handling multistep forms in Drupal.
Daniel Gregoire

The New Way To Generate Hashes In Drupal 7 | Engineered Web - 0 views

  •  
    Explanation of shift away from md5 to sha-2. See links to Drupal 7 api for (really easy) functions for generating url-safe sha-2 hashes.
Fabola smith

Mobile Text Messaging Using Drupal | Ebizon NetInfo - 0 views

  •  
    Explore the true power of Drupal when it integrates the SMS functionality with Drupal websites.
Daniel Gregoire

Programmatically Create, Insert, and Update CCK Nodes | doug | CivicActions - 2 views

  • Always use content_database_info to get the database info. For example:   $field1 = content_database_info(content_fields('yourfield1', 'yourtable'));  $table1 = $field1['table'];  $column1 = $field1['columns']['value']['column'];  $field2 = content_database_info(content_fields('yourfield2', 'yourtable'));  $table2 = $field2['table'];  $column2 = $field2['columns']['value']['column'];  if ($table1 == $table2) {    $sql = "SELECT n.*, t1.$column1, t1.$column2 FROM {node} n ";    $sql .= " INNER JOIN {$table1} t1 ON t1.nid = n.nid AND t1.vid = n.vid";  }  else {    $sql = "SELECT n.*, t1.$column1, t2.$column2 FROM {node} n ";    $sql .= " INNER JOIN {$table1} t1 ON t1.nid = n.nid AND t1.vid = n.vid";    $sql .= " INNER JOIN {$table2} t2 ON t2.nid = n.nid AND t2.vid = n.vid";  }  $sql .= " WHERE n.nid = %d";
  •  
    Important point: Using special functions to let CCK get the proper name of the field (allowing users to make CCK changes in the UI and let your code continue to work).
Scott Blackburn

How to have a content type use a different page layout? | drupal.org - 0 views

  • function newsflash_preprocess_page(&$variables) {  if ($variables['node']->type == "static") {       $variables['template_files'][] = 'page-node-static';  } elseif ($variables['node']->type == "news") {        $variables['template_files'][] = 'page-node-news';  } elseif ($variables['node']->type == "codes") {        $variables['template_files'][] = 'page-node-codes';  } elseif ($variables['node']->type == "jokes") {        $variables['template_files'][] = 'page-node-jokes';  } }
Daniel Gregoire

Programatic CCK Now Possible! | groups.drupal.org - 2 views

  • <?phpfunction mymodule_enable() {     // Get the files content   $filename = drupal_get_path('module','mymodule') . "/mymodule.cck";  $content = implode ('', file ($filename));      // Build form state    $form_state = array(       'values' => array(            'type_name' => '<create>',            'macro' => $content,      ),     );    // Put it in there     drupal_execute("content_copy_import_form", $form_state);}?>
  •  
    Start with comment 54181 - "This works for me in Drupal 6" and read along.
1 - 20 of 25 Next ›
Showing 20 items per page