[英]joomla module position if else and
我正在创建一个响应式模板,要实现这一点,我需要使用它,如果不能,请使用它。 到目前为止,这就是我所拥有的。
<?php if ($this->countModules('left')) { ?>
<p>Left + Content</p>
<?php } elseif ($this->countModules('right')) { ?>
<p>Right + Content</p>
<?php } elseif ($this->countModules('left')) && ($this->countModules('right')) { ?>
<p>Left + Right + Content</p>
<?php } else { ?>
<p>Content</p>
<?php } ?>
我现在收到错误:解析错误:语法错误,第197行的index.php中出现意外的&&(T_BOOLEAN_AND)
197行=
<?php } elseif ($this->countModules('left')) && ($this->countModules('right')) { ?>
我尝试添加一个额外的(),但是没有用:
<?php } elseif (($this->countModules('left')) && ($this->countModules('right'))) { ?>
我忘记了什么,但是什么。
您的括号放在错误的位置。 尝试替换以下内容:
<?php } elseif ($this->countModules('left')) && ($this->countModules('right')) { ?>
有了这个:
<?php } elseif ($this->countModules('left') && $this->countModules('right')) { ?>
顺序错误,应该删除集合而不是添加()。 请参阅下面的改编代码。
<?php if ($this->countModules('left') && $this->countModules('right')) { ?>
<p>Left + Right + Content</p>
<?php } elseif ($this->countModules('right')) { ?>
<p>Right + Content</p>
<?php } elseif ($this->countModules('left')) { ?>
<p>Left + Content</p>
<?php } else { ?>
<p>Content</p>
<?php } ?>
希望这能使您走上正确的道路。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.