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

    I am building a portfolio section in my website for which I have this code in my project_item template:
    The second part with [[!getImageList? is working ok, but have problem with the first part.
    I can't h ave the [[+image]] and [[*pagetitle]] to be substituted with the actual data.
    How can I reference for them outside of [[!getImageList? ?
    Or is there a better way to do this? I am really not a developer.

    Many thanks

    <a href="[[+image]]" title="[[*content]]" rel="shadowbox[[[*pagetitle]]]">
    <img src="[[+image]]" alt="[[*content]]" width="589" height="400" /></a>



    [[!getImageList?
    &tvname=`project_item`
    &tpl=`@CODE:<a href="[[+image]]" class="structural" title="[[*pagetitle]]" rel="shadowbox[[[*pagetitle]]]" />[[*pagetitle]]</a>
    `]] [ed. note: openstep last edited this post 13 years, 10 months ago.]
      • 4172
      • 5,888 Posts
      do you really want to show the pagetitle of the current resource on each image?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 41958
        • 65 Posts
        Do I really need those you put down below in your last post, I am totally lost in these?
        I am sure it is a very useful stuff, I am just not smart enough to understand how to use it.
        I have spent most of today to figure out only a few things smiley
        I there an easier way to make at least [[+image]] to work so I can display the image and make the link to function.
        I should figure out something to replace pagetitle with, any suggestions?
        Thanks, Bruno [ed. note: openstep last edited this post 13 years, 10 months ago.]
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          When you use a standard resource field tag like [[*pagetitle]] or [[*content]] it will insert the value for the current resource (the page that is being looked at), not for the item that getImageList is processing. You need to use placeholder tags to match the fields in your MIGx form - [[+pagetitle]] and [[+content]].
            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
            • 4172
            • 5,888 Posts
            I'm not sure to understand correctly what you are trying.

            Lets say you have some resources with a working MIGX-TV in it, with some MIGX - images in each resource.
            And you are listing this resources with getResources.

            To get the first image into each output-block, you will need a getImageList-snippet-call in your getResources-tpl-chunk with something like that:

            [[!getImageList?
            &tvname=`project_item`
            &tpl=`yourMIGXtpl`
            &docid=`[[+id]]`
            &limit=`1`
            &pagetitle=`[[+pagetitle]]`
            ]] 


            chunk yourMIGXtpl:

            <img src="[[+image]]" alt="[[+property.pagetitle]]" width="589" height="400" />

              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 41958
              • 65 Posts
              Thanks sottwell, I was thinking I need them just not sure exactly how. Would you show me how in my case, please?
                • 41958
                • 65 Posts
                Bruno,

                what I am trying is that I want to create a portfolio item page/resource in modx term then a projets page later and aggregate all the portfolio items together, but that will come later as now I am heaving problems with the portfolio item page first.

                here is what I have now: http://dobodesign.com/munkak/modx/index.php?id=10

                and my problem is with this
                <a href="[[+image]]" title="[[*content]]" rel="shadowbox[[[*pagetitle]]]">
                <img src="[[+image]]" alt="[[*content]]" width="589" height="400" /></a>

                Basically I would like to have the frst image to be displayed and be a link. And the rest of the images just links. The latter is already working, but heaving problem with the above.
                I can not get the href= and img src= to substitute the relevant code. They would contain the first image.

                My output would be like on this page that I would like to recreate:
                http://dobodesign.com/index.php?p=1&h=1
                (btw this is what I would like it to look once I aggregate them)
                the relevant part is between the section (this is what about I am trying to do now with the project_item resource)
                <li class="project"> ..... </li><!--end project--> section
                [ed. note: openstep last edited this post 13 years, 10 months ago.]
                  • 41958
                  • 65 Posts
                  I think for a newbie like me, someone who also more visual than a developer, a graphical explanation of this whole thing would be very useful. I am thinking something like infographics.
                  It is easy to get lost in all the details.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    The visitor is looking at a page. This page is the "current resource". Remember this, it's important!

                    You have a listing snippet for this resource; getResources, Wayfinder, getImageList, it doesn't matter at all.

                    You have assigned the snippet some way to indicate what to loop through; &parents for getResources, &startId for Wayfinder, &tvname for getImageList.

                    The snippet gathers up all of the items where you told it to go look, and loops through them one at a time. It assigns the values for that item to placeholders; in the case of getImageList, it uses the input fieldnames in your TV's forms. Then it applies your tpl to the item, replacing the placeholder tags in the tpl with the values it saved. That is what the [[+placeholder]] tags in your tpl are for. It then goes on to do the same thing for the next item, and the next, for each item that it found where you told it to go look.

                    The snippet doesn't care at all about any other tags in the tpl. So if you have a standard MODx tag, like [[*pagetitle]], it ignores it, and MODx iteself will see that tag and replace it with the value for the current resource, just as it would for any resource that had that tag in it.

                    This is possible because MODx goes over the resource content several times. The first time, the snippet tags are there, and get processed, so the snippet does its looping through items and putting them into the tpl. Then MODx goes over the content again, and now instead of the snippet tags it has the listings that the snippet made, including any MODx tags in the tpl that the snippet didn't replace. MODx processes those tags as usual. So for every block in the listing, it will find the [[*pagetitle]] tag, and patiently replace each one with the pagetitle for the current resource.
                      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
                      • 4172
                      • 5,888 Posts
                      you can have two different getImageList-calls

                      for the first image, you will use
                      &limit=`1`


                      for the other ones
                      &offset=`1`


                      or you can use an output-filter in the tpl:

                      [[+idx:is=`1`:then=`
                      here the html for the first image
                      `:else=`
                      here the html for all other images
                      `]]


                      does this do what you need?
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!