Jquery not loaded in Theme (5.7.2)
Permalink 1 user found helpful
Jquery won't automatically load in the <?php Loader::element('header_required', array('pageTitle' => $pageTitle));?> code, only when i'm logged in as admin.
I have $this->requireAsset('javascript', 'jquery'); in my page_theme. I even replaced the header and page_theme code by elemental's code just to check, but even then the Loader wouldn't automatically load jquery.
I added it manually now, but of course now it loads twice in admin-mode, and this just annoys me regardless. Any idea's what could cause this would be appreciated
I have $this->requireAsset('javascript', 'jquery'); in my page_theme. I even replaced the header and page_theme code by elemental's code just to check, but even then the Loader wouldn't automatically load jquery.
I added it manually now, but of course now it loads twice in admin-mode, and this just annoys me regardless. Any idea's what could cause this would be appreciated
Sadly deleting the cache didn't work for us.
I just ran up on this issue while theming out a new site in 5.7.3.1.
I was trying all sorts of things, finally, I just replaced my theme's jquery call with:
So far, so good, now it's available logged in or not, and I'm not seeing two calls in the inspector source when logged in.
I was trying all sorts of things, finally, I just replaced my theme's jquery call with:
<!-- Load C5's Core Jquery All. Of. The. Time.--> <script type="text/javascript" src="<?=ASSETS_URL_JAVASCRIPT?>/jquery.js"></script>
So far, so good, now it's available logged in or not, and I'm not seeing two calls in the inspector source when logged in.
I was having the same problem and found that if I followed the notes on this page:
http://www.concrete5.org/documentation/developers/5.7/designing-for...
then I got JQuery loaded whether I was logged in to the site or not. Win!
Basically the Bootstrap-based theme I am creating has this file: bootstrap/page_theme.php which contains the lines
The relevant part of this is adding within the PageTheme class.
hope this helps
Daniel
http://www.concrete5.org/documentation/developers/5.7/designing-for...
then I got JQuery loaded whether I was logged in to the site or not. Win!
Basically the Bootstrap-based theme I am creating has this file: bootstrap/page_theme.php which contains the lines
<?php namespace Application\Theme\bootstrap; use Concrete\Core\Page\Theme\Theme; class PageTheme extends Theme { protected $pThemeGridFrameworkHandle = 'bootstrap3'; public function registerAssets() { $this->requireAsset('javascript', 'jquery'); } }
The relevant part of this is adding
public function registerAssets() { $this->requireAsset('css', 'font-awesome'); $this->requireAsset('javascript', 'jquery'); }
hope this helps
Daniel
I just wanted to state I am also experiencing this issue?
Has anyone got a work around that does not involve adding it again manually?
update:
Just got ours working, for me it turned out to be an issue with the cache and a conflicting JS file. Some of the pages where caching a non-jquery version and because a few blocks automatically loaded jquery we did not notice until someone logged out.