//修改 menu hook 能够批量添加多个节点的权限 function shipingzhongcustom_menu_alter(&$items) { // Example - disable the page at node/add //var_dump($items);var_dump("DDDDDDDd"); $items['multi_node_add']['access callback']='user_access';
I would put dsm($vars) in a preprocess function in template.php. Just remember if you put it in phptemplate_preprocess_page it will show you the available variables for the page.tpl.php. Likewise if you put it in phptemplate_preprocess_node it will show you the available variables for node.tpl.php.
If you want to see the available variables from a template file, you can also use get_defined_vars(). Use something like:
var_dump(get_defined_vars()); or dsm(get_defined_vars());
下面是drupal6的例子 //-- Delete this line if you want to use this function function shipingzhong_preprocess_page(&$variables, $hook) { //$vars['sample_variable'] = t('Lorem ipsum.');
// To remove a class from $classes_array, use array_diff(). //$vars['classes_array'] = array_diff($vars['classes_array'], array('class-to-remove')); //var_dump(array_keys($vars)); if(arg(0)=='taxonomy' && arg(1)=='term') { if(is_numeric(arg(2))) {
if (node_access('delete', $node)) { db_query('DELETE FROM {node} WHERE nid = %d', $node->nid); db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
drupal_set_message(t('@type %title has been deleted.', array('@type' => node_get_types('name', $node), '%title' => $node->title))); }
<?php /** * Implements validation from the Form API. * * @param $form * A structured array containing the elements and properties of the form. * @param $form_state * An array that stores information about the form's current state