<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>array_groupBy and display image</title>
        <link>https://interactivetools.com/forum/forum-posts.php?array_groupBy-and-display-image-82320</link>
        <description></description>
        <pubDate>Sun, 14 Jun 2026 09:09:24 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;array_groupBy-and-display-image-82320" rel="self" type="application/rss+xml" />

                <item>
          <title>array_groupBy and display image</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245029#post2245029</link>
          <description><![CDATA[<p>What if you created a $researchRecords loop first and then loop over other items? It might be easier if you submitted a support request so I can see how everything is being joined together and I can more specifically help with a code snippet.</p>
<p><a href="https://www.interactivetools.com/support/request/" rel="nofollow">https://www.interactivetools.com/support/request/</a></p>]]></description>
          <pubDate>Wed, 23 Sep 2020 07:06:32 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245029#post2245029</guid>
        </item>
                <item>
          <title>array_groupBy and display image</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245016#post2245016</link>
          <description><![CDATA[<p>Thanks Carl - however that's not working.</p>
<p>I kind of think that this is because the code you've supplied is to display the image per research record - whereas I'm trying to get the image associated to each "brand" based on the grouping</p>
<blockquote>
<p>$researchSeries = array_groupBy($researchRecords, 'brandsNum:label', true);</p>
</blockquote>
<p>Thoughts?</p>]]></description>
          <pubDate>Fri, 18 Sep 2020 15:52:03 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245016#post2245016</guid>
        </item>
                <item>
          <title>array_groupBy and display image</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245015#post2245015</link>
          <description><![CDATA[<p>Hi Toledoh,<br />Were you only wanting to display a single image? In your getRecords function, you are including the uploads in your results so the following code should do the trick you're wanting. Note: I haven't tested it, so you might need to change some things to get it to work. If you want to display multiple images, you can just loop the $image variable and get every image attached to the record.</p>
<pre class="language-php"><code>&lt;?php foreach($researchSeries as $series =&gt; $items): ?&gt;
	&lt;div class="row"&gt;
	&lt;div class="col"&gt;

	&lt;?php
	$image = $items['images'];
if (!empty($images[0]['urlPath'])):
	?&gt;
	&lt;img src="&lt;?php echo $images[0]['urlPath']; ?&gt;"&gt;
    &lt;?php
endif;
	?&gt;

    &lt;h3&gt;&lt;?php echo htmlencode($series) ?&gt;&lt;/h3&gt;&lt;/div&gt;

    &lt;/div&gt;
       &lt;?php foreach ($items as $record): ?&gt;.....&lt;?php endforeach ?&gt;
    &lt;?php endforeach ?&gt;</code></pre>]]></description>
          <pubDate>Fri, 18 Sep 2020 11:59:15 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245015#post2245015</guid>
        </item>
                <item>
          <title>array_groupBy and display image</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245014#post2245014</link>
          <description><![CDATA[<p>Hi All.</p>
<p>I'm grouping records by brand with the code below:</p>
<blockquote>
<p>// load records from 'independent_research_reports'<br />list($researchRecords, $researchMetaData) = getRecords(array(<br />'tableName' =&gt; 'independent_research_reports',<br />'where' =&gt; "`typeNum` = '1'",<br />'loadUploads' =&gt; true,<br />'allowSearch' =&gt; false,<br />));<br />$researchSeries = array_groupBy($researchRecords, 'brandsNum:label', true);</p>
</blockquote>
<p>Sor to display the brand, I use;</p>
<blockquote>
<p>&lt;?php foreach($researchSeries as $series =&gt; $items): ?&gt;<br />&lt;div class="row"&gt;<br />&lt;div class="col"&gt;&lt;h3&gt;&lt;?php echo htmlencode($series) ?&gt;&lt;/h3&gt;&lt;/div&gt;<br />&lt;/div&gt;<br />   &lt;?php foreach ($items as $record): ?&gt;.....&lt;?php endforeach ?&gt;<br />&lt;?php endforeach ?&gt;</p>
</blockquote>
<p>My question is, how do I go about displaying an image with each brand?</p>
<blockquote>
<p>&lt;?php foreach($researchSeries as $series =&gt; $items): ?&gt;<br />&lt;div class="row"&gt;<br />&lt;div class="col"&gt;</p>
<p>[IMAGE HERE]<br />&lt;h3&gt;&lt;?php echo htmlencode($series) ?&gt;&lt;/h3&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;<br />   &lt;?php foreach ($items as $record): ?&gt;.....&lt;?php endforeach ?&gt;<br />&lt;?php endforeach ?&gt;</p>
</blockquote>]]></description>
          <pubDate>Thu, 17 Sep 2020 04:05:05 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245014#post2245014</guid>
        </item>
              </channel>
    </rss>
  