Start- and stopdate for loopitems in WebYep

General discussions about WebYep
Post Reply
Posts: 2
Joined: Wed Oct 13, 2010 11:05 pm

Start- and stopdate for loopitems in WebYep

Post by TicTaco » Wed Oct 13, 2010 11:11 pm

Is it possible to set a date from where a loopitem will start showing? And stop showing?

That would be a major improvement for clients to edit articles for the future. Must be possible with PHP I think.



Objective Development
Objective Development
Posts: 815
Joined: Fri Nov 10, 2006 4:39 pm

Re: Start- and stopdate for loopitems in WebYep

Post by johannes » Tue Nov 02, 2010 4:30 pm

Currently this is not a feature of the WebYep Loop Element.

But here's a piece of PHP code, that could do that:

Code: Select all

<?php foreach (WYLoopElement::aLoopIDs("Loop") as $webyep_oCurrentLoop->iLoopID) { $webyep_oCurrentLoop->loopStart(true); ?>
  if (webyep_bIsEditMode()) {
    echo "<div>";
    echo "Publication Start: ";
    webyep_shortText("PublicationStartDate", false);
    echo "<br />Publication End: ";
    webyep_shortText("PublicationEndDate", false);
    echo "</div>";
  if (webyep_bIsEditMode() || (
        strtotime("now") >= strtotime(webyep_sShortTextContent("PublicationStartDate", false)) ||
        webyep_sShortTextContent("PublicationStartDate", false)== ""
        strtotime("now") < strtotime(webyep_sShortTextContent("PublicationEndDate", false)) ||
        webyep_sShortTextContent("PublicationEndDate", false)== ""
  )) {
<h2><?php webyep_shortText("Headline", false); ?></h2>
<div><?php webyep_richText("Text", false, "", true); ?></div>
<?php } // endif date ?>
<?php $webyep_oCurrentLoop->loopEnd(); } ?>

It packs a Loop of one Short and one Rich Text Element into a conditional statement that lets the user input two dates - between these dates the loop block will be visible.

Post Reply