Share » Forums » Setup & design » Problem setting a variable default...

Problem setting a variable default when using a ezurl get

Problem setting a variable default when using a ezurl get

Thursday 09 September 2004 9:11:47 am - 6 replies

Author Message

steve walker

Wednesday 06 October 2004 12:49:04 am

Hi there,

Still trying to work this out...

I have code of:

{let carat=ezhttp('search_carat','get')}
{default carat='0.70-0.89'}

to define the variable carat, and its default if no get variable exists. If I try to print the variable $carat with the above code nothing appears. However, if I get rid of the let statement so I have:

{default carat='0.70-0.89'}

The default variable prints out fine. Its as if the get variable exists in some sense even though there is nothing to print out?

Has anyone got a working example of a get with a default setting?

Thanks, Steve.

http://www.oneworldmarket.co.uk

steve walker

Thursday 07 October 2004 1:36:05 am

Hi,

No replies - but would have thought this is possible, if not a pretty usual requirement.

Has anyone had nay experience of setting a default for a variable populated by a GET if it exists? Ez, can you give some input here?

Thanks, Steve.

http://www.oneworldmarket.co.uk

Paul Borgermans

Thursday 07 October 2004 1:53:07 am

Hi Steve

You may try this:

{let carat=first_set(ezhttp('search_carat', 'get' ),53)}
...
{/let}

I haven't tested this but it .. well .. bears some logic

-paul

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

steve walker

Thursday 07 October 2004 3:32:35 am

Tried:

{let cut=(ezhttp('search_cut','get'),53)}

but get error message:

parser error @ design/gia/override/templates/search_stones.tpl:1[8]
Extra characters found, should have been a whitespace or the end of the expression
Characters: '(ezhttp('search_cut','get'),53)'

Any other thoughts?

Regards, Steve.

http://www.oneworldmarket.co.uk

Paul Borgermans

Thursday 07 October 2004 4:43:16 am

Hi Steve,

Didn't you make an error by forgetting the first_set?

This is what works perfectly here (on ezp 3.4.2)

{let cut=first_set(ezhttp('search_cut',get),53)}
cut = {$cut} <br />
{/let}

Also be sure that your syntax is OK in other code fragments (use the template check script if you can)

hth

-paul

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

steve walker

Friday 08 October 2004 9:45:47 am

Paul,

I had missed first_set out.

Its working perfectly now :) - cheers!

Steve.

http://www.oneworldmarket.co.uk

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

36 542 Users on board!

Forums menu