开发者

PHP if else statement using SimpleXML

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 t开发者_StackOverflow中文版o 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>


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜