Drupal Theming
Print a form, such as a search form, anywhere in Drupal
Resolved error:
Missing argument 1 for search_box(), called in /sites/example/www/includes/common.inc(1352) : eval()'d code on line 5 and defined in /sites/example/www/modules/search/search.module on line 1037.
This was from code added to a page's content by a client or possibly even the previous developer. We completely redid the site but did copy-paste in some pages.
Aquasoft / MGP-Forum style CSS background graphical menu for Drupal primary links
We first used this technique from the aquasoft theme on a 4.7 site, MGP-Forum, and just used it again, updated for Drupal 5 and with one enhancement by us.
Here's the D5 version from Aquasoft:
<?php
function aquasoft_primary_links() {
$links = menu_primary_links();
if ($links) {
foreach ($links as $link) {
$cssid = str_replace(' ', '_', strip_tags($link));
Show menu in page
Set the input format for your node body or other textarea to PHP code, figure out what the menu ID of the menu item you care about as described by Nick Lewis (from whom all of this is stolen), and then stick this in your content:
<?php
$html = theme_menu_tree(42);
print $html;
?>Ask Agaric: Settings for a Drupal theme without requiring a module
Hi,
I've been breaking my brain over some issue and I cant figure it out so I
figured I'd check with a fellow themer(s?)![Related d.o. thread: http://drupal.org/node/247032 ]
What I'm basically trying to do is use drupal theme settings in a file
that is not processed by drupal, and its part of a theme. I also do not
Drupal theming consulting- Panels and Views questions
Hi Benjamin,
Looking forward to talking tomorrow. I do have some questions ready so I'm inserting them below. I suspect we won't get everything covered in 30 minutes so if you do have time to extend to an hour that might be a good idea. I can pay ahead of time if you wish.
Tools for working with color
Theme admin_menu icon
You don't really need to, because it's set to use the favicon if you've provided one in your theme settings.
But to override this, as described in the admin_menu README, simply copy this function (hidden in admin_menu.inc at the time of this writing) to your template.php file:
<?php
Printing classes for a theme depending on sidebar
<?php
function _phptemplate_variables($hook, $vars = array()) {
switch ($hook) {
case 'page':
// our own hook to remove sidebars from admin pages, not relevant here
if (arg(0) == 'admin') {
$vars['sidebar_right'] = '';
}
// layout for body classes
$vars['layout'] = '';
$layout = '';
//Is there a left sidebar?
Theme Drupal search results
theme_search_item($item, $type)
http://api.drupal.org/api/function/theme_search_item/5
http://drupal.org/node/175013 => Customize the search results page
A separate issue raised in IRC:
now to disable user searching.
[07:50am] ben-agaric: http://drupal.org/node/85137 - Remove tab from search page
Better general instructions for removing a tab: http://drupal.org/node/68792
In template.php, do not paste in opening <?php tag if one has already been opened and the closing ?> tag should be dropped from the end of all Drupal module and theme files per coding standards:
<?php
function phptemplate_search_item($item, $type) {
$output = '
';
$info = array();
if ($item['type']) {
$info[] = check_plain($item['type']);
}
if (user_access('administer content')) {
if ($item['user']) {
Theming the File Attachments in Drupal 5.x
Alrighty then,
If you're reading this then you've probably been searching for a way to theme the default file attachment table in drupal and add cool icons according to the file's mime type, (ie. if it is an mp3 then a music icon will show, if a pdf then a pdf icon, etc)
This is a quick and easy method to help you get this done on your sites and make people think you are cool...
first off, grab the icon files you want to use and put them in a folder called 'icons' in your theme directory.
here is a breakdown how the files should be named, so that they display with the right filetype:
default.gif
image.gif
msword.gif
pdf.gif
rtf.gif
text.gif
vnd.ms-excel.gif
vnd.ms-powerpoint.gif
zip.gif

