Customise my (search)form

Author Message

Nabil Alimi

Wednesday 15 June 2005 5:00:59 am

Hi,

I'm trying to build my own search form...

My template action is itself.

<form action={"/recherche_d_une_formation/"|ezurl} method="get">
	<div class="">Choix d'une fili&egrave;re</div>	
	<select name="filiere">
		<option value=""> Choisir une fili&egrave;re </option>
	{let l_filieres=fetch(content,list,hash(parent_node_id,86,class_filter_array,array(19)))}
		{section var=filiere loop=$l_filieres}
		<option value="{$filiere.node_id}">{$filiere.name}</option>
		{/section}
	{/let}
	</select>
	<div class="">Choix d'un type</div>
		<select name="type">
			<option value=""> Choisir un type </option>
	{let l_types=fetch(content,list,hash(parent_node_id,87,class_filter_array,array(19)))}	
		{section var=type loop=$l_types}
			<option value="{$type.node_id}">{$type.name}</option>
		{/section}
	{/let}
	</select>
	<div class="">Nombre de formations &agrave; afficher</div>
	<select name="page_limit">
		<option value="5">5</option>
		<option value="10">10</option>
		<option value="15">15</option>
		<option value="20">20</option>
	</select>
	<input type="hidden" name="SubTreeArray[]" value="105" />
	<input type="hidden" name="SearchContentClassID" value="14" />
	<input type="hidden" name="searchon" value="1" />
	<input type="submit" class="searchbutton" name="SearchButton" value="Search" />
</form>

How can I retrieve vars from the form ?

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

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 18:31:52
Script start
Timing: Jan 18 2025 18:31:52
Module start 'layout'
Timing: Jan 18 2025 18:31:52
Module start 'content'
Timing: Jan 18 2025 18:31:53
Module end 'content'
Timing: Jan 18 2025 18:31:53
Script end

Main resources:

Total runtime0.5514 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 587.9375152.6250
Module start 'layout' 0.00610.0030 740.562539.4453
Module start 'content' 0.00910.5409 780.0078570.9453
Module end 'content' 0.55000.0014 1,350.953116.1641
Script end 0.5514  1,367.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.6353160.0002
Check MTime0.00150.2788160.0001
Mysql Total
Database connection0.00100.187110.0010
Mysqli_queries0.491789.1695600.0082
Looping result0.00060.1014580.0000
Template Total0.518694.020.2593
Template load0.00210.389720.0011
Template processing0.516593.656420.2582
Template load and register function0.00030.048310.0003
states
state_id_array0.00190.337510.0019
state_identifier_array0.00100.186420.0005
Override
Cache load0.00170.3083350.0000
Sytem overhead
Fetch class attribute can translate value0.00120.223420.0006
Fetch class attribute name0.00110.199160.0002
XML
Image XML parsing0.00150.266720.0007
class_abstraction
Instantiating content class attribute0.00000.003080.0000
General
dbfile0.00200.3662230.0001
String conversion0.00000.001440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs