We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30359
    • 6 Posts
    Hi,

    First off... Great snippet!

    I’ve been updating a previous installation of Maxigallery with this new beta and have had an issue, for me it is not including the default CSS file. I found in the code where it is supposed to be doing it (see below - maxigallery.class.inc.php from line 493) and it is failing on the "file_exists" check. It seems the $modx->config[’base_path’] bit contains "/" which is making the file exist check fail. I think this maybe an issue with my installation so I’m trying to check. Can you just confirm it is including the default style with a regular call (i.e not specifying a css file) for you.

    Thanks.

    Also, whilst looking at this section of code I think I may have spotted a separate error, in the second section related to JS it has the following in two places $modx->getChunk($his->mgconfig[’js’], is that supposed to be $this instead of $his ? I’m not sure if there is a $his array, but thought I’d mention anyway.

    		//register css and javascript from snippet parameters
    		if ($this->mgconfig['css'] != "") {
    			if ($modx->getChunk($this->mgconfig['css']) != "") {
    				$modx->regClientCSS($modx->getChunk($this->mgconfig['css']));
    			} else if (file_exists($modx->config['base_path'].$this->mgconfig['css'])) {
    				$modx->regClientCSS($modx->config['base_url'].$this->mgconfig['css']);
    			} else {	
    				$modx->regClientCSS($this->mgconfig['css']);
    			}
    		}
    		if ($this->mgconfig['js'] != "") {
    			if ($modx->getChunk($his->mgconfig['js']) != "") {
    				$modx->regClientStartupScript($modx->getChunk($his->mgconfig['js']));
    			} else if (file_exists($modx->config['base_path'].$this->mgconfig['js'])) {
    				$modx->regClientStartupScript($modx->config['base_url'].$this->mgconfig['js']);
    			} else {
    				$modx->regClientStartupScript($this->mgconfig['js']);
    			}
    		}
    
      • 30359
      • 6 Posts
      Looking into this further it was outputting the stylesheet include in the following way :

      <style type=’text/css’>@import url(/assets/snippets/maxigallery/css/default.css)</style>

      and for some reason that method of including the stylesheet is not working for me, so I changed the code from...

      		if ($this->mgconfig['css'] != "") {
      			if ($modx->getChunk($this->mgconfig['css']) != "") {
      				$modx->regClientCSS($modx->getChunk($this->mgconfig['css']));
      			} else if (file_exists($modx->config['base_path'].$this->mgconfig['css'])) {
      				$modx->regClientCSS($modx->config['base_url'].$this->mgconfig['css']);
      			} else {	
      				$modx->regClientCSS($this->mgconfig['css']);
      			}
      		}

      to...
      		if ($this->mgconfig['css'] != "") {
      			if ($modx->getChunk($this->mgconfig['css']) != "") {
      				$modx->regClientCSS($modx->getChunk($this->mgconfig['css']));
      			} else if (file_exists($modx->config['base_path'].$this->mgconfig['css'])) {
      				$modx->regClientCSS('<link rel="stylesheet" href="' . $modx->config['base_url'].$this->mgconfig['css'] . '" type="text/css" media="screen" />');
      			} else {	
      				$modx->regClientCSS($this->mgconfig['css']);
      			}
      		}


      and it works now. Not sure why this happens, is it happening to anyone else?

      Also, I’m not sure why the last "else" is there, I can see that it adds the base_url to the "regClientCSS" above it, does that mean as a last resort it will assume the link given is relative? If so I’ll probably need to change the way that includes as well (and shouldn’t it also do a file exists on that?). Just tell me to shut-up if I’m getting the wrong end of the stick here. tongue
        • 2762
        • 1,198 Posts
        Great update doze! I’m playing with it to create a demo.

        But have the same problem using &css parameter and an issue with maxigallerysolo (after update to 0.5 beta lightboxv2 does not work in MGSolo).
          Free MODx Graphic resources and Templates www.tattoocms.it
          -----------------------------------------------------

          MODx IT  www.modx.it
          -----------------------------------------------------

          bubuna.com - Web & Multimedia Design
          • 7923
          • 4,213 Posts
          Great that more people are reporting! Ok, here’s some comments about the raised issues:

          Quote from: tonegolf71 at Nov 13, 2006, 04:58 AM

          Also, whilst looking at this section of code I think I may have spotted a separate error, in the second section related to JS it has the following in two places $modx->getChunk($his->mgconfig[’js’], is that supposed to be $this instead of $his ? I’m not sure if there is a $his array, but thought I’d mention anyway.
          Yes, thank you very much smiley It’s a typo, should be $this indeed.

          Quote from: tonegolf71 at Nov 13, 2006, 06:13 AM

          Looking into this further it was outputting the stylesheet include in the following way :

          <style type=’text/css’>@import url(/assets/snippets/maxigallery/css/default.css)</style>

          and for some reason that method of including the stylesheet is not working for me
          So it was linking the css file, but it just did not work for you in your browser? What browser are you using? It seems that modx is including css by using the @import method.. I can change it to <link> if there’s some problems with that. But I guess @import should work ok too.

          Quote from: tonegolf71 at Nov 13, 2006, 06:13 AM

          Also, I’m not sure why the last "else" is there, I can see that it adds the base_url to the "regClientCSS" above it, does that mean as a last resort it will assume the link given is relative?
          No, but possible. smiley First it tries to search for a chunk that is set in &css parameter. If there is no chunk by that name, it checks if there is a file with that path that is set to &css parameter. If there’s not a file either, it calls regClientCSS just with the contents of &css parameter. So in the last case, the &css could contain css in <style></style> tags, or a link to a file in <link> tag etc.. that last case is mostly meant for snippet developers that use MaxiGallery in their own snippets..

          Quote from: banzai at Nov 13, 2006, 06:23 AM

          Great update doze! I’m playing with it to create a demo.
          Thanks! when you get it working, could you post a link here? smiley

          Quote from: banzai at Nov 13, 2006, 06:23 AM

          But have the same problem using &css parameter
          What’s the problem exactly? Do you get the css link also with @import in your HTML source, but it’s not working? Hmm.. I think I need to change it to the "forced" <link> then, that’s how I have done with the slidebox css too anyways..

          Quote from: banzai at Nov 13, 2006, 06:23 AM

          and an issue with maxigallerysolo (after update to 0.5 beta lightboxv2 does not work in MGSolo).
          Oh yea.. haven’t checked maxigallerysolo at all.. Try this and please report back if it works or not! Thanks.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 2762
            • 1,198 Posts
            Quote from: doze at Nov 13, 2006, 11:32 AM

            Great that more people are reporting! Ok, here’s some comments about the raised issues:

            .....
            Quote from: banzai at Nov 13, 2006, 06:23 AM

            Great update doze! I’m playing with it to create a demo.
            Thanks! when you get it working, could you post a link here? smiley

            Quote from: banzai at Nov 13, 2006, 06:23 AM

            But have the same problem using &css parameter
            What’s the problem exactly? Do you get the css link also with @import in your HTML source, but it’s not working? Hmm.. I think I need to change it to the "forced" <link> then, that’s how I have done with the slidebox css too anyways..

            Quote from: banzai at Nov 13, 2006, 06:23 AM

            and an issue with maxigallerysolo (after update to 0.5 beta lightboxv2 does not work in MGSolo).
            Oh yea.. haven’t checked maxigallerysolo at all.. Try this and please report back if it works or not! Thanks.

            Css work only added in the template, not calling from MaxiGallery &css parameter.

            SlideBox works great with your latest MaxiGallerySolo release wink but i noticied &pics_to_show=`1` seems not working (MGsolo still display next button), but I dont know if it’is a 0.5 issue or 0.4x issue.


              Free MODx Graphic resources and Templates www.tattoocms.it
              -----------------------------------------------------

              MODx IT  www.modx.it
              -----------------------------------------------------

              bubuna.com - Web & Multimedia Design
              • 7923
              • 4,213 Posts
              Quote from: banzai at Nov 13, 2006, 12:24 PM

              Css work only added in the template, not calling from MaxiGallery &css parameter.

              SlideBox works great with your latest MaxiGallerySolo release wink but i noticied &pics_to_show=`1` seems not working (MGsolo still display next button), but I dont know if it’is a 0.5 issue or 0.4x issue.
              What do you have in your &css parameter?

              The &pics_to_show parameter in MaxiGallerySolo just defines how many pictures it shows in the page, it still retrieves all pictures to the lightboxv2 pictureset. To make it only get the &pic_to_show amount of pictures in to the pictureset,

              change:
              if($open=="lightbox"){
              	$forcount = count($pics);
              }else{
              	$forcount = $pics_to_show+1;
              }
              


              to

              $forcount = $pics_to_show+1;
              




                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 2762
                • 1,198 Posts
                Quote from: doze at Nov 13, 2006, 12:32 PM

                Quote from: banzai at Nov 13, 2006, 12:24 PM

                Css work only added in the template, not calling from MaxiGallery &css parameter.

                SlideBox works great with your latest MaxiGallerySolo release wink but i noticied &pics_to_show=`1` seems not working (MGsolo still display next button), but I dont know if it’is a 0.5 issue or 0.4x issue.
                What do you have in your &css parameter?

                The name of the chunk wich contains the style code ( &css=GalleryStyle) or I mistaken something?


                The &pics_to_show parameter in MaxiGallerySolo just defines how many pictures it shows in the page, it still retrieves all pictures to the lightboxv2 pictureset. To make it only get the &pic_to_show amount of pictures in to the pictureset,

                change:
                if($open=="lightbox"){
                	$forcount = count($pics);
                }else{
                	$forcount = $pics_to_show+1;
                }
                


                to

                $forcount = $pics_to_show+1;
                




                Thanks very much for the tip, i will try very soon;)
                  Free MODx Graphic resources and Templates www.tattoocms.it
                  -----------------------------------------------------

                  MODx IT  www.modx.it
                  -----------------------------------------------------

                  bubuna.com - Web & Multimedia Design
                  • 7923
                  • 4,213 Posts
                  Quote from: banzai at Nov 13, 2006, 12:43 PM


                  What do you have in your &css parameter?

                  The name of the chunk wich contains the style code ( &css=GalleryStyle) or I mistaken something?
                  That has to be &css=`GalleryStyle` and the chunk has to contain the css in <style...> .. </style> tags. Have you tried that?


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 2762
                    • 1,198 Posts
                    Quote from: doze at Nov 13, 2006, 12:48 PM

                    .....and the chunk has to contain the css in <style...> .. </style> tags. Have you tried that?

                    shocked this is my mistaken! now works very nice wink
                    thanks
                      Free MODx Graphic resources and Templates www.tattoocms.it
                      -----------------------------------------------------

                      MODx IT  www.modx.it
                      -----------------------------------------------------

                      bubuna.com - Web & Multimedia Design
                      • 27889
                      • 415 Posts
                      Just what I’m waiting for, thanks for this great snippet.
                      I’m trying to display a list of articles with Ditto and MaxiGallery, in my ditto template I have this:
                      [[MaxiGallery? &view_gallery=`[+id+]`  &pics_per_page='1' ]]


                      I have 2 articles, the first is displayed with ALL his images and the second with any.
                      I want to display just one image for each.
                      Made I (ugh) some mistakes or should I use MaxiGallerySolo to achieve this ?
                        MODx Sites & Prestations: http://dp-site.fr [Last MODx Site]
                        MODx Repository: [HOME] [MetaTagsExtra] / Current Dev: [xFDM]

                      This discussion is closed to further replies. Keep calm and carry on.