Condition and keyword

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

By Djulia - January 15, 2008

Hi,

I would like to obtain the value of keyword.

I used Print_r to check if the value were available, but keyword is always given without value.

For :
<xmp><?php print_r($record); ?></xmp>
the value is always : [keywords] =>

I would like to obtain a condition :

<?php if ($keyword == ""): ?> ...

An idea ?

Thank you for your assistance.

Djulia

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: [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