Note that there are some explanatory texts on larger screens.

plurals
  1. POIf else endif PHP trouble
    text
    copied!<ul> <li>EDITED <em>*</em>*</li> </ul> <p>Hello I am new to PHP and trying to figure out a hack for a Joomla module. </p> <p>For some reason the 'else' statement is not working. I don't understand why...</p> <pre><code> &lt;? if (KRequest::get('get.view', 'string') != 'event' || isset($module)) : ?&gt; &lt;? $desc = $event-&gt;description; ?&gt; &lt;? $desc = preg_replace("/\{[^\)]+\}/","", $desc) ?&gt; &lt;? $desc = substr(strip_tags($desc, '&lt;p&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;&lt;strong&gt;&lt;br&gt;'), 0, 180)?&gt; &lt;? if (strlen($desc) == 180) $desc .= '...'; ?&gt; &lt;div itemprop="description" class="ohanah-event-short-description"&gt; &lt;?=$desc?&gt; &lt;/div&gt; &lt;? else : ?&gt; &lt;!--here is where I want to end it --!&gt;No description. &lt;? $description = $event-&gt;description; // Create temporary article $item =&amp; JTable::getInstance('content'); $item-&gt;parameters = new JParameter(''); $item-&gt;text = $description; $joomlaVersion = JVersion::isCompatible('1.6.0') ? '1.6' : '1.5'; if ($joomlaVersion == '1.5') { $results = JFactory::getApplication()-&gt;triggerEvent('onPrepareContent', array (&amp;$item, &amp;$params, 1)); } else { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $results = $dispatcher-&gt;trigger('onContentPrepare', array ('com_content.article', &amp;$item, &amp;$params, 1)); } $description = $item-&gt;text; ?&gt; &lt;div style="display:none"&gt;&lt;span itemprop="name"&gt;&lt;?=$event-&gt;title?&gt;&lt;/span&gt;&lt;/div&gt; &lt;div itemprop="description" class="full-description"&gt; &lt;?=$description?&gt; &lt;/div&gt; &lt;? endif ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload