<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Pull in 1 item from two sections on same page</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Pull-in-1-item-from-two-sections-on-same-page-79024</link>
        <description></description>
        <pubDate>Mon, 20 Apr 2026 12:08:39 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Pull-in-1-item-from-two-sections-on-same-page-79024" rel="self" type="application/rss+xml" />

                <item>
          <title>Pull in 1 item from two sections on same page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2231885#post2231885</link>
          <description><![CDATA[<p>Hi Jason ...</p>
<p>Yep sorted.</p>
<p>Original code was fine ... I'd just placed the placeholder tags slightly out of the right place. I have the ipad specific images loading into a media query specifically for portrait tablet users.</p>]]></description>
          <pubDate>Mon, 23 Sep 2013 03:41:30 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2231885#post2231885</guid>
        </item>
                <item>
          <title>Pull in 1 item from two sections on same page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2231872#post2231872</link>
          <description><![CDATA[<p>Hi,</p>
<p>Okay, so each record has a single upload in it?  In that case, the code you had originally should be fine, as it would load a random record from each section.  When you use your original code, do you run into any issues?</p>

]]></description>
          <pubDate>Fri, 20 Sep 2013 11:49:15 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2231872#post2231872</guid>
        </item>
                <item>
          <title>Pull in 1 item from two sections on same page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2231871#post2231871</link>
          <description><![CDATA[<p>Hi Jason ... thanks for the feedback.</p>
<p>Both sections are multi-record sections with a number of single uploads.</p>
<p>I think the code you suggested was based on a single record sections with numbers uploads within the upload field?</p>]]></description>
          <pubDate>Fri, 20 Sep 2013 11:39:20 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2231871#post2231871</guid>
        </item>
                <item>
          <title>Pull in 1 item from two sections on same page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2231870#post2231870</link>
          <description><![CDATA[<p>Hi,</p>

<p>Are your "home_images" and "ipad_home_images" sections single, or multi-record sections?  the "orderBy" =&gt; 'RAND()' option only randomizes records from multi-record sections, and doesn't randomize the order of the images inside an upload field.  If you want to get a single random image from either of these, you can do this using the PHP shuffle() function to randomize the upload array.  In this example, it assumes that you have at least 1 upload per record and that the upload field in both sections is called "images"</p>

<p><code>&lt;?php header('Content-type: text/html; charset=utf-8'); ?&gt;<br />&lt;?php<br />/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */<br /><br />// load viewer library<br />$libraryPath = 'cmsAdmin/lib/viewer_functions.php';<br />$dirsToCheck = array('/home/sites/XXXXXXXXXXXX/public_html/','','../','../../','../../../');<br />foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}<br />if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }<br /><br />// load records from 'home_images'<br />list($home_imagesRecords, $home_imagesMetaData) = getRecords(array(<br />  'tableName'   =&gt; 'home_images',<br />  'limit'       =&gt; '1',<br />  'orderBy'     =&gt; 'RAND()',<br />  'loadUploads' =&gt; true,<br />  'allowSearch' =&gt; false,<br />));<br /><br /><span style="color:#0000ff;">$homeImagesRecord = $home_imagesRecords[0];</span><br /><br />// load records from 'ipad_home_images'<br />list($ipad_home_imagesRecords, $ipad_home_imagesMetaData) = getRecords(array(<br />  'tableName'   =&gt; 'ipad_home_images',<br />  'limit'       =&gt; '1',<br />  'orderBy'     =&gt; 'RAND()',<br />  'loadUploads' =&gt; true,<br />  'allowSearch' =&gt; false,<br />));<br /><br /><span style="color:#0000ff;">$ipadHomeImagesRecord = $ipad_home_imagesRecords[0];</span><br /><br /><span style="color:#0000ff;">// radomize the image arrays</span><br /><span style="color:#0000ff;">shuffle($homeImagesRecord['images']);</span><br /><span style="color:#0000ff;">shuffle($ipadHomeImagesRecord['images']);</span><br /><br /><span style="color:#0000ff;">// get the first image from the randomized arrays</span><br /><span style="color:#0000ff;">$homeImage = $homeImageRecord['images'][0];</span><br /><span style="color:#0000ff;">$ipadImage = $ipadHomeImagesRecord['images'][0];</span><br /><br />?&gt;</code></p>

<p>Give this a try and let me know if you run into any issues.</p>

<p>Thanks!</p>]]></description>
          <pubDate>Fri, 20 Sep 2013 11:09:05 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2231870#post2231870</guid>
        </item>
                <item>
          <title>Pull in 1 item from two sections on same page</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2231867#post2231867</link>
          <description><![CDATA[<p>Hi all ...</p>
<p>I have two sections in CMS builder both containing uploaded image files (home images &amp; ipad home images).</p>
<p>I am trying to load a random one from each section into the same page ... is this possible?</p>
<p>Here's the step 1 load records code I've been trying to get working:</p>

<p>&lt;?php header('Content-type: text/html; charset=utf-8'); ?&gt;<br />&lt;?php<br /> /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */<br /><br /> // load viewer library<br /> $libraryPath = 'cmsAdmin/lib/viewer_functions.php';<br /> $dirsToCheck = array('/home/sites/XXXXXXXXXXXX/public_html/','','../','../../','../../../');<br /> foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}<br /> if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }</p>
<p>// load records from 'home_images'<br /> list($home_imagesRecords, $home_imagesMetaData) = getRecords(array(<br /> 'tableName' =&gt; 'home_images',<br /> 'limit' =&gt; '1',<br /> 'orderBy' =&gt; 'RAND()',<br /> 'loadUploads' =&gt; true,<br /> 'allowSearch' =&gt; false,<br /> ));</p>
<p>// load records from 'ipad_home_images'<br /> list($ipad_home_imagesRecords, $ipad_home_imagesMetaData) = getRecords(array(<br /> 'tableName' =&gt; 'ipad_home_images',<br /> 'limit' =&gt; '1',<br /> 'orderBy' =&gt; 'RAND()',<br /> 'loadUploads' =&gt; true,<br /> 'allowSearch' =&gt; false,<br /> ));</p>
<p>?&gt;</p>
]]></description>
          <pubDate>Fri, 20 Sep 2013 08:52:47 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2231867#post2231867</guid>
        </item>
              </channel>
    </rss>
  