Morning o’Code
DrupalJanuary 2009
- change forms using hook_form_alter
- change text on login page
- display teaser field
- variables in template.php
- search for one content type only (he cares, experts only) or search in seminars for seminars only – book + form alter + views in 6
- Different Taxonomy Views for different terms – use views emulated template
- Primary links Menu’s – highlighting active tab (as in zen theme)
- FIles upload management
- block editing activation in template.php module
preprocess_node
<?php
function oranges_preprocess_node (&$variables) {
$variables [‘title’] = substr ($variables[‘title’], 0, 10);
$variables [‘submitted’] = ‘ ‘;
$variables[‘ads’] = theme (‘blocks’,’ads’ );
}
function theme_node_submitted_oranges($node) {
return t(‘Submitted by !username on @datetime’,
array(
‘!username’ => theme(‘username’, $node),
‘@datetime’ => format_date($node->created),
));
}
http://www.lullabot.com/dropbox/stanford/
arg(0)- first argument in url arg() – list of all arguments
SELECT […] MAX(timestamp) – most recent query
two step – function readers_menu() {
$items[‘people/readers’] = array(
‘title’ => ‘Node readers’,
‘description’ => ‘Configure the display of recent readers for each node.’,
‘page callback’ => ‘readers_settings_page’,
‘access arguments’ => array(‘administer nodes’),
);
return $items;
}
in navigation menu reset menu item into menu that you need