We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26931
    • 2,314 Posts
    hi everybody,

    i’ve got an odd problem with phpThumb ( using it in an Ditto template at the moment though, but i thought i post it in here, because few people use it in combination with Ditto and the problem would occur with MG too ... please move the post if it shouldn’t be in here )

    if i call it like this in my template chunk everything works perfect:
    <a class="dogimglink" href="[+Portrait+]" rel="lightbox" title="[+pagetitle+]">
    [+phx:if=`[+Portrait+]`:is=``:then=``:else=`<img src="[+phx:input=`[(base_url)][+Portrait+]`:phpthumb=`&h=100&w=100&zc=1&q=95`+]"  />`+]
    </a>

    but as soon as [+Portrait+] isn’t referenced in the <a> tag anymore the thumbnail won’t be displayed. it doesn’t matter if [+Portrait+] is in an <a> tag ... this would work too:
    [+Portrait+]
    [+phx:if=`[+Portrait+]`:is=``:then=``:else=`<img src="[+phx:input=`[(base_url)][+Portrait+]`:phpthumb=`&h=100&w=100&zc=1&q=95`+]"  />`+]
    

    ...i can call it without the additional phx statement like this and the bahaviour would be the same:
    <img src="[+phx:input=`[(base_url)][+Portrait+]`:phpthumb=`&h=100&w=100&zc=1&q=95`+]" />

    the really weird thing is, that [+Portrait+] just needs to be referenced once in a series of images ( doesn’t matter if it’s the first or the second one ?!! ) in order to display all thumbs
    including alt="[+Teaserimage+]" would work, but i would prefer a clean solution and first of all i’m too curious where this strange behaviour is coming from.

    my modifier: "phx:phpthumb"
    <?php
    $output = '[(base_url)]assets/snippets/phpthumb/phpThumb.php?src=' . $output . $options;
    return str_replace('&', '&', $output);
    ?>


    so basically there needs to be at least one original path to an image somewhere (without the phpThumb query string) to get all other thumbs displayed

    hope someone got an idea where this is coming from and how i could fix this - it’s driving me nuts smiley

    thanks, j
      • 7923
      • 4,213 Posts
      The way that ditto works (IIRC), is that when it sets the placeholders for the template, it first tries to find out what template variables have been used in the template and then processes those as placeholders for the template. It seems that the logic in Ditto what tries to find out what placeholders are used in the template does not work if the placeholder is inside a phx call (probably because phx call seems as a placeholder itself). MaxiGallery has same kind of code, but it’s done little bit differently.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 26931
        • 2,314 Posts
        ... processes those as placeholders for the template. It seems that the logic in Ditto what tries to find out what placeholders are used in the template does not work if the placeholder is inside a phx call (probably because phx call seems as a placeholder itself)....
        ah, thank’s doze for clarification (maybe i should post in the ditto forum as well).
        btw. what’s the purpose of "input=" in your modifier?
          • 7923
          • 4,213 Posts
          Check phx docs, that’s how you use it standalone. input modifier is set to use the input.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 36416
            • 589 Posts
            Quote from: sharkbait at Jan 31, 2010, 12:27 AM

            ... processes those as placeholders for the template. It seems that the logic in Ditto what tries to find out what placeholders are used in the template does not work if the placeholder is inside a phx call (probably because phx call seems as a placeholder itself)....
            ah, thank’s doze for clarification (maybe i should post in the ditto forum as well).

            Doze is right, so you need to manually tell Ditto which TVs to use in those complex placeholders scenario. Read this:
            http://ditto.modxcms.com/tutorials/phx-and-nested-tags.html
              • 26931
              • 2,314 Posts
              Doze is right, so you need to manually tell Ditto which TVs to use in those complex placeholders scenario. Read this:
              http://ditto.modxcms.com/tutorials/phx-and-nested-tags.html
              ah, thanks ... unfortunately it didn’t work, even without the nested phx statement. guess i post in the ditto forum later
                • 36416
                • 589 Posts
                Quote from: sharkbait at Feb 01, 2010, 05:01 AM

                Doze is right, so you need to manually tell Ditto which TVs to use in those complex placeholders scenario. Read this:
                http://ditto.modxcms.com/tutorials/phx-and-nested-tags.html
                ah, thanks ... unfortunately it didn’t work, even without the nested phx statement.

                Did you manually set required fields in the &hiddenfields Ditto parameter?
                  • 26931
                  • 2,314 Posts
                  Did you manually set required fields in the &hiddenfields Ditto parameter?

                  i added &hiddenFields=`Portrait` to my ditto call...right?

                  *edit: weeeeeee - thanks Eol - it’s working smiley
                    • 36416
                    • 589 Posts
                    Quote from: sharkbait at Feb 01, 2010, 05:48 AM

                    Did you manually set required fields in the &hiddenfields Ditto parameter?

                    i added &hiddenFields=`Portrait` to my ditto call...right?

                    Nope, parameter names are case-sensitive... wink