I've designed a couple of Drupal themes for version 5 and 6 without any knowledge of PHP. Thanks to the simplicity of Drupal. The problems I'm having right now have to deal with two things:

1. Theming the search box
2. Hiding the search box module name.

1. I was able to customize the look of the search box, by using this code in my style.css file:

div.content input.form-text
{
width: 137px;
height: 25px;
border: none;
padding: 0;
margin: 0;
background: url(images/searchbox.jpg) no-repeat;
}

div.content input.form-submit
{
width: 63px;
height: 25px;
border: none;
padding: 0;
margin: 0;
background: url(images/searchbutton1.jpg) no-repeat;
}

Here is what I want it to look like:
http://www.cnariostudios.com/porfolio/2.jpg

but when I insert the php search code it creates a very big gap like this:
http://www.cnariostudios.com/porfolio/1.jpg

I want to get rid of the Module name so that the gap will be minimized. How do I do that.

Another issue is that the custom images are displayed well in Internet Explorer, but scattered in Mozilla like shown above. Does it have anything to do with the css above.

I'll appreciate your help, as my website needs serious reconstruction, and I want to power the new version with drupal.

Comments

shawn.sh’s picture

In D6 you can add something like this to your template.php to override the search form theme function and take out the "Search" at the top.

// SEARCH

function default_theme() {
  return array(
    'search_theme_form' => array(
      'arguments' => array('form' => NULL),
    ),
  );
}

function default_search_theme_form($form) {
    // deactivate the title of the form
    unset($form['search_theme_form']['#title']);
    $output .= drupal_render($form);
    return $output;
}

When theming the search form you may want to attach your css rules to the #search-theme-form id selector.

One more thing, you don't have to know a lot of PHP but you should learn to at least use it within the context of Drupal, especially with the template.php file, if you really want add some real Drupal power to your sites.

--
Shawn Gregg

gmndesign.com - portfolio
shalosophy.com - blog

cnario’s picture

I did, but the word "search" is still displayed.

Here is my template.php file:


// SEARCH

function default_theme() {
  return array(
    'search_theme_form' => array(
      'arguments' => array('form' => NULL),
    ),
  );
}

function default_search_theme_form($form) {
    // deactivate the title of the form
    unset($form['search_theme_form']['#title']);
    $output .= drupal_render($form);
    return $output;
}


shawn.sh’s picture

1. The problem could be that you need to change "default" to the name of your theme. So you can try it again but instead of function default_theme() it's function YourThemeName_theme() (you do that for both functions).

2. It could also be that you are using the search block and not actually printing the search form from within your page.tpl.php using print $search_box; . In that case just change the snippet in the template.php file to:

<?php
// SEARCH
function YourThemeName_theme() {
  return array(
    'search_block_form' => array(
      'arguments' => array('form' => NULL),
    ),
  );
}

function YourThemeName_search_block_form($form) {
    // deactivate the title of the form
    unset($form['search_block_form']['#title']);
    $output .= drupal_render($form);
    return $output;
}

You may also want to go to the blocks page and give your search block the title of <none> so the word "Search" doesn't show up in your theme.

--
Shawn Gregg

gmndesign.com - portfolio
shalosophy.com - blog