We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40255
    • 2 Posts
    I have a fairly simple migx call set up for a slider.

    I am using a couple of output filters and they seem to work propperly and only output the div if a link is added to the TV

    I am using this chunk to output the html.

    [[+link:notempty=`
    <div class="content" style="background:url([[+image]])">
    <a style="display:block; width:100%; height:100%" href="[[~[[+link]]]]"></a>
    </div>
    `]]
    
    [[+link:empty=`<img src="[[+image]]" width="100% alt="[[+description]]"/>`]]


    However this doesn't output anything for the href attribute of the link.
    Everything else works fine and the images are pulled in from my slider tv the a only shows on images that are given a resource to link to. but

    <a style="display:block; width:100%; height:100%" href="[[~[[+link]]]]"></a>

    gives
    <a style="display:block; width:100%; height:100%" href=""></a>


    but
    <a style="display:block; width:100%; height:100%" href="[[+link]]"></a>

    gives
    <a style="display:block; width:100%; height:100%" href="31"></a>



    Am I doing something wrong? [ed. note: outlookdigital last edited this post 14 years, 3 months ago.]
      • 40255
      • 2 Posts
      quick update - The problem stops if I disable friendly url on the server, but thats not really an option as I'm using the Articles plugin which requires it to be on [ed. note: outlookdigital last edited this post 14 years, 3 months ago.]
        • 4172
        • 5,888 Posts
        looks all ok for me.
        does it work, when you hardcode the id?

        [[~31]]
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 40045
          • 534 Posts
          had the same problem (when using a Resource List TV in MIGX, see thread https://forums.modx.com/thread/?thread=79645&page=1 that tries to do this another way because of exactly this error =)... there I found (with the help of Bruno by the side =D) a solution using getResources in the Backend, the Wayfinder solution (which would be even nicer) I couldn't get to work... the solution does not change MIGX, but let's you control what is the output for a chosen Resource, so it doesn't just output the plain number of the resource ID but whatever you want, for example an
          [[~ID]]
          ...an that was one solution to the
          [[+link]]
          problem, the other is to instruct your users (that's what I did) to just drag and drop resources into a normal Text TV (which is now the base TV for
          [[+link]]
          , no resourceListTV anymore...), this also generates a link like
           [[~ID]]
          which is then outputted correctly...

          that's the actual (but not very nice) solution for me...before this I tried even a custom output modifier =P... that's how it looks/looked:

          // makeUrl modifier, use like :makeUrl
          // Custom output modifier to prevent errors bc of non integers in [[~ ]] tag...
          
          $output = $input == '' ? $input : $modx->makeUrl((int)$input);
          return $output;
          
          
          [ed. note: exside last edited this post 13 years, 11 months ago.]
            • 42465
            • 33 Posts
            Is there any solution to this? I'm getting the same thing as the OP. [[~99]] works fine. [[+link]] also works. [[~[[+link]]]] doesn't. Exside may have answered the question but I'm afraid I don't understand the response.
              • 36551
              • 416 Posts
              I know this post is getting old, but I've encountered this problem too with the same results.

              I ended up doing this to get a working url. Linkto is the migx text field of a doc id.

              <a href="index.php?id=[[+linkto]]">


              I know it's not very elegant.

              Is there a right way to do this?
                • 4172
                • 5,888 Posts
                <a href="[[~[[+linkto]]]]">


                this should do it. Doesn't it?
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 36551
                  • 416 Posts
                  No. Tried that. It doesn't output anything. Here's my code.

                  <div id="company-overview">
                    [[!getImageList?
                      &tvname=`migx-company-overview`
                      &tpl=`@CODE:
                        <div id="box[[+idx]]" class="box">
                          <h2 class="line1">[[+imagetext1]]</h2>
                          <a href="[[~[[+linkto]]]]" title="[[+imagetext2]]" class="line2">[[+imagetext2]]</a>
                        </div>
                    `]]
                  </div><!--company overview-->


                  Modx 2.2.10
                  Migx 2.5.6
                    • 4172
                    • 5,888 Posts
                    did you try to put this into a chunk:

                          <div id="box[[+idx]]" class="box">
                            <h2 class="line1">[[+imagetext1]]</h2>
                            <a href="[[~[[+linkto]]]]" title="[[+imagetext2]]" class="line2">[[+imagetext2]]</a>
                          </div>
                    


                    and call in with the chunkname:

                    &tpl=`theChunk`
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 36551
                      • 416 Posts
                      Yes. That does work.

                      Any idea why?