View Single Post
  #25  
Old 02-10-2016, 03:19 AM
  Scott Godin's Avatar 
Scott Godin Scott Godin is offline
 

Advanced Member
  
Join Date: Aug 2014
Location: /diagonally parked in a parallel universe/
Posts: 68
 

Default Re: Simple CMS module and custom page code

What version of x-cart are you running? We are on 5.2.10 currently because I'm still awaiting correspondence about an import/export bug in our current install that is holding up our desire to upgrade the devel server.

The code I have reads as follows, and is stored at classes/XLite/Module/MHG/TemplateMods/View/CustomerPage.php:

Code:
<?php // vim: set ts=4 sw=4 sts=4 et ft=php.html: namespace XLite\Module\MHG\TemplateMods\View; class CustomerPage extends \XLite\Module\CDev\SimpleCMS\View\CustomerPage implements \XLite\Base\IDecorator { public function getCSSFiles() { $files = parent::getCSSFiles(); if ( $this->isGalleryPage() ) { $files = array_merge( parent::getCSSFiles(), array( array( 'url' => "//cdnjs.cloudflare.com/ajax/libs/nanogallery/5.9.1/css/nanogallery.min.css", 'media' => 'screen', 'no_minify' => true, ), array( 'url' => "//cdnjs.cloudflare.com/ajax/libs/nanogallery/5.9.1/css/themes/light/nanogallery_light.min.css", 'media' => 'screen', 'no_minify' => true, ) ) ); } return $files; } public function getJSFiles() { $files = parent::getJSFiles(); if ( $this->isGalleryPage() ) { $files = array_merge( parent::getJSFiles(), array( array( 'url' => "//cdnjs.cloudflare.com/ajax/libs/nanogallery/5.9.1/jquery.nanogallery.min.js", 'no_minify' => true ), array( 'file' => 'modules/MHG/TemplateMods/nanogallery_local.js' ) ) ); } return $files; } protected function isGalleryPage() { // Use the getPage() method of the controller class to get the current page object $currentName = $this->getPage()->getName(); return "Photo Gallery" === $currentName; } }

If I disable aggregation, the external files load along with the rest and the gallery works.
If I enable aggregation, the external files get dropped on the floor, never get loaded in the page content as external separate urls from the aggregated css and js files and the gallery stops working.
__________________
--
Scott Godin
Reply With Quote