Quicksearch results

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Quicksearch results

Post by sonichouse »

I am writing a new template and have a question regarding the search functionality.

1.) At the head of entries.tpl I call

Code: Select all

    {serendipity_hookPlugin hook="entries_header" addData="$entry_id"}
which returns something like
Quicksearch
No Entries Found for Query wibble
Can I test if this emits anything, so I can wrap it in a div if there are results, but not if the list is empty ?

2.) Also in my template I put the following in my index.tpl inside my header

Code: Select all

<form id="searchform" action="{$serendipityHTTPPath}{$serendipityIndexFile}" method="get">
This works for FF, but in IE it just sends me to the index.php page. Any ideas ?
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Steve - take a look at bulletproof's content.tpl. You should be able to get what you want from there.
=Don=
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

Don Chambers wrote:Steve - take a look at bulletproof's content.tpl. You should be able to get what you want from there.
Thanks, managed to do what I wanted. That solves question 1. :wink:

Any idea why the search does not get invoked from IE ?

My test page is here.
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I don't have much time to dig deeply into this Steve, but compare your code carefully to that used in bulletproof....

And do you have your first input field as something like:

Code: Select all

<input type="hidden" name="serendipity[action]" value="search" />
There should be a total of 3 inputs - the hidden one, the box, and the button.

And you have a LOT to do if you are shooting for IE6 compatibility, so you might not even want to worry about this until you tackle other issues.
=Don=
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

Thanks Don,

I had the image as the action field, but IE didn't like it.
I replaced the input with a static image, and all is well.

The IE things are going to be a pain as I only have 7.0 installed :twisted:
Steve is occasionally blogging here
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

sonichouse wrote:The IE things are going to be a pain as I only have 7.0 installed :twisted:
http://browsershots.org/
http://ipinfo.info/netrenderer/

None of these are perfect, but they help a lot.

http://tredosoft.com/Multiple_IE

might be an alternative.

YL
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

yellowled wrote:None of these are perfect, but they help a lot.
http://tredosoft.com/Multiple_IE
might be an alternative.
Thanks, it looks like IE has a problem with max-width directive.

had to do

Code: Select all

.dialog {
 position:relative;
 margin:0px auto;
 min-width:8em;
 width:760px;
}
*>.dialog { 
width: auto; /* ie ignores child selector, modern browsers replace height declaration */ 
max-width:760px;
} 
One last question before I put this to bed for today if I may ???

Can I detect the browser inside the .tpl file or do I have to parse {$smarty.server.HTTP_USER_AGENT} ?
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Steve - see, you just are not paying enough attention to bulletproof!! hehehehe

Just use conditional comments, like BP does, to detect if IE, or even the specific IE version if you have to. We load stylesheets based on the IE version (5, 6 or 7).

The conditional comments are not limited to <head> either - you can use them anywhere.
=Don=
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

Don Chambers wrote:Steve - see, you just are not paying enough attention to bulletproof!! hehehehe

Just use conditional comments, like BP does, to detect if IE, or even the specific IE version if you have to. We load stylesheets based on the IE version (5, 6 or 7).

The conditional comments are not limited to <head> either - you can use them anywhere.
Doh !!!
but re-iventing the wheel is a far greater learning experience - at least it makes me think about it :wink:

But this is only for CSS ? it will not work inside the template ?
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

When it comes to css, you really have 2 choices:

Use css hacks to hide/enforce rules for specific browsers or load a default stylesheet for all browsers, then conditionally load another stylesheet that only a specific browser needs. The second is the route we took with bulletproof.

And lets face it, we are nearly ALWAYS talking about IE.

Your message said you wanted to detect the browser in the tpl, so I assumed conditional comments were the way to go for you. There are also conditional comments that let you apply something to IE specific versions only, other than IE browsers, or even combinations of the two.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

sonichouse wrote:Thanks, it looks like IE has a problem with max-width directive.
Oh, it doesn't just look like it. But it really doesn't have a problem with it. It just doesn't support it in IEs < 7 :twisted: (No min-width, min- or max-height either, BTW.)

Using min- and max-width in my own blog design, I feel it's best to give IE < 7 a fixed width in that case using conditional comments, but you should also know that there are hacks/filters to "emulate" min-/max-width in IE < 7.

YL
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Post by yellowled »

Don Chambers wrote:When it comes to css, you really have 2 choices:
Actually, you have more.

You could do what every web designer is sometime dreaming of but never does: Just ignore any non-standards compliant browser. Which in fact means ignoring IE < 7. But there are way too many people still using IE6 out there (thank God you can at least ignore anything < 6) to really go through with that.

Then there's a fairly new technique which doesn't include extra stylesheets using CCs but assigns different classes to body using them. In my humble opinion, you're still better off with individual IE stylesheets, though.

YL
Post Reply