Porting problem.....
Permalink
i am porting a theme into C5, but the theme requires some additional javascript which effects C5 when in edit mode
how would i disable the javascript only when the page is in edit mode?
thanks in advance
<script src="<?php echo $this->getThemePath()?>/script/jquery_cycle.js" type="text/javascript"></script> <script src="<?php echo $this->getThemePath()?>/script/bubblepopup.js" type="text/javascript" ></script> <script src="<?php echo $this->getThemePath()?>/script/ui_core.js" type="text/javascript"></script> <script src="<?php echo $this->getThemePath()?>/script/ui_tabs.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $('#placeimages').cycle({ fx: 'fade', delay: 2000, timeout: 4000 }); $('#menutabs').tabs({ fx: { opacity: 'toggle' } }); }); </script>
how would i disable the javascript only when the page is in edit mode?
thanks in advance
it brings up an error
Parse error: parse error in C:\wamp\www\concrete\themes\web\default.php on line 21
Parse error: parse error in C:\wamp\www\concrete\themes\web\default.php on line 21
Parse error means you didn't properly write PHP code (didn't close a bracket, or use a semi-colon etc.)
Please post your full page code here.
Please post your full page code here.
I cant see what ive done wrong
I don't see the if statement in this code?
take 2
First you did not escape your code properly which is why you are getting php errors. You either need to stop the php with ?> or echo your script tags.
But I also gave you the wrong function, thanks Scottc.
That will work for you.
But I also gave you the wrong function, thanks Scottc.
<?php if (!$this->editingEnabled()) { ?> <script src="<?php echo $this->getThemePath()?>/script/jquery_cycle.js" type="text/javascript"></script> <script src="<?php echo $this->getThemePath()?>/script/bubblepopup.js" type="text/javascript" ></script> <script src="<?php echo $this->getThemePath()?>/script/ui_core.js" type="text/javascript"></script> <script src="<?php echo $this->getThemePath()?>/script/ui_tabs.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $('#placeimages').cycle({ fx: 'fade', delay: 2000, timeout: 4000 }); $('#menutabs').tabs({ fx: { opacity: 'toggle' } }); });
Viewing 15 lines of 17 lines. View entire code block.
That will work for you.
I have the code working it now reads
<?php global $c; if (!$c->isEditMode()) { ?> <script src="<?php echo $this->getThemePath()?>/script/jquery_cycle.js" type="text/javascript"></script> <script src="<?php echo $this->getThemePath()?>/script/bubblepopup.js" type="text/javascript" ></script> <script src="<?php echo $this->getThemePath()?>/script/ui_core.js" type="text/javascript"></script> <script src="<?php echo $this->getThemePath()?>/script/ui_tabs.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $('#placeimages').cycle({ fx: 'fade', delay: 2000, timeout: 4000 }); $('#menutabs').tabs({ fx: { opacity: 'toggle' } });
Viewing 15 lines of 18 lines. View entire code block.
Glad you figured it. I guess the first solution was the right one :)
It wasn't working for me in the c5 beta version which is why I was trying to find another way to do it.
It wasn't working for me in the c5 beta version which is why I was trying to find another way to do it.
Try this for including your scripts while not in edit mode
Cheers.