We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19164
    • 1,215 Posts
    May be [+bookPriceDiscT1+] or [+bookPrice+] is not visible in ditto template and the result is something like [+bookPriceDiscT1:math=`(1.0-(/))*100`+] that cause an error. Try to add &hiddenFields=`bookPriceDiscT1,bookPrice` to ditto parameters.
      DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

      Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

      [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
      • 27733
      • 99 Posts
      Thanks for your reply, Metaller. It’s a bit trickier, and is seeming more and more like a compatibility thing. Though I get the parsing error in my logs, the final output is fine and the calculations are correct. In my dev environment ( mysql 5.0.37 / php 5.x ) I found that calling ditto cached [[ditto ...]] alleviated the error, but on my target server ( mysql 4.1.2 / php 4.4.8 ) it did not.

      Upon further investigation, I found the target server is throwing errors on other ditto calls as well, and other output is just not appearing for some data (upon first glance where the ditto tpl gets custom TVs; the core TVs are getting processed).

      Clearly, I’ll need to go deeper and gather more info before asking for more help -- but if there’s a known issue between ditto/phx and these versions of mysql and php, please let me know!

      Cheers,
      Jim
        ------
        Server: *nix, ModX Evo 1.0.4, Apache 2.x, PHP 5.x, Mysql 5.x.
        • 1800
        • 52 Posts
        I posted this in another thread but was told phx could help...
        So I have a simple blog that I want my side to list as a wordpress listing instead of a wayfinder like normal.

        What shows up in the side in controlled by a textarea TV called [*side*] i could set [*side*] to inherit and put {{wayfinder}} in the root document and {{wordpress_listing}} in the blog contatiner... but i manage too many clients for one screw up their entire site by chaging what is in [*side*] on the root directory

        if ([*side*] != "{{wayfinder}}") {print("@inherit");}
        else {print("{{wayfinder}}"}


        Im not using php, but thats the easiest way to describe what I want. The thought is that on all pages put {{wayfinder}} in [*side*] unless otherwise told not to. If i set [*side*] to {{wordpress_listing}} all sub pages would do that.

        How do I make a TV act this way? Thanks!!!

        This doable?
          Minneapolis Web Design <-- where i work
          MODx Templates <-- new project im working on
          • 22797
          • 134 Posts
          Is there any way in PHx -- or anything else, for that matter -- that can check for multiple conditions of multiple variables in a PHP sort of way? For example, in PHP, I can do something like this:

          if ( ($tv1 !='') && ($tv2 !='') ) echo "<p>Template Variable 1 and Template Variable 2 are not empty</p>";

          But in PHx I seem to be limited to conditions based on a single variable. I can check for multiple conditions for that variable, as in:

          [+myplaceholder:isnot=`2`:or:lt=`3`:then=`Yes`:else=`No`+] 

          ...but I can’t check for multiple conditions across variables. Is there any way around this? Or am I missing something?

            • 22797
            • 134 Posts
            PHx does not accurately parse non-cached snippets. Here’s an example:

            [+phx:if=`[!mysnippet!]`:is=`1`:then=`[!mysnippet!]`:else=`[!mysnippet!] is not = 1`+]


            The above will output:

            1 is not = 1

            The first call to the snippet (in the "if" statement) is not parsed correctly, but the subsequent calls are parsed correctly.
              • 19164
              • 1,215 Posts
              Quote from: paulb at Jun 27, 2008, 07:45 PM

              Is there any way in PHx -- or anything else, for that matter -- that can check for multiple conditions of multiple variables in a PHP sort of way?

              You can use multiple variables like that

              [+tv1:isnot=``:then=`
              [+tv2:isnot=``:then=`<p>Template Variable 1 and Template Variable 2 are not empty</p>`+]
              `+]
                DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

                Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

                [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
                • 22797
                • 134 Posts
                Quote from: Metaller at Jun 28, 2008, 06:00 PM

                You can use multiple variables like that

                [+tv1:isnot=``:then=`
                [+tv2:isnot=``:then=`<p>Template Variable 1 and Template Variable 2 are not empty</p>`+]
                `+]

                That will work for some things -- though it is not as elegant as a single conditional statement -- but a common situation for me is the need to check to see if at least one value is not empty. In other words, I need an "or" condition, something like this:

                if ( ($tv1 != '') || ($tv2 != '') || ($tv3 != '') ) echo 'At least one of these is not empty.';
                  • 19164
                  • 1,215 Posts
                  You can split this condition on several:

                  [+tv1:isnot=``:then=`At least one of these is not empty.`:else=`
                  [+tv2:isnot=``:then=`At least one of these is not empty.`:else=`
                  [+tv3:isnot=``:then=`At least one of these is not empty.`+]
                  `+]
                  `+]


                  As you says, it is not as elegant as a single conditional statement but it works.
                    DirectResize 0.9 beta. PHPThumb, sets of configurations, configuration, binded to specific path. No backward compatibility. | DirectResize 0.9. PHPThumb, наборы параметров, параметры, привязанные к определенным путям. Без обратной совместимости.

                    Unfortunately, DirectResize project is closed. If you want to continue development, PM me for access to project page on Google Code. К сожалению, проект DirectResize закрыт. Если вы желаете продолжить разработки, обращайтесь через ПМ для получения доступа к репозиторию на Google Code.

                    [PLUGIN] DirectResize - as Maxigallery but for single images :: Download :: [url=http://modxcms.com/forums/index.php/topic,21490]
                    • 22797
                    • 134 Posts
                    Thanks for the reply. Yeah, that will work, but I usually have to put large amounts of information in the conditional area, so I’d have to repeat all of that over and over again. I could create a chunk, and maybe that’s what I’ll have to do, but I end up creating a lot of chunks that way that could be avoided if there were a simpler combined conditional statement.

                    The real pain is creating complex nested conditions that combined "and" and "or" logic. It gets very messy very quickly. For one thing, it’s hard for me to keep track of all of the conditions being processed when the conditions are spread around in so many places. I’m more likely to make errors, and it’s harder to debug because you can’t do it at a quick glance. All of the conditions get mixed in with complex content that also has conditions. It’s very messy.
                      • 30223
                      • 1,010 Posts
                      Perhaps in your case a dedicated snippet which does all the logic TV testing and simply outputs the results would be more appropriate. Sounds to me you are trying to solve something in the template which really is better suited to be solved directly in php.

                      This discussion is closed to further replies. Keep calm and carry on.