title: Using PHP variables inside body content area
body: <p>I'm having trouble with using PHP code on my pages, within my body content area. I've searched tirelessly on this site, Drupal's site, and other sites in general, so I apologize if the answer is on this site somewhere, but I can't find it and I need help.</p>
  
  <p>We have a lot of info we reuse throughout our site that I'd like to store in a PHP file as variables. We do this on our site now, but I'm rewriting our whole site to use Drupal. So, for example, we sell software, and I'd like a variable for each of our product URLs for various 'add to cart' buttons on the site. I don't want to have to hardcode the product URL into each link, but rather to seta PHP variable that I can call on any drupal page.</p>
  
  <p>I cannot get anything to work; I've read about several suggestions but none work. I've tried setting the variables as their own block, then calling them from within a page when I create a new page. I can echo the variables on the pages but only within the block they are inside, I cannot call them and get them to echo from other blocks or content areas. I've tried using the global keyword (as per one suggestion) but that didn't work for me.</p>
  
  <p>I hope this makes sense. Other info? I'm using Drupal 6.x, I do have PHP code enabled when creating pages, I do have the PHP filter module enabled, I can get PHP code to render so I know it's working, it's just not working where I need it to be.</p>
  
  <p>I should say (if it's not obvious just from reading this!) I am a Drupal newbie so if anyone can help and try to explain their suggestion as plainly as possible for me, I'd really appreciate it!</p>
  
  <p>Thanks in advance. </p>
  
  <p>EDIT 3/15/11</p>
  
  <p>To try to explain further, I'll post some sample code. I haven't done this yet because there isn't much to show yet, and I thought it might confuse the issue even more.</p>
  
  <p>So, I've made a Drupal 'page' which is for our software trial downloads. The PHP variables that I want to set are for our download links; I want to set them in one place so that if, in the future, the download link needs to change, I only have to do so in one spot. You see, we have download links on various site pages. The same is true of our 'buy now' links. Here is the page code:</p>
  
  <pre><code>&lt;p&gt;Try [product] free for 30 days.&lt;/p&gt;
  
  &lt;!--&lt;p&gt;[token_custom_ewintry]&lt;/p&gt;--&gt;
  
  &lt;p&gt;&lt;?php global $ewintry; ?&gt;&lt;a href="&lt;?php print $ewintry; ?&gt;"&gt;Download for Windows PC&lt;/a&gt;&lt;/p&gt;
  
  &lt;p&gt;&lt;?php global $emactry; ?&gt;&lt;a href="&lt;?php print $emactry; ?&gt;"&gt;Download for Mac OS X&lt;/a&gt;&lt;/p&gt;
  
  &lt;p&gt;&lt;?php global $ebbtry; ?&gt;&lt;a href="&lt;?php print $ebbtry; ?&gt;"&gt;Download for   BlackBerry&lt;/a&gt;&lt;/p&gt;
  
  
  &lt;?php 
  $ebbtryprint = variable_get("ebbtry", "default");
  print $ebbtryprint;
  ?&gt;
  
  &lt;p&gt;&lt;a href="&lt;?php print $ewmtry; ?&gt;"&gt;Download for Windows Mobile&lt;/a&gt;&lt;/p&gt;
  
  &lt;p&gt;&lt;?php global $ipewlstorelink; ?&gt;iPhone, iPad, iPod touch owners: &lt;a href="&lt;?php print $ipewlstorelink; ?&gt;"&gt;Download [product] on the iTunes App Store&lt;/a&gt;. You'll be able to create 10 cards for free to try [product] before you buy!&lt;/p&gt;
  </code></pre>
  
  <p>For this sample I've left in everything I've tried. You'll see my calls to global variables, which never worked. I have the global variables defined in a custom block that I created and placed in my 'content top' region. I learned that apparently nothing from that region is actually accesible to my page's body content, because the calls never worked.</p>
  
  <p>I have a custom token that I made yesterday with the Tokens module; it never worked, but then I read on a different post that by default, tokens are available in the body content area, and I need a special filter. I've yet to find a filter, and so I am not sure this solution will ever work.</p>
  
  <p>I have my call to variable_get. Now, this did work. I have variable_set defined within my template.php page. My value does print using the print call above in my code sample. However, I looked at this page this morning and I don't think that's the answer I need. Because now I'll have to call variable_get on all my pages before I can print anything, right? And that doesn't solve the problem where I wanted to only have to set everything in one place to call anywhere. I tried putting the variable_get call in my custom block, but again I can't access anything in 'content top' from my body content area. The variable_get call prints the value in 'content top' but then it will not re-print below that in the content area.</p>
  
  <p>So maybe that code will help someone to help me. I am going to look in detail at CCK now, as that's the only other suggestion I haven't tried. Thanks in advance if anyone can help.</p>