1

I'm generating our Events pages using SimpleXML. Some of the Events take place only on one day while others occur repeatedly. I'm stuck trying to write an if-else statement.

If there's a repeating event, repeatRuleID will equal 1. If not, it will equal 0 (and the event takes place only once).

My question is, how can I edit the code below to say, for example, "through July 15" OR "on August 1" (obviously using the XML dates).

Here is my page, XML (single and repeating events) and code:

<h3><?= $event->title ?></h3>
<p><strong>
    <? if ($event->repeatRuleID=1): ?>
        through <?= $event->repeatUntilDate ?>
    <? else: ?>
        <?= $event->beginTime ?>
    <? endif; ?>
</strong></p>
<p><?= $event->locationText ?></p>
3
  • 1
    I am guessing this is a typo: ($event->repeatRuleID=1) and it should be ($event->repeatRuleID==1) Commented Jun 28, 2011 at 22:54
  • I updated the page with $event->repeatRuleID==1 - unfortunately this doesn't return "through <date>" on repeating events. Any idea what I'm doing wrong? Commented Jun 28, 2011 at 23:11
  • what it does then?? keeps outputting the begin time?or nothing at all? Commented Jun 28, 2011 at 23:57

1 Answer 1

2

Looks like $event->repeatRuleID=1 should contain 2 = like $event->repeatRuleID==1, as your assigning a value which always evaluates to true, you not to use the comparison operator to check the value's

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.