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

    I was hoping that someone could help me understand Placeholders. I’ve read some documentation on them, and as far as I’m aware, though I could be wrong, Placeholders have to be set up within Snippets?

    I’m working with the original Shopkeeper files, and within the file chunk_shopCart.tpl there are an awful lot of placeholders, and I don’t understand where there set up.

    This is the file:
    <div id="shopCart" class="shop-cart">
      <div class="shop-cart-head"><b>Shopping cart</b></div>
      <div id="cartInner" class="empty">
        <div id="cartEmpty" align="center">Empty</div>
      </div>
    </div>
    <!--tpl_separator-->
    <div id="shopCart" class="shop-cart">
      <div class="shop-cart-head"><b>Shopping cart</b></div>
      <div id="cartInner" class="full">
        <div align="right">
          <a href="[+this_page_url+]?shk_action=empty" id="butEmptyCart">Empty cart</a>
        </div>
        <table width="100%">
          <tbody>
            [+inner+]
          </tbody>
        </table>
        <div align="right">Total: <b>[+price_total+]</b> [+currency+]</div>
        <noscript>
          <input type="submit" name="shk_recount" value="Calculate" />
        </noscript>
        <div class="cart-order">
          <a href="[+order_page_url+]" id="butOrder">Checkout</a>
        </div>
      </div>
    </div>
    <!--tpl_separator-->
    <div id="shopCart" class="shop-cart">
      <div class="shop-cart-head"><b>Shopping cart</b></div>
      <div id="cartInner" class="full">
        <div align="right">
          <a href="[+this_page_url+]?shk_action=empty" id="butEmptyCart">Empty cart</a>
        </div>
        <div class="shop-cart-body">You have chosen: <b>[+total_items+]</b> [+plural+]</div>
        <div align="right">Total: <b>[+price_total+]</b> [+currency+]
        </div>
        <div class="cart-order">
          <a href="[+order_page_url+]" id="butOrder">Checkout</a>
        </div>
      </div>
    </div>


    And to reach this particular file the original line is from a template name Checkout
    [!Shopkeeper? &lang=`english` &currency=`GBP` &cartTpl=`@FILE:assets/snippets/shopkeeper/chunks/en/chunk_shopCart.tpl` &orderFormPage=`31` &gotoid=`32` &inventory=`inventory`!]
    


    Sorry if this is a basic question - but I’m really confused!! Hopefully someone can help!

    Thanks

    Hollie
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Yes, placeholders are created by the snippet. There are two ways that snippets can handle placeholder processing, however. They can use the setPlaceholder() function (however this is called in Revo), letting the MODx parser do the replacement, or they can use PHP str_replace() or the MODx parseChunk() function to make the replacements in the snippet code.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 12294
        • 30 Posts
        Thank you!

        I finally worked out which snippet it was calling it from! I had completely forgotten about the files in the FTP!

        Thanks again

        Hollie