Condition and keyword

8 posts by 2 authors in: Forums > CMS Builder
Last Post: January 16, 2008   (RSS)

Re: [Djulia] Condition and keyword

By Dave - January 15, 2008

Is keyword the name of a field in the database or a form field?

If it's a form field, you can display it like this:

<?php echo $FORM['keyword'] ?>

also, you can try print_r($FORM);
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Condition and keyword

By Djulia - January 15, 2008

<?php echo $FORM['keyword'] ?>

It is exactly what I seek. [:)]

Thank you, Dave.

Re: [Dave] Condition and keyword

By Djulia - January 15, 2008 - edited: January 15, 2008

I use this condition in order to obtain an error message if no keyword is indicated.

If my search is done on several column, how to build my condition?

For example with "and" or "or" ?

<?php if ($FORM['content_keyword'] and $FORM['tags_keyword'] == ""): ?>
...
<?php else: ?>
...
<?php endif ?>

Thank you for your answer.

Djulia

Re: [Djulia] Condition and keyword

By Dave - January 15, 2008

Looks like you're on the right track. and and or should work. You can also write those as && and ||. What is the condition you want to test?

Note: If you're using the latest version you can search multiple fields for the same keyword like this:

content,tags_keyword

or

title,summary,content_keyword

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Condition and keyword

By Djulia - January 15, 2008 - edited: January 15, 2008

>> Note: If you're using the latest version you can search multiple fields...

You want to say :
<input type="text" name="tags,title,content_keyword" value="" size="15">

That does not function for me.

Djulia

Re: [Djulia] Condition and keyword

By Djulia - January 15, 2008

My excuses, this functions perfectly. [:)]

It is my condition which was incorrect.

Djulia

Re: [Djulia] Condition and keyword

By Dave - January 16, 2008

Oh, that's good news! Thanks for reporting back! :)
Dave Edis - Senior Developer
interactivetools.com