Benjamin Selmer
|
Thursday 19 April 2007 3:15:00 am
I have the following code in the full view template for one of my nodes. The aim is to search without jumping to the search page.
<form action={$node.path_identification_string|ezurl} method="get">
<input class="box" type="text" size="40" name="SearchText" value="" />
<input class="button" type="submit" name="SearchButton" value="{'Search'|i18n('design/ezwebin/content/advancedsearch')}" />
</form>
{if ezhttp_hasvariable('SearchText', 'get')}
{def $search=fetch( 'content', 'search',
hash( 'text', ezhttp( 'SearchText' ),
'section_id', array( '8' ) ) )}
{foreach $search.SearchResult as $search_result}
{node_view_gui view='line' content_node=$search_result}
{/foreach}
{/if}
The problem is that it seems to cache the form variables so that when someone makes a search, that search result shows up every time you view this node. Even if you search for something else, it will still show the result from the first search. http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_operators/data_and_information_extraction/ezhttp#comment6293 I tried disabling the cache with {set-block scope=root variable=cache_ttl}0{/set-block}
but then searching didn't work at all.
|
Fabien Audin
|
Friday 09 April 2010 7:59:56 am
Hello, I have the same problem. But my template begins with {set-block scope=root variable=cache_ttl}0{/set-block}. I have not the following line : {if ezhttp_hasvariable('SearchText', 'get'}. But the result is the same : my first reseach works but not the next research. Do you know what can provoque that?
|
Bertrand Dunogier
|
Saturday 10 April 2010 3:58:58 am
Fabien, what eZ Publish version are you running ? Could you show us your full template ? What happens exactly, instead of just "the next search does not work" ? :)
Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier
|
Fabien Audin
|
Monday 12 April 2010 2:34:01 am
{def $users=fetch('extension', 'liste_annuaire', hash('nom', ezhttp('nom', 'get'), 'prenom', ezhttp('prenom', 'get'), 'societe', ezhttp('societe', 'get'), 'ville', ezhttp('ville', 'get')))}
<div class="contenu_fd">
<div class="titre_bloc_id">
<h2 class="puce_bleue_annuaire">{$node.name|wash()}</h2>
</div>
<div class="text_contenu">
<div class="ss_titrebleu">Rechercher un membre :</div>
<form name='formulaire'>
<table>
<tr><td><div class="libelé_id">Nom : </div></td><td valign="top"><input style="margin-left:10px" name='nom' class="halfbox1" type='text' size='30' value="{ezhttp('nom', 'get')}" /></td></tr>
<tr><td><div class="libelé_id">Prénom : </div></td><td valign="top"><input style="margin-left:10px" class="halfbox1" name='prenom' type='text' size='30' value="{ezhttp('prenom', 'get')}" /></td></tr>
<tr><td><div class="libelé_id">Société : </div></td><td valign="top"><input style="margin-left:10px" class="halfbox1" name='societe' type='text' size='30' value="{ezhttp('societe', 'get')}" /></td></tr>
<tr><td><div class="libelé_id">Ville : </div></td><td valign="top"><input style="margin-left:10px" class="halfbox1" name='ville' type='text' size='30' value="{ezhttp('ville', 'get')}" /></td></tr>
<tr><td> </td><td><input name='soumettre' class="btn_rechercher" src={"rechercher.jpg"|ezimage} type="image" value="submit" /></td></tr>
</table>
</form>
<br />
<div class="ss_titrebleu">Rechercher par nom :</div>
<div id="myList-nav"></div>
<div class="ss_titrebleu">Résultats de votre recherche :</div>
<ul id="myList"> Sometime the first search works I have the searched member but sometime no. I show the get variables values in my page but ezhttp don't get the write values. In the url I have "nom=Audin&prenom=Fabien" but when I show the values with these lines :
Nom: {ezhttp('nom', 'get')} <br />
Prénom: {ezhttp('prenom', 'get'} <br />
Nothing is printed on my page.
|
Fabien Audin
|
Tuesday 20 April 2010 12:35:20 am
Hi all, I have disabled ezpublish's caches and then the get parameters are correctly recovered from the website's URL. If you have one problem, first you have to look at the caches because they could produce several different problems.
|
Nicolas Pastorino
|
Tuesday 20 April 2010 8:28:38 am
Hi Fabien, Indeed, the View Cache probably came in the way of your GET parameters. Thus, disabling it makes it all work. This is however not recommended at all, the performances being seriously degraded. When building front-end, template-based "applications", making use of parameters, you should think of the so-called View Parameters. More on the subject there : http://ez.no/doc/ez_publish/technical_manual/4_x/templates/basic_template_tasks (scroll down to "Custom view parameters"). Cheers,
--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board
eZ Publish Community on twitter: http://twitter.com/ezcommunity
t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye
|