We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7455
    • 2,204 Posts
    I use phx support for content manipulating like [+introtext:limit=`110`+], that works great but now I like to do this:

    [+phx:mo=`Member`:then=`[+Member_price+]`:else=`[+price+]`+], but this return nothing. I think this is because the plugin that looks for the [+phx:tag+] will never see it. but is there another way that Ditto does use this tag and parse the phx part before the ditto part?

    This would be a great addition to DItto.

    I tried to make a tv with this line in it:
    [+phx:mo=`Member`:then=`[*Member_price*]`:else=`[*price*]`+],
    and called this new tv inside Ditto but this does not work eider.

    Maybe I need to create a snippet instead?

    Dimmy
      follow me on twitter: @dimmy01
      • 7455
      • 2,204 Posts
      This did not work eider:

      @EVAL if ($modx->getLoginUserID()) return ’[*Member_price*]’; else return ’[*price*]’;


      Does DItto not support this kind of TV usage?


      Dimmy
        follow me on twitter: @dimmy01
        • 11975
        • 2,542 Posts
        Hi,

        I guess you could use a custom placeholder to achieve what you trying to do.
        there are some sample code in the ditto extenders folder.

        :-)
          Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
          • 7455
          • 2,204 Posts
          I looked at extenders but i do not grasp it. are there some detailed example including the steps what to do and the ditto call and template?


          I realy like to learn this but I can’t find any explenaition that I understand.

          Greets Dimmy
            follow me on twitter: @dimmy01
            • 18397
            • 3,250 Posts
            @Post 1:The items in your first post are returning nothing because Ditto can’t (yet) see the nested placeholders. Assuming you are using Ditto 2, append &hiddenFields=`Member_price,price` to the call and continue using [+phx:mo=`Member`:then=`[+Member_price+]`:else=`[+price+]`+] in the template.

            @Post 2: Where did you put that @EVAL line?

            @Post 3: If you would like to learn, take a look at the example extender. Its fully commented and includes all of the features possible in an extender.
              • 7455
              • 2,204 Posts
              Quote from: Mark at May 15, 2007, 10:28 AM

              @Post 1:The items in your first post are returning nothing because Ditto can’t (yet) see the nested placeholders. Assuming you are using Ditto 2, append &hiddenFields=`Member_price,price` to the call and continue using [+phx:mo=`Member`:then=`[+Member_price+]`:else=`[+price+]`+] in the template.
              Nice this works like a cham. great


              @Post 2: Where did you put that @EVAL line?

              in a 3th tv that is then called instead of the phx



              @Post 3: If you would like to learn, take a look at the example extender. Its fully commented and includes all of the features possible in an extender.

              I see what you mean I was looking in the wiki and the ditto.modxcms.com docs but those examples where not there. I looked at the example and I think I start to grasp it

              Thanks for the help
                follow me on twitter: @dimmy01
                • 18397
                • 3,250 Posts
                Dimmy, I just committed a fix to the source code that should let you use nested placeholders without &hiddenFields. If you get a chance, please try it out and let me know how it works.
                  • 7455
                  • 2,204 Posts
                  I downloaded latest trunk but now I get this error:
                  « MODx Parse Error »
                  MODx encountered the following error while attempting to parse the requested resource:
                  « PHP Parse Error »
                   
                  PHP error debug
                    Error: 	Compilation failed: nothing to repeat at offset 13	 
                    Error type/ Nr.: 	Warning - 2	 
                    File: 	/home/httpd/vhosts/1-vision.nl/subdomains/min/httpdocs/assets/snippets/ditto/classes/template.class.inc.php	 
                    Line: 	87	 
                    Line 87 source: 	preg_match_all('~\[\+([^\+\]]*+)\+\]~' , $tpl, $matches);
                  


                  I removed the phx tags from the template but still the same result

                  I tryed downloading the developers release from the link in your footer but the tar argive looks corupted.
                  in ubuntu I get this error:
                  tar: This does not look like a tar archive
                  tar: Skipping to next header
                  tar: Error exit delayed from previous errors
                  

                  and in winrar (windows) i get this:
                  !   C:\Documents and Settings\Dimmy\Local Settings\Temp\ditto_rev_1432.tar.gz: The archive is corrupt
                  !   C:\Documents and Settings\Dimmy\Local Settings\Temp\ditto_rev_1432.tar.gz: Unexpected end of archive
                  


                  ok on mac it worked but got the same error.
                    follow me on twitter: @dimmy01
                    • 18397
                    • 3,250 Posts
                    Could you provide your entire template for debugging purposes? Thanks. As for the archive trouble, I’ll look into it.
                      • 7455
                      • 2,204 Posts
                      <table width="100%">
                      <tr>
                      <td class="kolom1" valign="top" align="left">
                      <form method="post">
                      <input type="hidden" name="token" value="[*timestamp*]" />
                      <input type="hidden" name="itemid" value="[+id+]" />
                      <input type="hidden" name="name" value="[+title+]" />
                      <input type="hidden" name="price" value="[+phx:mo=`MiNkapper`:then=`[+MiNkapper_prijs+]`:else=`[+Particulier_prijs+]`+]" />
                      <input type="hidden" name="points" value="[+tvshopShippingPoints+]" />
                      <span id="numberofitems" style="color: #000">Aantal:  </span>
                      <input type="text" id="hoeveelheid[+id+]" name="quantity" value="1" />
                      <input type="button" id="plusone" value="+" onmousedown="plus_one_edit('hoeveelheid[+id+]');" />
                      <input type="button" id="minusone" value="-" onmousedown="minus_one_edit('hoeveelheid[+id+]');" /><br />
                      <input type="submit" name="add" value="Toevoegen" />
                      </form>
                      </td>
                      <td class="kolom2" valign="top" align="left"><div id="thumbscontainer">
                      <a href="[~[+id+]~]">[[MaxiGallery? &galleryOuterTpl=`MG_outertpl` &dipslay=`embedded` &embedtype=`none` &gal_query_ids=`[+id+]` &limit=`1` ]]</a></div></td>
                      
                      <td class="kolom3" valign="top" align="left"><span class="producttitel"><a href="[~[+id+]~]">[+longtitle+]</a></span><br/><span class="tussenruimte"><br/></span><span class="productinfo"><a href="[~[+id+]~]">[+productinfo+]</a></span>
                      <td valign="top"><span class="productprijs"><a href="[~[+id+]~]">€ [+phx:mo=`MiNkapper`:then=`[+MiNkapper_prijs+]`:else=`[+Particulier_prijs+]`+] </a></span></td>
                      </td>
                      </tr>
                      </table> 
                      <br />
                      


                      I did try removing phx and MG tags but same error
                        follow me on twitter: @dimmy01