amendment to launch AdvancedSearch with a text link

robert070612

Joined: 2003-08-05
Posts: 565
Posted: Fri, 2005-10-07 17:27

It's for a minimalist flavour of site. The existing 'Search the Gallery' box is somewhat overpowering. My site needs to use the AdvancedSearch stuff in any case, so I've planned on trying to implement the search facility with a plain old URL.

Existing [albums.tpl]

Quote:
{* System Links only on the root page *}
{if empty($theme.parents)}
<div class="gbSystemLinks">
{g->block type="core.SystemLinks"
order="core.SiteAdmin core.YourAccount core.Login core.Logout"
othersAt=4}

</div>
{/if}

Possible [albums.tpl]

Quote:
{* System Links only on the root page *}
{if empty($theme.parents)}
<div class="gbSystemLinks">
{g->block type="core.SystemLinks"
order="core.AdvancedSearch core.SiteAdmin core.YourAccount core.Login core.Logout"
othersAt=4}

</div>
{/if}

Just don't know how to convert the AdvancedSearch facility into something that can be used as above.

Alternatively what is a generic URL string that would access AdvancedSearch using a conventional link?

----best wishes, Robert

[postedit: re-titled to suit the eventual outcome more appropriately]

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2005-10-14 07:01

I don't understand. You think the current "Serach the Gallery" box is overpowering, but you want it to default the one with more options? Or do you just want it to do advanced search by default?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Fri, 2005-10-14 09:16

Lose the search box. Add a simple text search URL. This goes to a separate (equally minimalist) page featuring just the contents of the Advanced Search facility and any resultant search output. The programming shouldn't be rocket science but there again I'm not a rocket scientist;~)

best wishes, Robert

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2005-10-14 14:27

Ah, that makes sense now. Have you taken a look at editing this template:
/modules/search/templates/blocks/SearchBlock.tpl

As usual, be sure to copy it to /modules/search/templates/blocks/local/SearchBlock.tpl before editing the copy :)
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Fri, 2005-10-14 22:56

Indeed, the search module was the first place I started. Have achieved some cosmetic and presentational aims but I am no closer to being able to working out how render a plain old simple text URL to a separate page of AdvancedSearch and losing the initial searchbox.

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Sat, 2005-10-15 02:28

Yes and no and pretty much almost;~) My base theme (Siriux) has no sidebar and AdvancedSearch iconography is off, it's a minimalist design! But I see what you've done and so have allowed the theme to specify/RadioOn the AdvancedSearch button display. Yes, now that's very much more like it. Amend the texttext stuff from "Advanced Search" to merely "search". The mod now shows a simple 'search' text URL taking the browser to a separate AdvancedSearch page. YES nivekiam! I can't put [solved] in the thread title as I had thought the resolution would involve getting the search text URL in the SiteAdmin YourAccount Login stuff. Since then I have had other plans for that group of stuff and I'll start another amendment thread. Thank you, it's a bit late hereabouts (3.30am) so - tomorrow.
----best wishes, Robert

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Sat, 2005-10-15 15:26

nivekiam----

Re-opening this thread for a single query and then I think I might then be able to put my minimalist flavour into two production sites.

How does the innards of the (form) search box get cursor/edit focus? I'm sorry if I've inadvertently mixed proper programming terminology. I think that's the right sort of term and I'm really not much of a programmer (rocket science or otherwise).

In plain old English: the redirection to the (form) search box forces the visitor to click within the search box before being able to start the input of their search phrase.

What's the automagical wizardry that gets that oh-so-simple piece of realistic ergonomic engineering suitably performed?

Oh... I've diverted part of the recent resolution into another one of your helpful pieces (on breadcrumbing - howto rename the home link). That 'Home' bit has now been metamorphosed into an absolute search URL (straight into the separate AdvancedSearch page) thereby obviating the need for a similar text separately at the bottom of the page. EVEN cleaner looking now.

----best wishes, Robert

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2005-10-15 16:47

I'm not sure exactly. I'd look at the source for google.com :) If that doesn't work then search google:
http://www.google.com/search?q=autofocus+form+field&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official

I'm no javascript expert.

I think, though I'm not sure without testing, you'd edit /modules/search/templates/SearchScan.tpl (as usual, copy to /modules/search/templates/local/SearchScan.tpl and edit the copy)
________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Sat, 2005-10-15 17:07

So, it's a JavaScript thing. Mmmm... dark matter;~/ OK, found something, time to go into a huddle to start the muttering and incantations... I may be some time.

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Sat, 2005-10-15 17:58

Magic potion appears to require me to specify the FORM NAME and the BOX NAME... anyone?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2005-10-15 18:30

The textbox name is: g2_form[formName]

There doesn't appear to be a name assigned to the form. You could probably assign one by editing the SearchScan.tpl file I mentioned above, but it would probably be good to also submit a bug report so it did have a name.

I've been trying to get this working to see what to do, but can't, so if you get it working it would be great if you could post what you did :)
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2005-10-15 18:32

One more thing. You may need to wrap your javascript with:
{literal}
<javascript code here>
{/literal}

So that Smarty doesn't interpret the javascript as smarty template code. Like if you define a function and use curly brackets { }
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Sat, 2005-10-15 18:55

That literally helped;~) What section of the machine hands out the <BODY> parts?

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Sat, 2005-10-15 19:08

/templates/theme.tpl

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Sat, 2005-10-15 22:02

nivekiam----

Haven't cracked it yet. Think I'm pretty close but don't know what is wrong with what I have hacked. Two minds are better than one... The gist of it is that the theme file needs a <body> tag that makes the JavaScript look out for the event. The SearchScan file needs some function stuff included to trigger the awaiting stuff in the theme file.

*insert the onLoad clause

Quote:
[/templates/local/theme.tpl]
</head>
<body class="gallery" onLoad="setFocus()">
<div {g->mainDivAttributes}>

*insert the name clause as it seems to be missing, hopefully this is the correct name

Quote:
[modules/search/templates/block/local/SearchScan.tpl]
<form action="{g->url}" name="g2_form[useDefaultSettings]" method="post">

* insert the new JavaScript stuff

Quote:
[modules/search/templates/block/local/SearchScan.tpl]
{rdelim}
// ]]>
{literal}
function setFocus() {
document.g2_form[useDefaultSettings].g2_form[searchCriteria].focus();
}
{/literal}

</script>
<div class="gbBlock">

At least the above doesn't cause errors but, then again, it doesn't grab focus;~/ Why? And the fix is...

----best wishes, Robert

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Sat, 2005-10-15 22:51

<thinking about this now> We are kind of off topic from your original request. I've tried and tried and can't figure it out. I think we're close and it's probably just some stupid little thing.

Since this is kind of buried you might have better luck starting a new topic with a subject that reflects setting the focus to the search box. It could attract someone who can help you better.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
robert070612

Joined: 2003-08-05
Posts: 565
Posted: Sat, 2005-10-15 23:04

! About half an hour ago I thought the same for a different reason and edited the title to remove the SiteAdmin Login YourAccount stuff. I thought the latter was going to be the likely vector but it was not. Other tweaks elsewhere resolved my thoughts on that.

This thread is still on course - the launching of AdvancedSearch from a text link - and the last detail is likely to be the way it arrives at its target page with this 'focus on load' matter;~)

Am trying to relate the current code with that elsewhere but I have some confusion about the effects of Smarty and the apparent no-name for the form. I strongly believe that what I have done ought to work but, patently obviously, it doesn't. However I'll try your suggestion and post a new narrowly defined topic. I'll feed the answer back here of course.

----best wishes, Robert