We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27672
    • 168 Posts
    page contains:
    [[fancyboxPageMaker? &tag=`construction` &header=`Construction`]]

    `fancyboxPageMaker` snippet:
    <?php
    $output = '';
    
    $output .= $modx->parseChunk('fancyboxTpl_page',array('portfolioTag' => $tag, 'portfolioHeader' => $header));
    
    return $output;

    `fancyboxTpl_page` chunk:
    <div id="fancyboxPageWrapper" class="[[*fancyboxBackground]]">
        <div id="fancyboxPage">
            <!--<h1 style="float:left; width:208px;">[[+portfolioHeader]]</h1>-->
            <div id="fancyboxCurrentSlide"></div>
            <div id="fancyboxAvailableSlides">
                [[!getResources? &parents=`72` &tpl=`fancyboxTpl_top` &limit=`100` &includeTVs=`1` &includeContent=`1` &sortby=`menuindex` &sortdir=`ASC` &tvFilters=`fancybox_Tags==%[[+portfolioTag]]%`]]
            </div>
            <div style="clear:both;"></div>
        </div>
    </div>
    <div style="clear:both;"></div>
    
    <div class="jCarouselLiteWrap">
        <span class="[[*fancyboxBackground]]"><a href="#" class="prev"> </a></span>
        <div class="jCarouselLite">
            <ul>
                [[!getResources? &parents=`72` &tpl=`fancyboxTpl_slides` &limit=`100` &includeTVs=`1` &includeContent=`1` &sortby=`menuindex` &sortdir=`ASC` &tvFilters=`fancybox_Tags==%[[+portfolioTag]]%`]]
            </ul>
        </div>
        <span class="[[*fancyboxBackground]]"><a href="#" class="next"> </a></span>
        <div style="clear:both;"></div>   
    </div> 
    <div style="clear:both;"></div>

    `fancyboxTpl_top` chunk:
    <div class="fancyboxSlideWrap" id="fbs[[+idx]]i">
        <div class="fancyboxSliderNext">
            <div class="fancyboxSliderSpacer"></div>
            <div class="fancyboxSliderBg"> </div>
        </div>
        <div class="fancyboxCurrentImage">
            <img src="[[+tv.fancybox_Image:phpthumbof=`&w=500&h=400&q=90`]]" alt="[[+longtitle]]" />
        </div>
        <div class="fancyboxSliderPrev">
            <div class="fancyboxSliderSpacer"></div>
            <div class="fancyboxSliderBg"> </div>
        </div>
        <div class="fancyboxCurrentHeader">
            <h1>[[+tv.fancybox_Header]]</h1>
        </div>
        <div class="fancyboxCurrentDescription">
            [[+content]]
        </div>
    </div>

    `fancyboxTpl_slides` chunk:
    <li>
        <img src="[[+tv.fancybox_Image:phpthumbof=`&w=115&h=75&q=65`]]" alt="[[+longtitle]]" width="115" height="75" rel="fbs[[+idx]]" id="fbs[[+idx]]" class="fbsTrigger" />
    </li>

    here is page in action: http://www.vertexeng.com/portfolio/service/environmental

    any of the pages within the "portfolio" section should have the lightbox effect.

    the pages that `getResources` pull from have tvs:
    fancybox_Header: plain text
    fancybox_Tags: checkbox of possible categories the item falls under
    fancybox_Image: an image. these are all pretty small, like 500x400 max

    any insight would be terrific. they love the way it looks, are just unhappy with it loading slowly.
      • 33968
      • 863 Posts
      In your `fancyboxTpl_page` chunk you are calling getResources uncached twice.

      Change to cached (remove the ’!’) and I think you’ll find it speeds up a lot.
      [[getResources? &parents=`72` &tpl=`fancyboxTpl_top` &limit=`100` &includeTVs=`1` &includeContent=`1` &sortby=`menuindex` &sortdir=`ASC` &tvFilters=`fancybox_Tags==%[[+portfolioTag]]%`]]
      

        • 27672
        • 168 Posts
        In your `fancyboxTpl_page` chunk you are calling getResources uncached twice.

        Change to cached (remove the ’!’) and I think you’ll find it speeds up a lot.

        if i do this, it doesn’t load any of the content in the lightbox. the lightbox just opens, but no images or text are shown. that’s the reason those "!" were in there in the first place.

        wasn’t sure if this was due to the chunk `fancyboxTpl_page` being parsed from a snippet... i get lost with caching in modx when it comes to stuff being nested, eg cachable page calling an uncached snippet
          • 33968
          • 863 Posts
          Hmmm... I may be wrong but I thought it was ok to have nested cached snippets in Revo. I’ve noticed though that getResources can be quite slow so you’ll really need to call it cached somehow.

          Is there another way you could pass your portfolio tag to getResources? I think you could move your chunk content to your template and modify your fancyboxPageMaker snippet to output placeholders instead of parsing the chunk?
            • 27672
            • 168 Posts
            i just put the chunk call right in the resource itself, and then was able to make my two getResource calls uncached, which helps. just makes the code a little less modular. i’ll keep working on it though. thanks for the input! greatly appreciated.