<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Displaying 1 upload from first record only</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Displaying-1-upload-from-first-record-only-79488</link>
        <description></description>
        <pubDate>Wed, 09 Sep 2026 09:14:59 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Displaying-1-upload-from-first-record-only-79488" rel="self" type="application/rss+xml" />

                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233926#post2233926</link>
          <description><![CDATA[<p>Hi Ron,</p>
<p>Thanks for catching that variable name that was wrong.   :)</p>]]></description>
          <pubDate>Wed, 07 May 2014 07:36:36 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233926#post2233926</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233925#post2233925</link>
          <description><![CDATA[<p>That is PERFECT! Thank you very much.</p>
<p>Hannah</p>]]></description>
          <pubDate>Wed, 07 May 2014 07:24:31 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233925#post2233925</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233924#post2233924</link>
          <description><![CDATA[<p>It should have been $recordsCount not $imageCount</p>
<p>Here, try this:</p>
<p><code>&lt;?php $recordCount = 1; ?&gt;<br /><br />&lt;?php foreach ($newsRecords as $record): ?&gt;<br /><br />  &lt;?php if ($recordCount == 1): // only on first record ?&gt;<br />      &lt;?php if($record['uploads']): // if images actually exist?&gt;<br />        &lt;?php $upload = $record['uploads'][0] // get the first image in the array?&gt;<br />      &lt;img src = "&lt;?php echo $upload['urlPath'];?&gt;" width = "&lt;?php echo $upload['width'];?&gt;" height = "&lt;?php echo $upload['height'];?&gt;" /&gt;<br />      &lt;?php endif // end, if images exist ?&gt;<br />     &lt;?php endif // end if first record ?&gt;     <br />     <br />     &lt;!-- Print the content for all --&gt;<br />    &lt;strong&gt;&lt;?php echo $record['title']; ?&gt;&lt;/strong&gt;&lt;br /&gt;<br />    &lt;?php echo $record['content']; ?&gt;&lt;br /&gt;<br />    &lt;br /&gt;<br /><br />  &lt;?php $recordCount++; // increase the counter so images are not displayed for records greater than 1 ?&gt;<br />&lt;?php endforeach; ?&gt;</code></p>
<p>I didn't test it but it should work.</p>]]></description>
          <pubDate>Wed, 07 May 2014 06:50:09 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233924#post2233924</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233923#post2233923</link>
          <description><![CDATA[<p>Hi Damon,</p>
<p>It doesn't like the imagecount and throws up an undefined variable when I add that code in. This is the page I'm working on..... can you see what's going wrong?<br /><a href="http://farleighschool.com/NEW_SITE/index.php" rel="nofollow">http://farleighschool.com/NEW_SITE/index.php</a></p>
<p>Thanks!</p>]]></description>
          <pubDate>Wed, 07 May 2014 06:04:23 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233923#post2233923</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233921#post2233921</link>
          <description><![CDATA[<p>Hi,</p>
<p>Try this code but change the variables to match what you have:</p>
<p><code>&lt;?php $recordCount = 1; ?&gt;<br /><br />&lt;?php foreach ($newsRecords as $record): ?&gt;<br /><br />  &lt;?php <strong>if </strong>($recordCount == 1): // first record ?&gt;<br />        <span style="color:#339966;">&lt;?php foreach ($record['uploads'] as $index =&gt; $upload): ?&gt;</span><br /><span style="color:#339966;">               &lt;img src = "&lt;?php echo $upload['urlPath'];?&gt;" width = "&lt;?php echo $upload['width'];?&gt;" height = "&lt;?php echo $upload['height'];?&gt;" /&gt;</span><br /><span style="color:#339966;">        &lt;?php endforeach; ?&gt;</span><br /><span style="color:#339966;">        &lt;strong&gt;&lt;?php echo $record['title']; ?&gt;&lt;/strong&gt;&lt;br /&gt;</span><br /><span style="color:#339966;">        &lt;?php echo $record['content']; ?&gt;&lt;br /&gt;</span><br /><span style="color:#339966;">        &lt;br /&gt;</span><br />   &lt;?php <strong>else</strong>: ?&gt; <br />       <span style="color:#ff6600;"> &lt;strong&gt;&lt;?php echo $record['title']; ?&gt;&lt;/strong&gt;&lt;br /&gt;</span><br /><span style="color:#ff6600;">        &lt;?php echo $record['content']; ?&gt;&lt;br /&gt;</span><br /><span style="color:#ff6600;">        &lt;br /&gt;</span><br />   &lt;?php endif; ?&gt;<br />   <br />     &lt;?php $recordCount++; // increase the counter so images are not displayed for records greater than 1 ?&gt;<br />&lt;?php endforeach; ?&gt;<br /></code></p>
<p>So what happens is a counter is set at 1 and the first if statement checks to see if the counter matches 1. If it does, the green code is used, and if it doesn't, the orange code.</p>
<p>Before the ending foreach statement we have $recordCount++;  which will increment the $recordCount variable to 2, then 3. This prevents the code for only record 1 from being used.</p>
<p>Hope this helps!</p>]]></description>
          <pubDate>Tue, 06 May 2014 12:21:25 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233921#post2233921</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233915#post2233915</link>
          <description><![CDATA[<p>I think you need this logic from another post:</p>
<p><a href="http://www.interactivetools.com/forum/forum-posts.php?postNum=2231833#post2231833" rel="nofollow">http://www.interactivetools.com/forum/forum-posts.php?postNum=2231833#post2231833</a></p>
<p>See if that helps.</p>]]></description>
          <pubDate>Tue, 06 May 2014 06:10:33 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233915#post2233915</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233914#post2233914</link>
          <description><![CDATA[<p>I think this is nearly there but all that happens is it displays the image for the first record for the other two news records ie. displays that 1 image for all 3 records displayed in the side bar. Do I need to add an aditional bit of code or adjust slightly?</p>
<p>Thanks!</p>]]></description>
          <pubDate>Tue, 06 May 2014 03:49:52 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233914#post2233914</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233897#post2233897</link>
          <description><![CDATA[<p>Just after the news viewer you need to get the first record and then the first image of the first record as such:</p>
<p><code>&lt;?php  <br />  list($newsRecords, $newsMetaData) = getRecords(array(<br />    'tableName'   =&gt; 'news', // THIS WOULD BE YOUR VIEWER CODE<br />    'limit'     =&gt; '3',<br />    'loadUploads' =&gt; true,<br />    'allowSearch' =&gt; false,<br />  ));<br /><br />  // ADD THIS BELOW YOUR VIEWER AND SUBSTITUTE YOUR RECORD AND FIELD NAMES <br />  // get first record that has image<br />  $imageRecord = @$newsRecords[0];<br />  // get the first image in first record<br />  $displayImage = $imageRecord['ImageFieldName'][0]; <br />?&gt;<br /></code></p>
<p>Then, in the body, use $displayImage as your image variable like so:</p>
<p><code>&lt;img src="&lt;?php echo $displayImage['urlPath'] ?&gt;" width="&lt;?php echo $displayImage['width'] ?&gt;" height="&lt;?php echo $displayImage['height'] ?&gt;"&gt;</code></p>
<p>You would probably want to check for the existence of the graphic before you use it so as not to create an error.</p>
<p>Hope this is what you are after.</p>]]></description>
          <pubDate>Sun, 04 May 2014 14:36:56 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233897#post2233897</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233894#post2233894</link>
          <description><![CDATA[
<p>use the following:</p>

<blockquote>
<p>&lt;?php</p>
<p>foreach ($data as $record):</p>
<p>echo $record['image'][0]['urlPath'];</p>
<p>endforeach;</p>
<p>?&gt;</p>
</blockquote>

<p>$data is the group of records from a specific section</p>
<p>image is the upload field name</p>]]></description>
          <pubDate>Fri, 02 May 2014 12:07:18 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233894#post2233894</guid>
        </item>
                <item>
          <title>Displaying 1 upload from first record only</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2233893#post2233893</link>
          <description><![CDATA[<p>Hi guys,</p>
<p>This is probably really simple....on my home page I'm pulling in the first 3 records from a larger news section. I would like 1 upload from the first record only to display. How could I acheive this?</p>
<p>Many thanks in advance!<br />Hannah</p>]]></description>
          <pubDate>Fri, 02 May 2014 01:42:48 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2233893#post2233893</guid>
        </item>
              </channel>
    </rss>
  