Drupal 5

Where in the theme are the tabs printed / giving tabs to admins only

Key words and phrases: 
Drupal tabs local tasks where printed by theme? phptemplate_variables page phptemplate node page tabs give tabs to admins only
Description & Info: 

On giving View, Edit, Revision, etc. tabs to administrators only.

In Drupal, tabs are not printed by the node, but by the page. On the one hand, since views and administrative pages and anything else you can think of can have tabs, this makes sense. But on the other hand every node can have

by Benjamin Melançon
Posted on Thu, 2008-08-14 06:06
in

Sidebar graphics with links ("promotional badges") the Agaric Drupal way

Key words and phrases: 
show graphics in sidebar on certain pages linked to featured sections easily change graphics in specific sidebar block regions
Description & Info: 

A note of warning about the length of notes to follow: This is site configuration at the point where it verges on developer documentation, such is the power of Drupal, and there's some outright theming in here too. This article is a reaction to doing sidebar graphics the painfully non-Drupal way.

Fastest way to get just one result from a database table in Drupal

Key words and phrases: 
db_fetch single result string from Drupal database db get one value short function to return one database data or, rather, datum
Description & Info: 

To get a single value result – one row from a just one column – the Drupal function for that is db_result(), which takes the result of db_query() as an argument.

http://api.drupal.org/api/function/db_result/5

So the fastest way to get a single result (please pardon the awkwardly named function) would look like this:

<?php

How to theme a Drupal form

Key words and phrases: 
Howto theme Drupal forms themeing input forms user_register with bio module
Description & Info: 

Update: This tutorial has been revised significantly to provide a robust solution consistently works.

Define a function named your_theme_name_ or phptemplate_ plus name_of_form($form).

Display a Drupal login form anywhere with PHP, including in page content

Key words and phrases: 
show Drupal user login form display user registration form in page signup form custom placement
Description & Info: 

Update: I gave slightly incorrect code, I'm pretty sure swapping out 'user_register' to put in 'user_login' will work just fine:

dan hak 3:08
whats the code for the login block

benjamin melançon 3:09

<?php
global $user;
if (!
$user->uid) {
?>

<div class="user-register">

<?php
print drupal_get_form('user_register');
?>

</div>

Ask Agaric: Upload photos and display them on a page with introduction

Key words and phrases: 
Drupal image module page of pictures photograph display gallery adding photos making a photo-heavy page
Description & Info: 


Hi Ben,

I have some things like photos and some audio files and whatnot I could add to the site.

How do I know where something will end up and how it will be listed on the menus? For some reason I haven't figured that out.

by Benjamin Melançon
Posted on Tue, 2008-02-19 13:17
in

How to theme (lots of) views the Agaric Way

Key words and phrases: 
avoid redundant Views code in template.php view callback views phptemplate
Description & Info: 

I3IVIIVI: now, take a look at the template.php file
(10:20:54 AM) Dan Hak: you took out repeating code?
(10:21:15 AM) I3IVIIVI: yes, exactly
(10:21:22 AM) I3IVIIVI: the code that you knew was repeating
(10:21:35 AM) I3IVIIVI: because you weren't even copying it from the wizard anymore
(10:21:49 AM) I3IVIIVI: you were just changing that one spot :-)

In template.php – the generic function followed by an example of a specific invocation. Automatically using a views-list-thememe.tpl.php file if it exists is not implemented with this code.

<?php
/**
* Generic function to theme views, invoked by view-specific callbacks.
*
* Based on code generated by the views theming wizard

Serving up a different page.tpl.php for different browser types (i.e., IE6) with your Drupal theme

Key words and phrases: 
drupal browser detection switch theme php browser detect and change theme presented Drupal return different theme for mobile browsers Drupal template.php switch page.tpl.php IE6 overlap on narrow screens Microsoft Internet Explorer 6 is evil
Description & Info: 

if you figure out just the most major IE issues
that would be good enough

Remixing Drupal the Agaric Way: Multilingual Panels

Key words and phrases: 
i18n moddule panels i18n agaric
Description & Info: 

Step 1: Find a function that does some or most of what you want.
Step 2: Find another function that does the rest of what you want.
Step 3: Mash them together.

The situation this time: we have a Drupal 5 site (World Social Forum 2008) with i18n (internationalization module) and need translated content to show up in panels.