drupaltips's blog

cvs sort

cvs log views.module | grep DRUPAL | sort

taxonomy_term


<?php
$view
= $GLOBALS['current_view'];
$args = $view->args;
print
'<br/>args-0 :' .$args[0];
$terms = taxonomy_get_term($args[0]);
echo
"<xmp>";
print_r($terms);
echo
"</xmp>";
print
'Sorry, there is no content yet tagged for the '. $terms->name .' region. Consider <a href="/node/add/story">submitting</a> an article.'
?>

<?php
$view
= $GLOBALS['current_view'];
$args = $view->args;
$terms = taxonomy_get_term($args[0]);
print
'Sorry, there is no content yet tagged for the '. $terms->name .' region. Consider <a href="/node/add/story">submitting</a> an article.';
?>

Drupal issue bookmark

1. create a bookmark
javascript:inum=escape(getSelection());location.href='http://www.drupal.org/node/'+inum

In this recipe we create a browser bookmark to provide rapid access to drupal issue numbers.

In Firefox, click
Bookmarks >> Organize Bookmarks >> Bookmarks Toolbar
Organize >> New Bookmark

Name: Drupal Issue
Location: javascript:inum=escape(getSelection());location.href='http://www.drupal.org/node/'+inum

Click on a Drupal issue number on a web page. For instance, go to:____ and double click the issue number.

Click Drupal Issue in the bookmark toolbar.

Function Reference for your site

Notable.

The Drupal Devel module offers a Function Reference that is helpful. To display it, enable the Devel module, and then place the Devel block in one of your theme's regions.

You will see a link to Function Reference, which leads to here:
http:/www.yoursite.com/devel/reference

You can, however, customize the function list in a way that may be more helpful.

Theme functions

print '

    ';
    $functions = get_defined_functions();
    foreach($functions['user'] as $function) {
    if(substr($function, 0,6)=='views_' || strstr($function, 'views'))

jQuery bookmarklet to expand all fieldsets

javascript:(function()%20{jQuery('fieldset').removeClass('collapsed');})()

print variables

<?php print '<pre>';
$gvars = get_defined_vars();
print_r(array_keys($gvars));
print
'</pre>'; ?>

print '<pre>'.print_r($node, 1).'</pre>';

Admin Links

<?php

$content = array(
l("Board Minutes", 'node/add/board-minutes'),
l("Bulletin", 'node/add/bulletin'),
l("Committee Documents", 'node/add/committee-documents'),
l("Event", 'node/add/event'),
l("Forum Topic", 'node/add/forum'),
l("Product", 'node/add/product'),
l("Menu item", 'node/add/page'),
l("News Item", 'node/add/news'),
l("Survey", 'node/add/webform'),
l("Another Type of Content", 'node/add'),
l("Logout", 'logout'),
);

$admin = array(
l("Content listing", 'admin/content/node'),
l("Comment listing", 'admin/content/comment'),

Wherefore art thou?

This Drupal 5 hack wraps all the output in HTML comments, so you can see what theme function needs to be overridden. (It's not needed in Drupal 6. Jus use the theme developer there.)

1. Locate includes/theme.inc
2. Locate the theme() function, and edit it to look like this (The new part are the opening and closing comments, surrounded by red type, below.)

<?php
function theme() {
static $functions;
$args = func_get_args();
$function = array_shift($args);

if (!isset($functions[$function])) {
$functions[$function] = theme_get_function($function);
}

Notes from Karen S DrupalCon 2008 presentation

http://www.archive.org/details/DrupalconBoston2008-TrackingEventResultsW...
http://ia341009.us.archive.org/3/items/DrupalconBoston2008-TrackingEvent...

$team_node = node_load($node->field_results_team[0]['nid']);
node_field[0]['value'] = $team_node->title;

$display= strip_tags(content_format('$field_date, '$node_field_item'));

Sample Websnapr link

A nice module in CCK Extras.

Syndicate content