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

    I have a site where I'm setting up a "Sponsors" page. Under the Sponsors page itself I am making Web Links for each of the sponsoring entities. In the web link, I am populating the "Description" field with a path to an image to use for the hyperlink for that page, and using getResources to collect all of the child links and bring them onto the Sponsors page, build the URL, and so on.

    What I am trying to wrap my head around is a reasonable process that I could use to dynamically build out a grid/table for displaying the links. It would need to be a fixed number of columns, a dynamic number of rows (dependent on how many Child Resources are found), and be able to understand which column to put the resources in.

    Based on the size of the page and the available space for populating entries, and combining that with the fixed size of the images being used, this will likely be a two column table although it's possible that three columns would fit nicely as well (haven't tested yet).

    If anyone has any suggestions, I'm all ears!

    Thanks in advance.
      • 49529
      • 196 Posts
      MIGX extra looks like a suitable solution.
        • 42535
        • 52 Posts
        Actually, I just figured out a way to do it with a bit of manual code and then getResources... here's what I did.

        In the Sponsors page, I added the following code:

        <table width="680px">
            <tr>
                [[getResources? &parents=`13` &tpl=`getResourceLinkWithImageTblTpl` &tpl_n3=`getResourceLinkWithImageTbl3Tpl` &limit=`0` &sortby=`-menuindex` &showHidden=`1`]]
            </tr>
        </table>


        I've manually defined that I will be using a table and set a fixed width. I then call out the definition for the first row and had the processing over to getResources. The primary TPL will be called with the secondary TPL being called for every third record that it finds. The TPLs look like this:

        Primary
        <td width="225" align="center">
            <a href=[[~[[+id]]]] [[+link_attributes]]><img src="[[+description]]"></a><br>
        </td>
        


        Secondary
        <td width="225" align="center">
            <a href=[[~[[+id]]]] [[+link_attributes]]><img src="[[+description]]"></a><br>
        </td>
        </tr>
        <tr>


        Once the getResources processing is done, the Sponsors page inserts a row close and a table close. For me, I end up with an extra row at the bottom, but this isn't an issue for me as my table is at the end of my page and I do not use borders. I could have gone a step further to add the &tplLast and use THAT to close the row AND the table, and likely will, but this hits what I was searching for pretty easily.