str_replace() function and multiple variables?
<p>This is going to be pretty hard to explain, so I'll try to make it as much of a chronological story as possible and end with the question, so that anyone who needs a relatively in-depth idea of what I'm talking about has one :).</p>

<p>I have a theme template with four text containers named <code>primary_headline</code>, <code>primary_subline</code>, <code>secondary_headline</code> and <code>secondary_subtext</code>. The content for each container comes from <code>echo($container_name)</code>.</p>

<p>Each container has it's own variable, <code>$container_name</code>, which posts user created content to from a form, contents which sometimes contains the variables <code>$city_name</code> and <code>$ref_name</code> as raw data (i.e. "Hello, I'm from $city_name"), as <code>$city_name</code> and <code>$ref_name</code> has assigned values, for arguments sake let's just say <code>$city_name</code>= <code>Dallas</code> and <code>$ref_name</code> = <code>Facebook</code>.</p>

<p>Originally, I believed that I only wanted the user to be able to use <code>$city_name</code> and <code>$ref_name</code> within the <code>secondary_subtext</code> container, and I was also going to make the option to use <code>$city_name</code> OR <code>$ref_name</code> the choice of the user in the first place (they'd have to select one, or the other, or none - but couldn't select both.</p>

<p>However, I now want to allow <code>$city_name</code> AND <code>$ref_name</code> across all four container variables (<code>$secondary_subtext</code> for example).</p>

<p>So, my question is, how do I go about doing that in the easiest possible fashion?</p>

<p>Here's my old code for good measure:</p>

<pre><code>if($geo_text == "enable") {
    $geo_init = include("inc/geo_text.php");
    $secondary_headline = str_replace('$city_name', $city_name, $_POST['secondary_headline']); // $_POST data from user
} else($ref_text == "enable") {
    $ref_init = include("inc/ref_text.php");
    $secondary_headline = str_replace('$ref_name', $ref_name, $_POST['secondary_headline']); // $_POST data from user
} else { $secondary_headline = $_POST['secondary_headline']; }
</code></pre>

<p>Any comments/answers etc will be very greatly appreciated :)!!</p>
