ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

search results - how to write "contains" conditional

August 31, 2010 10:31am

Subscribe [2]
  • #1 / Aug 31, 2010 10:31am

    phoebe_reed

    82 posts

    Hi,

    I have a simple search searching about 20 channels.  On the search results page, I need to handle groups of information differently.  I need to sort out the results by weblog/channel name (short_name).

    Specifically, I’m trying to do this:

    Say if weblog name contains “news”—>  do this.
    if weblog name contains “blog”—>  do this.
    if weblog name contains “events”—> do this.

    there are about 8 - 10 weblog/channels that fit each group above.  It is very painful, and I’m not sure about performance, to write out if statements for each separate channel options.

    When I use the conditionals {if weblog_short_name = "blog"} or whatever, it doesn’t work.  Seems that conditionals in that case only take exact matches.

    Any suggestions?  Am I missing a method somewhere or conditionals that I don’t know about?

    thanks for any help!

    Phoebe

  • #2 / Aug 31, 2010 4:39pm

    Ingmar

    29245 posts

    Say if weblog name contains “news”—>  do this.

    Does that mean you have weblogs like news_foo, news_bar etc.?

    When I use the conditionals {if weblog_short_name = "blog"} or whatever, it doesn’t work.  Seems that conditionals in that case only take exact matches.

    Yes, that’s correct. I am afraid there is no “contains” parameter. You would probably have to use PHP with regular expressions for that.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases