<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Add Default Image to List Output</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Add-Default-Image-to-List-Output-82371</link>
        <description></description>
        <pubDate>Mon, 16 Mar 2026 22:44:53 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Add-Default-Image-to-List-Output-82371" rel="self" type="application/rss+xml" />

                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245346#post2245346</link>
          <description><![CDATA[<p>That's perfect, thanks Hans and Jenna for all your help.</p>]]></description>
          <pubDate>Wed, 27 Jan 2021 04:14:43 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245346#post2245346</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245335#post2245335</link>
          <description><![CDATA[<p>Hi Mark,</p>
<p>In order to check if a logo image exists, and to display a placeholder in the case it doesn't exist, please try the following:</p>
<pre class="language-php"><code>&lt;?php if ($record['logo_image']) : ?&gt;
&lt;!-- boolean check to see if logo_image exists for the record, returns true or false --&gt;

  &lt;?php foreach ($record['logo_image'] as $upload): // Do not need $index =&gt; $upload if you don't utilise $index anywhere in your code ?&gt;
     &lt;!-- show the image from the record, using urlPath as the src --&gt;
     &lt;!-- htmlencode all values to prevent JavaScript injections --&gt;
     &lt;img src="&lt;?php echo htmlencode($upload['urlPath']) ?&gt;" width="200px" alt="&lt;?php echo htmlencode($record['title']) ?&gt; Logo" title="&lt;?php echo htmlencode($record['title']) ?&gt; Logo"&gt;&lt;br&gt;
  &lt;?php endforeach ?&gt;
        
&lt;?php else: ?&gt;
  &lt;!-- No uploaded image, show placeholder --&gt;
  &lt;img src="<a href="https://DOMAIN.com/PLACEHOLDERIMG.jpg" rel="nofollow">https://DOMAIN.com/PLACEHOLDERIMG.jpg</a>" alt="Placeholder Image"&gt;

&lt;?php endif ?&gt;</code></pre>
<p>If you need to only check to see if it's got one image uploaded... you can either add a break just one line above the <em>endforeach</em> like seen below:</p>
<pre class="language-php"><code>&lt;?php foreach ($record['logo_image'] as $upload): ?&gt;
     &lt;img src="&lt;?php echo htmlencode($upload['urlPath']) ?&gt;" width="200px" alt="&lt;?php echo htmlencode($record['title']) ?&gt; Logo" title="&lt;?php echo htmlencode($record['title']) ?&gt; Logo"&gt;&lt;br&gt;
     &lt;?php break; ?&gt;
&lt;?php endforeach ?&gt;</code></pre>
<p> Only if you have multiple <em>logo_image</em> files set up will it begin to display more than one image at a time so the above <em>break</em> would be helpful. If that's never a case you would run into, please don't worry about the extra code, it's only a suggestion for implementation.</p>
<p>Please let me know if you have any questions, I'd be more than happy to help.</p>
<p>J</p>]]></description>
          <pubDate>Tue, 26 Jan 2021 12:20:50 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245335#post2245335</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245301#post2245301</link>
          <description><![CDATA[<p>Sure. Send the details at hans@interactivetools.com. I need FTP access, minimum.</p>]]></description>
          <pubDate>Thu, 07 Jan 2021 05:26:32 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245301#post2245301</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245294#post2245294</link>
          <description><![CDATA[<p>I can setup a similar test in our private beta install and let you have access to do a quick look, but need to know where to send the details?</p>]]></description>
          <pubDate>Thu, 07 Jan 2021 00:15:07 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245294#post2245294</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245291#post2245291</link>
          <description><![CDATA[<p>I don't think it would be enough for me to test whether the code works as intended or not, unfortunately.</p>]]></description>
          <pubDate>Wed, 06 Jan 2021 07:46:07 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245291#post2245291</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245290#post2245290</link>
          <description><![CDATA[<p>May be easier to just send you the PHP file I'm using to do the output? Email?</p>]]></description>
          <pubDate>Wed, 06 Jan 2021 07:42:21 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245290#post2245290</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245289#post2245289</link>
          <description><![CDATA[<p>Perhaps we can discuss this with a screen share? Just so I won't miss any details.</p>
<p>Thanks.</p>]]></description>
          <pubDate>Wed, 06 Jan 2021 07:34:01 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245289#post2245289</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245284#post2245284</link>
          <description><![CDATA[<p>So that didn't work either. I ended up going back to the Code Generator just to get the basics working first and for testing came up with this:</p>
<pre class="language-markup"><code>    &lt;?php foreach ($isp_listRecords as $record): ?&gt;

      &lt;!-- STEP 2a: Display Uploads for field 'logo_image' (Paste this anywhere inside STEP2 to display uploads) --&gt;

        &lt;?php foreach ($record['logo_image'] as $index =&gt; $upload): ?&gt;

          &lt;img src="&lt;?php echo htmlencode($upload['urlPath']) ?&gt;" width="200px" alt="&lt;?php echo $record['title'] ?&gt;" title="&lt;?php echo $record['title'] ?&gt;"&gt;&lt;br&gt;
          	  
        &lt;?php endforeach ?&gt;
        	
&lt;?php if(gettype($record['logo_image']) !== "string"){ ?&gt;
&lt;img src="&lt;?php echo htmlencode($upload['urlPath']) ?&gt;" width="200px" alt="&lt;?php echo $record['title'] ?&gt;" title="&lt;?php echo $record['title'] ?&gt;"&gt;&lt;br&gt;
&lt;?php } else { ?&gt;
&lt;div class="vanishmobile"&gt;&lt;img src="<a href="https://via.placeholder.com/350x150" rel="nofollow">https://via.placeholder.com/350x150</a>" alt="Logo Image" title="Logo Image" /&gt;&lt;/div&gt;
&lt;?php } ?&gt;

      &lt;!-- STEP2a: /Display Uploads --&gt;

    &lt;?php endforeach ?&gt;</code></pre>
<p>I've included both the standard image code from CMSB and your selection code below (so we're out putting two images here per record, just for testing). You'll note I reversed the order of the default image from your code, as otherwise it loaded the default for everything.</p>
<p>Now initially this seems to work, but when I delete one of the product images to see if the placeholder image loads instead (the desired outcome) then it doesn't. Oddly the image from a different product loads in its place (usually taken from the product directly above the one that has a deleted image). Suggestions?</p>]]></description>
          <pubDate>Tue, 05 Jan 2021 09:08:30 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245284#post2245284</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245283#post2245283</link>
          <description><![CDATA[<p>Oh my bad. I assumed logo_image was an array.</p>
<pre class="language-markup"><code>&lt;?php if(gettype($isp_listRecord['logo_image']) !== "string"){ ?&gt;

&lt;div class="vanishmobile"&gt;&lt;img src="<a href="https://via.placeholder.com/350x150" rel="nofollow">https://via.placeholder.com/350x150</a>" alt="Logo Image" title="Logo Image" /&gt;&lt;/div&gt;

&lt;?php } else { ?&gt;

&lt;div class="vanishmobile"&gt;
&lt;a href="&lt;?php echo htmlencode($isp_listRecord['website_link'],ENT_QUOTES); ?&gt;" target="_new"&gt;

&lt;img src="&lt;?php echo htmlencode($isp_listRecord['logo_image'],ENT_QUOTES); ?&gt;" alt="&lt;?php echo htmlencode($isp_listRecord['title'],ENT_QUOTES); ?&gt; Logo Image" title="&lt;?php echo htmlencode($isp_listRecord['title'],ENT_QUOTES); ?&gt; Logo Image" /&gt;

&lt;/a&gt;&lt;/div&gt;

&lt;?php } ?&gt;</code></pre>

<p>Try that instead, and get back to me.</p>]]></description>
          <pubDate>Tue, 05 Jan 2021 07:39:23 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245283#post2245283</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245282#post2245282</link>
          <description><![CDATA[<p>Hi Hans,</p>
<p>If I strip that right back to just trying to output the image URL then I still get these:</p>
<p>E_WARNING: count(): Parameter must be an array or an object that implements Countable</p>
<p>E_NOTICE: Undefined index: logo_image</p>
<p>.. stemming from this line:</p>
<pre class="language-markup"><code>&lt;?php if(count($isp_listRecords['logo_image']) === 0){ ?&gt;</code></pre>
]]></description>
          <pubDate>Tue, 05 Jan 2021 03:58:50 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245282#post2245282</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245272#post2245272</link>
          <description><![CDATA[<p>Ideally, you would do it by checking the length of the current array. Also, all data that is user-inputted should be html-encoded so as to prevent a JS injection.</p>
<pre class="language-php"><code>&lt;?php if(count($isp_listRecord['logo_image']) === 0){ ?&gt;

&lt;div class="vanishmobile"&gt;&lt;img src="<a href="https://via.placeholder.com/350x150" rel="nofollow">https://via.placeholder.com/350x150</a>" alt="" ?&gt; Logo Image" title="Logo Image" /&gt;&lt;/div&gt;

&lt;?php } else { ?&gt;

&lt;?php foreach ($isp_listRecord['logo_image'] as $upload): ?&gt;

&lt;div class="vanishmobile"&gt;&lt;a href="&lt;?php echo $isp_listRecord['website_link'] ?&gt;" target="_new"&gt;&lt;img src="&lt;?php echo htmlencode($upload['urlPath'],ENT_QUOTES) ?&gt;" alt="&lt;?php echo htmlencode($isp_listRecord['title'],ENT_QUOTES) ?&gt; Logo Image" title="&lt;?php echo htmlencode($isp_listRecord['title'],ENT_QUOTES) ?&gt; Logo Image" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;?php endforeach ?&gt;

&lt;?php } ?&gt;

</code></pre>

<p>With regards to the other code:</p>
<pre class="language-markup"><code>&lt;?php if (count($isp_listRecords) === 0): ?&gt;
	&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;No records were found!&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;
&lt;?php endif ?&gt;</code></pre>]]></description>
          <pubDate>Mon, 04 Jan 2021 09:45:48 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245272#post2245272</guid>
        </item>
                <item>
          <title>Add Default Image to List Output</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2245265#post2245265</link>
          <description><![CDATA[<p>I currently output a simplistic list summary using this code.</p>
<pre class="language-markup"><code>&lt;?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  require_once "/system/lib/viewer_functions.php";

  $orderBy = @$_REQUEST['orderBy'];  
  $orderByClean = "";

  if(!$orderByClean) { $orderByClean = 'ufbb_cheap_total_price+0'; }

  list($isp_listRecords, $isp_listMetaData) = getRecords(array(
    'tableName'   =&gt; 'isp_list',
    'limit'     =&gt; '5',
	'loadCreatedBy' =&gt; false,
	'where'       =&gt; " category LIKE '%Ultrafast Broadband%' ", 
	'orderBy'       =&gt; $orderByClean,
  ));

?&gt;

&lt;ul class="g_ulbox"&gt;
    &lt;?php foreach ($isp_listRecords as $record): ?&gt;
&lt;li style="padding-bottom:3px;"&gt;&lt;a href="//www.DOMAIN.com/Detail_Output.php?&lt;?php echo preg_replace("/[ ]/", "-", $record['title']); ?&gt;-&lt;?php echo $record['num'] ?&gt;" title="&lt;?php echo $record['title'] ?&gt;"&gt;&lt;?php echo $record['title'] ?&gt;&lt;/a&gt; &amp;pound;&lt;?php echo $record['ufbb_cheap_total_price'] ?&gt;&lt;br /&gt;Speed: &lt;?php echo $record['ufbb_cheap_download_average_speed'] ?&gt;, &lt;?php echo $record['ufbb_cheap_usage'] ?&gt;&lt;br /&gt;Gift: &lt;?php echo $record['ufbb_cheap_voucher_or_gift_credit'] ?&gt;&lt;/li&gt;
    &lt;?php endforeach ?&gt;
&lt;/ul&gt;
		
&lt;?php if (!$isp_listRecords): ?&gt;
	&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;No records were found!&lt;/u&gt;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;
&lt;?php endif ?&gt;</code></pre>
<p>Now what I want to be able to do is add the product image to that output, while also displaying a default image if the product doesn't yet have an image uploaded. I can already do this by inserting the following code on an individual product output page using this code:</p>
<pre class="language-markup"><code>&lt;?php foreach ($isp_listRecord['logo_image'] as $upload): ?&gt;
&lt;div class="vanishmobile"&gt;&lt;a href="&lt;?php echo $isp_listRecord['website_link'] ?&gt;" target="_new"&gt;&lt;img src="&lt;?php echo $upload['urlPath'] ?&gt;" alt="&lt;?php echo $isp_listRecord['title'] ?&gt; Logo Image" title="&lt;?php echo $isp_listRecord['title'] ?&gt; Logo Image" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;?php endforeach ?&gt;
&lt;?php if (!$isp_listRecord['logo_image']) : ?&gt;
&lt;div class="vanishmobile"&gt;&lt;a href="&lt;?php echo $isp_listRecord['website_link'] ?&gt;" target="_new"&gt;&lt;img src="//www.DOMAIN.COM/noImageProduct.jpg" alt="Default Logo Image" title="Default Logo Image" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;?php endif ?&gt;</code></pre>
<p>So ideally I need to get something similar working in the list output too, but I'm not sure quite how to do it?</p>]]></description>
          <pubDate>Mon, 04 Jan 2021 01:29:51 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2245265#post2245265</guid>
        </item>
              </channel>
    </rss>
  