On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I’m not particularly githhub savy, so I’ll post my latest edition for a personal gallery project here.

    As far as I understand, there is a fixed css path for the galleriffic plugin inside. Using useCss, you can switch that one completely off, but you can’t tell the snippet to use a different css file instead. My modification will change that.

    Open the gallery snippet and have a look at line 12

    else {
        if ($modx->getOption('useCss',$scriptProperties,true)) {
            $modx->regClientCSS($gallery->config['cssUrl'].'web.css');
        }
    


    Use this one instead:

    else {
    
    		$useCss = $modx->getOption('useCss',$scriptProperties,true);
    		switch($useCss) {
    			case 'true':
    				/* true, because it was either set or we use the default value. Add default css to document head */
    				$modx->regClientCSS($gallery->config['cssUrl'].'web.css');
    				break;
    			case 'false':
    				/* false, because it was set to false inside snippet. Don't add any css to document head */
    				break;
    			case '':
    				/* false, because it was set to zero inside snippet. Don't add any css to document head */
    				break;
    			default:
    				/* add specified css to document head */
    				$modx->regClientCSS($useCss);
    				break;
    		}
    	}
    


    Usage:
    [[!Gallery? &album=`emotions` &useCss=`false` ]] Add &useCSS=`false` or &useCSS=`` to your snippet call to remove the gallery css link from the head
    [[!Gallery? &album=`emotions` &useCss=`assets/templates/yourproject/gallery.css` ]] Add &useCSS=`add/path/to/css/here/gallery.css` to add a link to this css file inside the documents head
    [[!Gallery? &album=`emotions` ]] Don’t add &useCss to your snippet call and you will get a link to the default css (/assets/components/gallery/css/web.css).

    Regards,

    pepebe
      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe