Note that there are some explanatory texts on larger screens.

plurals
  1. POconcrete5 - jQueryUI in Edit mode
    text
    copied!<p>I use carousel plugin that depends on jQueryUI. To have it loaded I simply use <a href="http://www.concrete5.org/marketplace/addons/load-jquery-ui/" rel="nofollow">Load jQueryUI addon</a> from marketplace.</p> <p>Edit - To be more exact. What happens is:</p> <p>A. when <code>problematic.js</code> is loaded directly - without any <code>if</code>: carousel doesn't work when user is logged in and content of top bar ("Edit", "Dashboard") dissapers, so it is even impossible to go into Edit Mode</p> <p>B. when <code>problematic.js</code> is loaded with such condition: </p> <pre><code>if (!$c-&gt;isEditMode()){ ?&gt; &lt;script type="text/javascript" src="problematic.js"&gt;&lt;/script&gt; &lt;?php } ?&gt; </code></pre> <p>exactly as above: carousel doesn't work when user is logged in and content of top bar ("Edit", "Dashboard") dissapers, so it is even impossible to go into Edit Mode</p> <p>C. when <code>problematic.js</code> is loaded with such condition: </p> <pre><code>&lt;?php $u = new User(); if (!$u-&gt;isRegistered()){ ?&gt; &lt;script type="text/javascript" src="problematic.js"&gt;&lt;/script&gt; &lt;?php } ?&gt; </code></pre> <p>content of top bar is present, it is possible to turn page into Edit Mode but obviously js file is not executed when user is logged in.</p> <p>However that's not what I need - I want my script to be working when:</p> <ol> <li>user is not logged,</li> <li>user is logged into website but page IS NOT in edit mode.</li> </ol> <p>I want script NOT to be executed when page IS in Edit Mode ONLY.</p> <p>How should I achieve this?</p> <p>Edit: Here's part of PHP/HTML code:</p> <pre><code>&lt;?php defined('C5_EXECUTE') or die(_('Access Denied.')); ?&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;?php Loader::element('header_required');?&gt; &lt;script type="text/javascript" src="&lt;?php print $this-&gt;getThemePath(); ?&gt;/js/respond.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="&lt;?php print $this-&gt;getThemePath(); ?&gt;/js/jquery.ui.rcarousel.min.js"&gt;&lt;/script&gt; &lt;?php $u = new User(); if (!$u-&gt;isRegistered()){ ?&gt; &lt;!-- To prevent conflicts with C5 jQuery UI when in edit mode --&gt; &lt;script type="text/javascript" src="&lt;?php print $this-&gt;getThemePath(); ?&gt;/js/home.js"&gt;&lt;/script&gt; &lt;?php } ?&gt; &lt;link rel='stylesheet' type='text/css' href="&lt;?php print $this-&gt;getStyleSheet('css/style.css'); ?&gt;" /&gt; &lt;meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1' /&gt; &lt;/head&gt; &lt;body &lt;?php if ($c-&gt;isEditMode()) { ?&gt; class='editmode' &lt;?php } ?&gt;&gt; &lt;div class='c5wrapper'&gt; &lt;div id='container'&gt; &lt;div id='content-promo' class='content-promo full-width'&gt; &lt;div id='carousel-wrapper' class='content-promo carousel-wrapper'&gt; &lt;?php $a = new Area('Carousel'); $a-&gt;display($c); ?&gt; &lt;/div&gt; &lt;!-- End of carousel wrapper --&gt; &lt;a href='#' id='ui-carousel-prev' class='carousel-controls'&gt;&lt;span class='carousel-control-text'&gt;Prev&lt;/span&gt;&lt;/a&gt; &lt;a href='#' id='ui-carousel-next' class='carousel-controls'&gt;&lt;span class='carousel-control-text'&gt;Next&lt;/span&gt;&lt;/a&gt; &lt;/div&gt; &lt;!-- End of content promo --&gt; &lt;?php $this-&gt;inc('elements/footer.php'); ?&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