title: Global Variable from Model
body: <p>Not sure if it's global per se, but what I need is a variable that is set from within a model that is dynamically generated when the model gets called. However I need to set a variable that is accessible to multiple views being pulled in through the template to use the same variable.</p>
  
  <p>Its an advertisement ID my clients sponsors have multiple ad spots per page example a 486x 60 and a 160x90 spot. But what I am trying to do is when there ID is pulled at random from the bunch I want all my ad spots to be the same sponsor. </p>
  
  <p>Now I have tried going in my header.php view and defining a variable like</p>
  
  <p><code>$adsIDvar = $this-&gt;modelname-&gt;sponsorids()</code> and then in every view I have ad placement just using $varIDvar but it doesnt seem that any of the views inherate the variable. I have tried to find information on this but most people looking for a similar notation need hard coded variables like a site title for example.</p>
  
  <p>I need something that can cross the barrier, and I'd prefer to avoid sessions/cookies as I want to avoid dealing with the whole Cookie thing in the UK as a good half of the viewers of the site are from the UK and I'd rather not have to go through the effort of saying this site uses cookies blah blah accept/decline just for this purpose. Besides, if they decline, that puts a kink in my work. </p>