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.

"start_on" channel entries tag parameter not working

September 08, 2011 3:49pm

Subscribe [3]
  • #1 / Sep 08, 2011 3:49pm

    TomT

    49 posts

    I have the following code in my template and the channel entries tag is not parsing the start_on parameter at all.

    The purpose is to return the most popular items for the last two weeks, it returns them all.

    <?php $start_time = date('Y-m-d H:i', strtotime("-14 days")); ?>
    <h2><span>Popular Reviews</span></h2>
    <p><div class="clear"></div><br />
    {exp:channel:entries channel="blu_reviews|game_reviews|gear_reviews|literature_reviews|movie_reviews|music_reviews|tv_reviews" limit="3" orderby="view_count_one|entry_date" sort="desc|desc" dynamic="no" start_on="<?php echo $start_time; ?>"}<br />
    {reviews_sidebar_details}<br />
    {/exp:channel:entries}

    Any ideas?

    Thanks.

  • #2 / Sep 09, 2011 2:41am

    John Henry Donovan

    12339 posts

    Hi TomT,

    Is your template set to parse on input?

    Can you try the following? Just leave the view count out of the equation first. Does that work?

    <?php
    $start_time = $this->EE->localize->decode_date('%Y-%m-%d %H:%i', $this->EE->localize->now - 1209600);
    ?>
    <h2><span>Popular Reviews</span></h2>
    <p><div class="clear"></div><br />
    {exp:channel:entries channel="blu_reviews|game_reviews|gear_reviews|literature_reviews|movie_reviews|music_reviews|tv_reviews" limit="3" orderby="entry_date" sort="desc" dynamic="no" start_on="<?php echo $start_time; ?>"}<br />
    {reviews_sidebar_details}<br />
    {/exp:channel:entries}

  • #3 / Sep 09, 2011 10:12am

    TomT

    49 posts

    John,

    My template is set to parse on output.

    If I set it to input the whole thing bombs.

    Does it have to be set on input to get this to work?

  • #4 / Sep 09, 2011 12:55pm

    Mark Bowen

    12637 posts

    Hi TomT,

    When you say that the “whole thing bombs” could you please let me know what you mean by that?

    What happens on your template exactly?

    Did you ensure that you not only selected Input stage but also Yes in the preference next to it?

    Image attached to show what I mean.

    Thanks,

    Mark

  • #5 / Sep 09, 2011 1:00pm

    TomT

    49 posts

    Hey Mark,

    Sorry for being vague.  Anyway, when I set it to input the page doesn’t even load and I get an eval’d PHP code error.  I mean I am definitely doing PHP output stuff on the page so I know setting it to input wouldn’t work.

    I guess my question is more along the lines of is there anyway to get that to work with PHP parsing set to output?

    Even if it’s a hack around?

    Tom

  • #6 / Sep 09, 2011 8:04pm

    Mark Bowen

    12637 posts

    Hi Tom,

    You’ve said that you’re already running some code on this page in Output mode.

    This will be a problem here in that you can’t get a template to do both at the same time. I’m not sure what errors you are getting when you switch to Input mode as you haven’t shown them but that’s probably due to the template needing to be placed on that mode for your other code to work.

    You could perhaps try embedding the code that you need to have working in Input mode and see if that works possibly.

    Does that help at all?

    Thanks,

    Mark

  • #7 / Sep 12, 2011 12:31pm

    TomT

    49 posts

    Mark,

    I have a lot of code in the template that needs to run in output mode so I don’t think I’ll be able to use the start_on parameter with a dynamic date field.

    I wound up just using straight PHP and it works for me.

    Thanks,
    Tom

  • #8 / Sep 12, 2011 12:40pm

    Mark Bowen

    12637 posts

    Hi Tom,

    Glad you have it working now.

    Unfortunately as you have found out it’s not possible to run a template both in Input & Output mode at the same time so you can try and either use an embed (depends on what code you’re running as to whether this will work or not) or you can use straight PHP like you have done in your case.

    I’m going to close this thread out now as you have a solution but if anything else crops up please don’t hesitate to post as required.

    Thanks,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases