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 and stop_before (excluding entries from search results if made within last 30 days)

May 06, 2010 1:31pm

Subscribe [1]
  • #1 / May 06, 2010 1:31pm

    compass360

    13 posts

    I have a weblog and a specific page (template) that outputs all of its entries. I am using the “stop_before” parameter on this page to tell the weblog:entries query to EXLUDE entries made in the last 30 days. This is because my client wants to be able post entries as the information becomes ready for release, but only wants the general public to be able to view a limited listing of this information (nothing as recent as the past 30 days).

    So my template is set up and working beautifully with the stop_before parameter and the following PHP to calculate a stop_before date/time:

    <?php
    global $LOC;
    $current_time = $LOC->decode_date('%Y-%m-%d %H:%i', $LOC->now - 2592000);
    ?>
    {exp:weblog:entries weblog="reports" orderby="date" sort="desc" limit="30" paginate="bottom" stop_before="<?php echo $current_time; ?>" disable="member_data|trackbacks"}

    But the problem is… I am also using the search module to allow users to search through all of the website’s content, and of course this searches all data in the database, including any posts that have been made in the last 30 days for this specific weblog.

    I have many weblogs that make up this site, and don’t want to limit ALL search results to exclude entries in the last 30 days, but DO want to exclude entries made in the last 30 days in this ONE specific weblog from displaying in the search results.

    Is this possible? Am I missing something obvious?

    Any help is greatly appreciated! I’d like to not have to tell my client “just don’t post anything until you want it to appear on the site”.

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

ExpressionEngine News!

#eecms, #events, #releases