We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53460
    • 69 Posts
    Here's my page I'm working on: https://nogreaterpartnership.bipc.com/media-center this is inside the "Logos" tab at the bottom of the page.

    I have a string of file type options for the user to download and they all share the same file name except for the extension. But with a white logo, there's no reason to have a JPG version, so on those I don't want that link to generate. Here's what I've done:

    <div class="logos">
        <h4>[[+ItemName]]</h4>
        <div class="item">
            <a href="[[+ItemLink]]"><img class="logo [[+ItemLogoType:notempty=`[[+ItemLogoType]]`]] [[+ItemLogoColor:notempty=`[[+ItemLogoColor]]`]]" src="[[+ItemThumb]]" /></a>
            <div class="description">
                [[+ItemDescription:notempty=`<p>[[+ItemDescription]]</p>`]]
                <p>
                    [[+ItemLogoColor:isnot=`white`:then=`<a href="[[!DnldLogo?&link=`[[+ItemLink]]`&type=`JPG`]]" target="_blank">JPG</a> | `]]
                    <a href="[[!DnldLogo?&link=`[[+ItemLink]]`&type=`PNG`]]" target="_blank">PNG</a> | 
                    <a href="[[!DnldLogo?&link=`[[+ItemLink]]`&type=`EPS`]]" target="_blank">EPS</a>
                </p>
            </div>
        </div>
    </div>
    


    And the DnldLogo Snippet:
    <?php
    $path_parts = pathinfo($link);
    $extn = strtolower($type);
    
    return $path_parts['dirname'] . "/" . $path_parts['filename'] . "." . $extn;


    In the TV, I'm using MIGX to have a whole list of variables. In there, I have a checkbox to signify if the logo is white. I'm using [[+ItemLogoColor]] to determine that instances where the color is not white, to generate the JPG link. You can see on the page, that the visual result works. However I've disabled the [[+ItemLink]] in the snippet parameter. When I enable it, the entire logos section disappears. I know there's a lot going on here, but I'm not sure why that placeholder breaks the code. If I insert something standard like [[*content]], it works just fine and pulls in the content area.

    Also attaching files of all related code.

    Thanks in advance.
      • 53460
      • 69 Posts
      never mind I can't attach the code files for some reason... Here they are in this post.

      Chunk:
      [[+ItemCategory:contains=`Logo`:then=`
          [[+ItemLogoType:contains=`Vertical`:or:contains=`Horizontal`:then=`
                                                      <div class="logos">
                                                          <h4>[[+ItemName]]</h4>
                                                          <div class="item">
                                                              <a href="[[+ItemLink]]"><img class="logo [[+ItemLogoType:notempty=`[[+ItemLogoType]]`]] [[+ItemLogoColor:notempty=`[[+ItemLogoColor]]`]]" src="[[+ItemThumb]]" /></a>
                                                              <div class="description">
                                                                  [[+ItemDescription:notempty=`<p>[[+ItemDescription]]</p>`]]
                                                                  <p>
                                                                      [[+ItemLogoColor:isnot=`white`:then=`<a href="[[!DnldLogo?&link=`[[-+ItemLink]]`&type=`JPG`]]" target="_blank">JPG</a> | `]]
                                                                      <a href="[[!DnldLogo?&link=`[[+ItemLink]]`&type=`PNG`]]" target="_blank">PNG</a> | 
                                                                      <a href="[[!DnldLogo?&link=`[[+ItemLink]]`&type=`EPS`]]" target="_blank">EPS</a>
                                                                  </p>
                                                              </div>
                                                          </div>
                                                      </div>
          `]]
          [[+ItemFileType:contains=`ZIP`:then=`
                                                      <div class="zips">
                                                          <h4>[[+ItemName]]</h4>
                                                          <div class="item">
                                                              <a href="[[+ItemLink]]"><img class="icon zip" src="assets/images/icons/icon-zip.png" /></a>
                                                              <div class="description">
                                                                  [[+ItemDescription:notempty=`<p>[[+ItemDescription]]</p>`]]
                                                                  <p><a href="[[+ItemLink]]" target="_blank">Download</a></p>
                                                              </div>
                                                          </div>
                                                      </div>
          `]]
          [[+ItemFileType:contains=`PDF`:then=`
                                                      <div class="docs">
                                                          <h4>[[+ItemName]]</h4>
                                                          <div class="item">
                                                              <a href="[[+ItemLink]]" target="_blank"><img class="docThumb" src="[[+ItemThumb]]" /></a>
                                                              <div class="description">
                                                                  [[+ItemDescription:notempty=`<p>[[+ItemDescription]]</p>`]]
                                                                  <p><a href="[[+ItemLink]]" target="_blank">Download</a></p>
                                                              </div>
                                                          </div>
                                                      </div>
          `]]
      `]]

      Snippet:
      <?php
      $path_parts = pathinfo($link);
      $extn = strtolower($type);
      
      return $path_parts['dirname'] . "/" . $path_parts['filename'] . "." . $extn;

      TV FormTabs:
      [
          {"caption":"Groups/Positions List", "fields":
           [
               {"field":"ItemName","caption":"Item Name","inputTVtype":"text"},
               {"field":"ItemDescription","caption":"Description","inputTVtype":"textarea"},
               {"field":"ItemThumb","caption":"Thumbnail","inputTVtype":"image"},
               {"field":"ItemLink","caption":"Download URL","inputTVtype":"file"},
               {"field":"ItemCategory","caption":"Category","inputTVtype":"listbox","inputOptionValues":"1-pager||Logo||Firm-Brochure"},
               {"field":"ItemLogoType","caption":"Logo Type","inputTVtype":"listbox","inputOptionValues":"||Vertical||Horizontal"},
               {"field":"ItemLogoColor","caption":"White?","inputTVtype":"checkbox","inputOptionValues":"Yes==white"},
               {"field":"ItemFileType","caption":"File Type","inputTVtype":"listbox","inputOptionValues":"||PDF||ZIP||JPG||EPS||PNG"}
           ]
          }
      ]

      TV Grid Columns:
      [
          {"header":"Name","width":"20","sortable":"true","dataIndex":"ItemName"},
          {"header":"Descrption","width":"30","sortable":"false","dataIndex":"ItemDescription"},
          {"header":"Thumbnail","width":"10","sortable":"false","dataIndex":"ItemThumb"},
          {"header":"URL","width":"10","sortable":"false","dataIndex":"ItemLink"},
          {"header":"Category","width":"10","sortable":"true","dataIndex":"ItemCategory"},
          {"header":"Logo Type","width":"5","sortable":"false","dataIndex":"ItemLogoType"},
          {"header":"White?","width":"5","sortable":"false","dataIndex":"ItemLogoColor"},
          {"header":"File Type","width":"5","sortable":"false","dataIndex":"ItemFileType"}
      ]
        • 4172
        • 5,888 Posts
        did you try to call this cached?

        [[DnldLogo?&link=`[[+ItemLink]]`&type=`PNG`]]


        also, do you call getImageList cached or uncached?
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 53460
          • 69 Posts
          Quote from: Bruno17 at Jun 02, 2018, 04:04 AM
          did you try to call this cached?

          [[DnldLogo?&link=`[[+ItemLink]]`&type=`PNG`]]


          also, do you call getImageList cached or uncached?

          I guess it's all uncached. I've never used the cache feature before. This is what I have in my Template:
          <div class="wrap">
              [[*content]]
              [[*MediaContactList:notempty=`
                  <h3>Media Contacts</h3>
                  <div class="contactList">
          	        [[getImageList?
          	            &tvname=`MediaContactList`
          	            &tpl=`MediaContactItemTpl`
          	        ]]
                  </div>
              `]]
              [[*MediaDownloadList:notempty=`
                  <h3>Resources</h3>
                  <div class="tab-container">
                      <div class="tabs">
                          <button class="tab" onclick="openTab(event, 'tab-1')" id="active">Firm Fact Sheet</button>
                          <button class="tab" onclick="openTab(event, 'tab-2')">Logos</button>
                          <button class="tab" onclick="openTab(event, 'tab-3')">Firm Brochure</button>
                      </div>
              
                      <div id="tab-1" class="tabcontent">
                          [[getImageList?
                              &tvname=`MediaDownloadList`
                              &tpl=`DnldItem-1page`
                          ]]
                      </div>
              
                      <div id="tab-2" class="tabcontent">
                          [[getImageList?
                              &tvname=`MediaDownloadList`
                              &tpl=`DnldItem-Logo`
                          ]]
                      </div>
              
                      <div id="tab-3" class="tabcontent">
                          [[getImageList?
                              &tvname=`MediaDownloadList`
                              &tpl=`DnldItem-Booklet`
                          ]]
                      </div>
                  </div>
              `]]
          </div>
          
            • 4172
            • 5,888 Posts
            you are calling everything cached.

            But you are calling your snippet uncached.


            [[!DnldLogo?&link=`[[+ItemLink]]`&type=`PNG`]]



            Not sure, if this could be your issue. Try the cached snippet-call:

            [[DnldLogo?&link=`[[+ItemLink]]`&type=`PNG`]]

              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 53460
              • 69 Posts
              Quote from: Bruno17 at Jun 05, 2018, 11:12 PM
              Not sure, if this could be your issue. Try the cached snippet-call:

              [[DnldLogo?&link=`[[+ItemLink]]`&type=`PNG`]]


              No, I tried that and still got the same results. All the logos are removed.
                • 53460
                • 69 Posts
                Huh, this worked though. Just came to me.

                I called the link separately and added a 'toPlaceholder' output modifier and used that in the href.

                Now it says something like this:

                <p>
                    [[+ItemLink:toPlaceholder=`ItemLinkNew`]]
                
                    [[+ItemLogoColor:isnot=`white`:then=`<a href="[[!DnldLogo?&link=`[[+ItemLinkNew`&type=`JPG`]]" target="_blank">JPG</a> | `]]
                    <a href="[[!DnldLogo?&link=`[[+ItemLinkNew`&type=`PNG`]]" target="_blank">PNG</a> | 
                    <a href="[[!DnldLogo?&link=`[[+ItemLinkNew`&type=`EPS`]]" target="_blank">EPS</a>
                </p>