<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Using placeholder variables to insert images into text boxes</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Using-placeholder-variables-to-insert-images-into-text-boxes-80913</link>
        <description></description>
        <pubDate>Tue, 14 Jul 2026 09:37:47 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Using-placeholder-variables-to-insert-images-into-text-boxes-80913" rel="self" type="application/rss+xml" />

                <item>
          <title>Using placeholder variables to insert images into text boxes</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2240548#post2240548</link>
          <description><![CDATA[<p>Hi Jerry</p>
<p>There are a few more things to go over.</p>
<p>Could you send me an email to consulting@interactivetools.com (with FTP and CMS login) and we'll continue the conversation there?</p>
<p>Thanks.</p>
]]></description>
          <pubDate>Wed, 17 May 2017 09:13:12 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2240548#post2240548</guid>
        </item>
                <item>
          <title>Using placeholder variables to insert images into text boxes</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2240536#post2240536</link>
          <description><![CDATA[<p>Thanks Ross,</p>
<p>Interesting.</p>
<p>Any idea what we're talking about in terms of cost?</p>
<p>Jerry</p>]]></description>
          <pubDate>Mon, 15 May 2017 17:36:56 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2240536#post2240536</guid>
        </item>
                <item>
          <title>Using placeholder variables to insert images into text boxes</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2240531#post2240531</link>
          <description><![CDATA[<p>Hi Jerry</p>
<p>I have an idea that's a bit different than what you are starting with.</p>
<p>My first thought is setting up the "Image Library" as a multi-record section.  Each record would be a single image upload and text field called "Placeholder".</p>
<p>Let's assume some example placeholder names:</p>
<p>Image1<br />Image2<br />Image3</p>
<p>Note: the placeholders will need to be unique.</p>
<p>Next, we agree on the syntax for calling the images -&gt; example: "#placeholderName"</p>
<p>When you are creating content in another section, you can access the images like this:</p>
<p>"Here's a great photo, #Image1"</p>
<p>Finally, we would build a plugin that runs on record_postSave that reviews the content field and swaps any of the placeholders with an image tag to the appropriate image file.</p>
<p>The plugin will need to include an array that maps out what tables to work and what field names to look for.</p>
<p>Does that make sense?  Feel free to contact me via consulting@interactivetools.com if you want us to build the plugin for you.</p>
<p>Let me know any questions.</p>]]></description>
          <pubDate>Mon, 15 May 2017 15:34:19 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2240531#post2240531</guid>
        </item>
                <item>
          <title>Using placeholder variables to insert images into text boxes</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2240421#post2240421</link>
          <description><![CDATA[<p>Hi All,<br /><br /> I’m using placeholder variables to insert images from a single record “Image Library” into various text boxes on a site, and I’d really like to make the code I'm using both more elegant and dynamic.<br /><br /> Right now, as you’ll see from the code below, the code that assigns images to the variables is hard coded and pretty repetitive, and unless I create a whole other set of placeholders and variables, I can only use thumbUrlPath2. Adding additional images to the library is also a hard coded process.<br /><br /> Anyone have an idea how I can streamline the process and make the code more dynamic so that I can use other Thumbnails and my client can add more placeholders and variables as needed?</p>
<p>(I'm pretty sure that a multi record "Image Library" would be a place to start, but I don't know how to use that to dynamically create the placeholders and assign the variables required.)<br /><br /> Thanks,<br /><br /> Jerry Kornbluth<br /><br /> Here’s the current code that creates the placeholders and assigns the variables (it’s included into each viewer where I want to use images). There are actually 12 placeholders and image fields, but I’ve only shown 3 in this example:</p>
<p><code> &lt;?php // Code to add images to text boxes<br /><br /> list($image_libraryRecords, $image_libraryMetaData) = getRecords(array(<br />     'tableName'   =&gt; 'image_library',<br />     'where'       =&gt; '', // load first record<br />     'loadUploads' =&gt; true,<br />     'allowSearch' =&gt; false,<br />     'limit'       =&gt; '1',<br />   ));<br /><br />   $image_libraryRecord = @$image_libraryRecords[0]; // get first record<br />   ?&gt;<br /> &lt;?php if ($image_libraryRecord['image_1']):?&gt;<br /> &lt;?php foreach ($image_libraryRecord['image_1'] as $index =&gt; $upload): ?&gt;<br />  &lt;?php $image1 = $upload['thumbUrlPath2'] ?&gt;<br /> &lt;?php endforeach ?&gt;<br /> &lt;?php endif ?&gt;<br /> &lt;?php if ($image_libraryRecord['image_2']):?&gt;<br /> &lt;?php foreach ($image_libraryRecord['image_2'] as $index =&gt; $upload): ?&gt;<br />  &lt;?php $image2 = $upload['thumbUrlPath2'] ?&gt;<br /> &lt;?php endforeach ?&gt;<br /> &lt;?php endif ?&gt;<br /> &lt;?php if ($image_libraryRecord['image_3']):?&gt; <br /> &lt;?php foreach ($image_libraryRecord['image_3'] as $index =&gt; $upload): ?&gt;<br />  &lt;?php $image3 = $upload['thumbUrlPath2'] ?&gt;<br /> &lt;?php endforeach ?&gt;<br /> &lt;?php endif ?&gt;<br /><br /> &lt;?php $placeHolders = array("*img1*", "*img2*", "*img3*");<br /> $replaceWith = array(@$image1, @$image2, @$image3); ?&gt;</code></p>
<p>Here’s the code that’s inserted into the viewer(s):</p>
<p><code> &lt;?php echo str_replace($placeHolders, $replaceWith, $my_sectionRecord['my_text_box_contents']);?&gt;<br /></code></p>
<p><br /> And here’s the code that’s inserted into the text box to load the placeholder for $image_4.</p>
<p><code>&lt;div class=”my_class”&gt;&lt;img  src="*img4*"&gt;&lt;/div&gt;</code></p>
<p><br /><br /><br /><br /></p>]]></description>
          <pubDate>Sat, 15 Apr 2017 08:49:16 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2240421#post2240421</guid>
        </item>
              </channel>
    </rss>
  