Hi Sven,
You use a few <script... Declarations in your Templates. Since nowadays it's common practice, to load the Javascript at the bottom of the page and there are a lot of Plugins, e.g. "ScriptsDown", that accomplish that on Joomla, you should consider rewriting those to JFactory::getDocument()->addScriptDeclaration("..."); since otherwise your code breaks (Scripts are loaded before jquery).
For the time being, I created Template Overrides and it works great (also with ScriptsDown active).
E.g.
components/com_eventgallery/views/snippets/tmpl/cart.php line 27 ff.
change from
to
(you'll have to escape " with \" and change the occurences of <?php echo in your original code)
While you're at it, you might also consider changing <style> declarations to JFactory::getDocument()->addStyleDeclaration("..."); so that they are in the <head> :)
Occurences of script declarations, I found:
components/com_eventgallery/views/cart/tmpl/default.php (106)
components/com_eventgallery/views/checkout/tmpl/change_address.php (90)
components/com_eventgallery/views/singleimage/tmpl/default.php (17)
components/com_eventgallery/views/singleimage/tmpl/minipage.php (45)
components/com_eventgallery/views/singleimage/tmpl/share_facebook_feeddialog.php (16)
components/com_eventgallery/views/singleimage/tmpl/share_facebook_photoshare.php (23)
components/com_eventgallery/views/singleimage/tmpl/share_facebook_sharedialog.php (16)
components/com_eventgallery/views/snippets/tmpl/cart.php (28)
components/com_eventgallery/views/snippets/tmpl/event/ajaxpaging_script.php (11)
components/com_eventgallery/views/snippets/tmpl/imageset/imagesetselection.php (36)
Would be great, if you could consider that for your next version...
Cheers,
Chris
You use a few <script... Declarations in your Templates. Since nowadays it's common practice, to load the Javascript at the bottom of the page and there are a lot of Plugins, e.g. "ScriptsDown", that accomplish that on Joomla, you should consider rewriting those to JFactory::getDocument()->addScriptDeclaration("..."); since otherwise your code breaks (Scripts are loaded before jquery).
For the time being, I created Template Overrides and it works great (also with ScriptsDown active).
E.g.
components/com_eventgallery/views/snippets/tmpl/cart.php line 27 ff.
change from
<?php IF ($use_cart_inside_component): ?> <script type="text/javascript"> /* <![CDAT[ */ (function(jQuery){ jQuery( document ).ready(function() { var options = { buttonShowType: 'inline', emptyCartSelector: '.eventgallery-cart-empty', cartSelector: '.eventgallery-ajaxcart-internal', cartItemContainerSelector: '.eventgallery-ajaxcart-internal .cart-items-container', cartItemsSelector: '.eventgallery-ajaxcart-internal .cart-items', cartItemSelector: '.eventgallery-ajaxcart-internal .cart-items .cart-item', cartCountSelector: '.eventgallery-ajaxcart-internal .itemscount', buttonDownSelector: '.eventgallery-ajaxcart-internal .toggle-down', buttonUpSelector: '.eventgallery-ajaxcart-internal .toggle-up', 'removeUrl': "<?php echo JRoute::_("index.php?option=com_eventgallery&view=rest&task=removefromcart&format=raw", true); ?>".replace(/&/g, '&'), 'add2cartUrl': "<?php echo JRoute::_("index.php?option=com_eventgallery&view=rest&task=add2cart&format=raw", true); ?>".replace(/&/g, '&'), 'removeLinkTitle': "<?php echo JText::_('COM_EVENTGALLERY_CART_ITEM_REMOVE')?>", 'getCartUrl': "<?php echo JRoute::_("index.php?option=com_eventgallery&view=rest&task=getCart&format=raw", true); ?>".replace(/&/g, '&') }; var eventgalleryCart = new Eventgallery.Cart(options); }); })(eventgallery.jQuery); /* ]]> */ </script>
to
<?php IF ($use_cart_inside_component): JFactory::getDocument()->addScriptDeclaration(" /* <![CDAT[ */ (function(jQuery){ jQuery( document ).ready(function() { var options = { buttonShowType: 'inline', emptyCartSelector: '.eventgallery-cart-empty', cartSelector: '.eventgallery-ajaxcart-internal', cartItemContainerSelector: '.eventgallery-ajaxcart-internal .cart-items-container', cartItemsSelector: '.eventgallery-ajaxcart-internal .cart-items', cartItemSelector: '.eventgallery-ajaxcart-internal .cart-items .cart-item', cartCountSelector: '.eventgallery-ajaxcart-internal .itemscount', buttonDownSelector: '.eventgallery-ajaxcart-internal .toggle-down', buttonUpSelector: '.eventgallery-ajaxcart-internal .toggle-up', 'removeUrl': \"". JRoute::_("index.php?option=com_eventgallery&view=rest&task=removefromcart&format=raw", true) ."\".replace(/&/g, '&'), 'add2cartUrl': \"". JRoute::_("index.php?option=com_eventgallery&view=rest&task=add2cart&format=raw", true) ."\".replace(/&/g, '&'), 'removeLinkTitle': \"". JText::_('COM_EVENTGALLERY_CART_ITEM_REMOVE')."\", 'getCartUrl': \"". JRoute::_("index.php?option=com_eventgallery&view=rest&task=getCart&format=raw", true) ."\".replace(/&/g, '&') }; var eventgalleryCart = new Eventgallery.Cart(options); }); })(eventgallery.jQuery); /* ]]> */ "); ?>
(you'll have to escape " with \" and change the occurences of <?php echo in your original code)
While you're at it, you might also consider changing <style> declarations to JFactory::getDocument()->addStyleDeclaration("..."); so that they are in the <head> :)
Occurences of script declarations, I found:
components/com_eventgallery/views/cart/tmpl/default.php (106)
components/com_eventgallery/views/checkout/tmpl/change_address.php (90)
components/com_eventgallery/views/singleimage/tmpl/default.php (17)
components/com_eventgallery/views/singleimage/tmpl/minipage.php (45)
components/com_eventgallery/views/singleimage/tmpl/share_facebook_feeddialog.php (16)
components/com_eventgallery/views/singleimage/tmpl/share_facebook_photoshare.php (23)
components/com_eventgallery/views/singleimage/tmpl/share_facebook_sharedialog.php (16)
components/com_eventgallery/views/snippets/tmpl/cart.php (28)
components/com_eventgallery/views/snippets/tmpl/event/ajaxpaging_script.php (11)
components/com_eventgallery/views/snippets/tmpl/imageset/imagesetselection.php (36)
Would be great, if you could consider that for your next version...
Cheers,
Chris