Forums / Install & configuration / Customise my (search)form

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

eZ debug

Timing: Jan 19 2025 07:19:13
Script start
Timing: Jan 19 2025 07:19:13
Module start 'content'
Timing: Jan 19 2025 07:19:14
Module end 'content'
Timing: Jan 19 2025 07:19:14
Script end

Main resources:

Total runtime1.6238 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 590.5625180.8281
Module start 'content' 0.00611.3755 771.3906576.0234
Module end 'content' 1.38170.2421 1,347.4141340.7734
Script end 1.6238  1,688.1875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.2484210.0002
Check MTime0.00160.0988210.0001
Mysql Total
Database connection0.00090.056910.0009
Mysqli_queries1.541194.90721970.0078
Looping result0.00240.14531950.0000
Template Total1.594598.220.7973
Template load0.00210.130920.0011
Template processing1.592498.062520.7962
Template load and register function0.00010.006910.0001
states
state_id_array0.00140.085310.0014
state_identifier_array0.00170.107620.0009
Override
Cache load0.00180.1136350.0001
Sytem overhead
Fetch class attribute can translate value0.00190.117930.0006
Fetch class attribute name0.00100.062560.0002
XML
Image XML parsing0.00130.083130.0004
class_abstraction
Instantiating content class attribute0.00000.001480.0000
General
dbfile0.00420.2564340.0001
String conversion0.00000.000430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs