Share » Forums » Install & configuration » Customise my (search)form

Customise my (search)form

Customise my (search)form

Wednesday 15 June 2005 5:00:59 am - 3 replies

Modified on Monday 20 June 2005 2:52:59 am by Nabil Alimi

Author Message

Paul Borgermans

Wednesday 15 June 2005 8:46:31 am

Hi

That is easy (really) :-)

Just turn off caching for this particular template and use the template operator ezhttp:

http://ez.no/ez_publish/documentation/reference/template_operators/data_extraction/ezhttp

To disable caching, use

{set-block scope=root variable=cache_ttl}0{/set-block}

at the start of your template

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Nabil Alimi

Thursday 16 June 2005 4:02:26 am

That works fine, thanks Paul.

But now, I have an other little problem.

I'd like to make search on a relation of my class.

So. I have my class "formation" (the main) witch has a
relation with class "type".
I found that the node_id of the type linked with my formation was stored in $node.object.data_map.type.content.main_node_id .
I'd like to make my search on this criteria. By displaying only "formations" having type "long" whose node_id is "91" for example.

So is there a way to test this directly in the fetch function ? Or will I have to had a "{section show..." statement ?

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Nabil Alimi

Wednesday 22 June 2005 1:58:37 am

Hi,

If I want to create a custom search form that calls back the same template, am I forced to use the default search.tpl ? Cause I've tried something and it doesnt seem to work...

{set-block scope=root variable=cache_ttl}0{/set-block}
<form action={"/recherche_d_un_centre/"|ezurl} method="get">
<label>Nom du centre : </label>
<input class="searchbox" type="text" size="8" name="SearchText" id="Search" />
<input class="searchbutton" name="SearchButton" type="submit" value="Rechercher" />
<input type="hidden" name="SearchContentClassID" value="26" />
<input type="hidden" name="SearchContentClassAttributeID" value="244" />
</form>
{let src_txt=ezhttp('SearchText','get') src_class_attribute_id=ezhttp('SearchContentClassAttributeID','get') src_content_class_id=ezhttp('SearchContentClassID','get')}
	{$src_txt} {$src_class_attribute_id}
	{section show=is_set($src_txt)}
		{let search=fetch(content,search,
		                      hash(text,$src_txt,
		                           subtree_array,array(113),
								   class_id,$src_content_class_id,
		                           class_attribute_id,array($src_class_attribute_id))) 
								   }
			{let search_result=$search['SearchResult']}			   
			{section loop=$search_result var=un_resultat}
				{$un_resultat.number}{$un_resultat.name}
			{/section}
			{/let}
		{/let}			
	{/section}
{/let}

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu