OK i'm on the last legs of conveting a CSS theme to drupal and its nearly there.

I have a search box that is displayed using the following in page.tpl.php :-

Search Example: Port Talbot Chat   

How do i get this to interact with the drupal search ?

My search bar can be seen at http://82.16.165.102

Any help appreciated.

Comments

nofue’s picture

Servus.

I hope I understood your question right...

To enable search you must have a cron job set up on your server, examples of how to set it up are plenty in the handbooks sections and in the installation "manual".

If it is about theming the search field, I simply created my own classes for this purpose. It's an input field, and you may tag it to your liking.

<input class="mySearchField" ...>

In the CSS (style.css) you'll use

.input mySearchField {
...
}

The search form is defined in misc/drupal.css using two statements

...
.search-form {
margin-bottom: 1em;
}

.search-form input {
  margin-top: 0;
  margin-bottom: 0;
}
...

Hope this was the right answer for you,

Norbert

-- form follows function

Norbert

-- form follows function

desm0n’s picture

Thanks taking the time to reply.
I understand your confusion now as my div code never posted (oops) :).

Anyway i have the following defined in a theme

		<div class="search_field">		
			<form method="post" action="?">
				<p><span class="grey">Search Example:</span> <span class="search">Port Talbot Chat </span>&nbsp;&nbsp; 
				  <input type="text" name="search" class="search" /> <input type="submit" value="search" class="button" />
				</p>
			</form>
		</div>

This is currently hardcoded into the page.tpl.php file. But i'm at a bit of a loss how to turn this into a functioning search box within drupal (keeping that style).

Any help appreciated.

Caesar Tjalbo’s picture

http://api.drupal.org/apis/HEAD/search
Theming can be done via CSS.
(A totally irrelevant sidenote: your button seems to be 1 pixel higher than the textinput of your search)

desm0n’s picture

Hi caesar and thanks for joining in to help.

I really don't understand all that api stuff in all honesty and how to implement any of that to good use. I'm sure there is a wealth of knowledge there (it blows my mind away) but it just doesn't ring any bells for me :(

desm0n’s picture

OK i've achieved this by hard coding the form into page.tpl.php doing the following :-

<div class="search_field">								
<form action="?q=search/node/"  method="post">
<p><span class="grey">Search Example:</span> <span class="search">Port Talbot Chat </span>&nbsp;&nbsp; 
 <input type="text" maxlength="128" name="edit[search_theme_form_keys]" id="edit-search_theme_form_keys"  size="15" value="" title="Enter the terms you wish to search for." class="search" />
<input type="submit" name="op" value="Search"  class="button" />
<input type="hidden" name="edit[form_id]" id="edit-search-theme-form" value="search_theme_form"  />
</p></form></div>

Now one question.

This uses the unfriendly url for the search but on my test system friendly urls are disabled. Is there a way to define the url depending on whether urls are friendly or not ? On my live system the search would be search/node/ and on a normal system ?q=search/node/

nisguy’s picture

If you are using the standard PHP Template engine you may want to read through the Theme Developer's guide. In there I saw this:

<?php if ($search_box): ?>
  <form action="<?php print url("search") ?>" method="post">
    <div id="search">
      <input class="form-text" type="text" size="15" value="" name="keys" /><input class="form-submit" type="submit" value="<?php print t("Search")?>" />
    </div>
  </form>
  <?php endif; ?>
scor’s picture

This is more up to date : http://drupal.org/node/45295