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

    I’m totally confused by a behavior I just cant understand, either I’m blind, or something has changed in 1.05..

    I use a TV [*put_diaporama*] (check boxes Y/N with value 1/0) in order to give a redactor a choice to activate or not a slideshow.
    To do this I first tried with a phx test that broke my template and roll back to a simplier way I already used in other version : calling a chunk name built with the Tv value and a basic string:

    in the template I put
     {{diaporama[*put_diaporama*]}}  

    in order to fire {{diaporama1}} if a slide-show is wanted and {{diaporama0}} if not (the last chunk is even not supposed to exist)

    This is not working: no chunck is injected. undecided
    Of course if I write "diaporama[*put_diaporama*]" without the {{}} the string is correctly built and is exactly as expected, meaning the chunck is not interpreted ....?!??

    Really urgent

    Thank you

    --------
    the needed chunck contains:
    <div id="diaporama">
    {{diapos}}
    <p>
    cliquez sur l’image pour voir en grand
    </p>
    </div>

    and {{diapos}} has a test over another TV wich is listing all pages having an EvoGallery defined (running a custom snippet). Purpose is to call on a page the EvoGal from another page or let the default beavior:
    <div id="diapos" class="evog_[*EvoGallery_no*]">
    [+phx:if=`[*EvoGallery_no*]`:is=``:or:is=` `:then=`{{idEvogal0}}`:else=`{{idEvogal1}}`+]
    
    </div>

      Schtroumpf Grognon - Grouchy Smurf
      ---------------------------------
      Faites pas attention.. - Don&#39;t pay attention
      http://www.dzi-neo.net
      • 8790
      • 526 Posts
      it’s really a matter of what is in the needed chunck!
      The presence of the TV in the chunk name construction is part of the issue.

      made a little snippet to deal with all the way of testing what is what and avoid phx use.
      In fine I output the needed chunck in the return wich will display or or not the correct evo gallery.

      <?php
      // Get the value of template variables
         $document_tvs=$modx->getTemplateVarOutput(true, $id);
         $put_diapo=$document_tvs['put_diaporama']; //Did a redactor checked Yes (1) or not (0)?
         $evo_g_no=$document_tvs['EvoGallery_no']; //Did a redactor choose an existing gallery from another page ? (id of this page)
      
      
      switch ($put_diapo) {
      case "1":
          $le_chunk = "diaporama1";// fixing the futur name of the correct chunk for displaying a slides-show
          break;
      case "0":
           $le_chunk = "diaporama0"; // or not
          break;
      
      }
      $id=$modx->documentIdentifier;
      if ($evo_g_no == "") {
          $evo_g_no=$id; // to force the gallery id to the default one if not defined
      
      } else {
          // rien;
      }
      
      // Set placeholders    
         $modx->setPlaceholder('Put_diapo', $put_diapo);   //Not needed, just a matter of trace
         $modx->setPlaceholder('Evo_g', $evo_g_no); // will be used into the Evo gallery snippet call to use the gallery from page$evo_g_no
         // this is because using directly the TV in the call does not work at all, a PL is needed ???
           
      $output = $modx->getChunk($le_chunk);
      return $output;
      ?>


      And the chunk for displaying the correct slideshow:
      <div id="diaporama">
      <div id="diapos" class="evog_[*EvoGallery_no*]-[+Evo_g+]"> // for test purpose - not needed
      [[EvoGallery? &galleriesUrl=`assets/galleries/` &display=`images` &type=`jquery-cycle2` &tpl=`evogallery-ul` &itemTpl=`evogallery-li2` &docId=`[+Evo_g+]` ]]
      
      </div>
      <p>
      cliquez sur l’image pour voir en grand
      </p>
      </div>


        Schtroumpf Grognon - Grouchy Smurf
        ---------------------------------
        Faites pas attention.. - Don&#39;t pay attention
        http://www.dzi-neo.net
        • 21257 MODX Staff
        • 730 Posts
        Just to confirm behavior mentioned in the subject of this thread... I tested a "tv-in-chunk-name", e.g. {{test[*testSwitch*]}}
        and it worked fine for me.
          Mike Schell
          Lead Developer, MODX Cloud
          Email: [email protected]
          GitHub: https://github.com/netProphET/
          Twitter: @mkschell