<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1031617" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1031617</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/if-statements#comment-1185329</link>
    <description> &lt;p&gt;Right, you could place my code in the header file as well. I must&#039;ve missed that you had a header file. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 Nov 2005 02:08:34 +0000</pubDate>
 <dc:creator>mscreashuns</dc:creator>
 <guid isPermaLink="false">comment 1185329 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/if-statements#comment-1185327</link>
    <description> &lt;p&gt;Nice Renegade, that works perfectly.&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 Nov 2005 02:03:36 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1185327 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/if-statements#comment-1185322</link>
    <description> &lt;p&gt;What about something like this?&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// if string length is zero, or does not exist&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$bg&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) == \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;0\&quot;) {&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$bg&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = \&quot;images/default.gif\&quot;;&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This is more or less what mscreashuns has posted. And you might want to get a bit more complicated and check if the image your changing exists. If it doesn&#039;t, then go to default.&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// if string length is zero, does not exist, or file doesn&#039;t exist&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if(!&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;file_exists&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$bg&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) || &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$bg&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) == \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;0\&quot;) {&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$bg&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = \&quot;images/default.gif\&quot;;&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;That if() statement will go just before the line:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;img src&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot; echo &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$bg&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; \&quot;&amp;gt;&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Which is in your header file right? So, there&#039;s no need to edit all 400+ pages. If $bg is already set, then, it won&#039;t go to default.&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 Nov 2005 01:48:36 +0000</pubDate>
 <dc:creator>Renegade</dc:creator>
 <guid isPermaLink="false">comment 1185322 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/if-statements#comment-1185319</link>
    <description> &lt;p&gt;Thanks mscreashuns, but I don&#039;t think that is what I am going for.&lt;/p&gt;
&lt;p&gt;Let me rephrase...&lt;/p&gt;
&lt;p&gt;If I define $bg on the staff.php, the background (bg) image will be displayed on staff.php by the header file where the bg tag is. Now, if I do not define $bg I want it to default to localhost/images/bg.gif. I want that code in the header. The site I am working on has 400+ pages and I can&#039;t go into everyone and place a code there.&lt;/p&gt;
&lt;p&gt;Does that make sense?&lt;/p&gt;
&lt;p&gt;This is how it would look in my own language.&lt;/p&gt;
&lt;p&gt;if {bg = &quot;anything&quot;&lt;br /&gt;
then {make it the background image}&lt;/p&gt;
&lt;p&gt;else {make the background = localhost/images/defaultbg.gif}&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/big.png&quot; title=&quot;Laughing out loud&quot; alt=&quot;Laughing out loud&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 Nov 2005 01:28:18 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1185319 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/if-statements#comment-1185317</link>
    <description> &lt;p&gt;Okay, what you can do is add the code I gave you to each page, and on the pages where $bg should be defined, add this line before the code above:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$bg &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;whatever&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;This way it will use whatever that line says, since $bg is not empty. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 Nov 2005 01:14:17 +0000</pubDate>
 <dc:creator>mscreashuns</dc:creator>
 <guid isPermaLink="false">comment 1185317 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/if-statements#comment-1185316</link>
    <description> &lt;p&gt;Can you explain that a little? Where would the default url bg go (&lt;a href=&quot;http://localhost/images/default.gif&quot; class=&quot;bb-url&quot;&gt;http://localhost/images/default.gif&lt;/a&gt;) and the variable inside staff.php?&lt;/p&gt;
&lt;p&gt;I am new to PHP, I just used includes before.&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 Nov 2005 01:10:07 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1185316 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/if-statements#comment-1185315</link>
    <description> &lt;p&gt;Yep, do something like this:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$bg &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;== &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) {&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$bg &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;whatever&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
There are other ways to determine if a variable is empty, but that&#039;s what I always do. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sat, 12 Nov 2005 00:59:17 +0000</pubDate>
 <dc:creator>mscreashuns</dc:creator>
 <guid isPermaLink="false">comment 1185315 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
