Re: [PHP] navigation include not functioning

2009-08-06 Thread tedd
At 10:00 AM -0700 8/5/09, Allen McCabe wrote: -snip- If this sounds like something you are familiar with (former issues and whatnot) please let me know what I'm doing wrong. Try this: http://sperling.com/examples/include-demo/ If you follow what's given there, you'll be further along on incl

Re: [PHP] navigation include not functioning (RESOLVED)

2009-08-05 Thread Paul M Foster
On Wed, Aug 05, 2009 at 02:55:07PM -0700, Ben Dunlap wrote: > > In my navigation.php include file, I had if ($page = about) echo href > > I changed it to if ($page == about) echo and it suddenly > worked! Imagine > > that... > > Another good case for putting the variable on the right side

Re: [PHP] navigation include not functioning (RESOLVED)

2009-08-05 Thread Martin Scotta
Yes, that's a golden rule for a bug free code. The rule shoudl be something like this... Whenever you have a constant value evaluated to a non-constant value put them in the left side of the expression. if( 'constant' == $non_constant ) echo ' variables has that name for anything '; if( fals

Re: [PHP] navigation include not functioning (RESOLVED)

2009-08-05 Thread Ben Dunlap
> In my navigation.php include file, I had if ($page = about) echo href > I changed it to if ($page == about) echo and it suddenly worked! Imagine > that... Another good case for putting the variable on the right side of "==": if ("about" == $page) Then if you mis-type "==" as "=", PH

Re: [PHP] navigation include not functioning (RESOLVED)

2009-08-05 Thread Allen McCabe
I just wanted to let know I figured out my last issue (last as in, for now). In my navigation.php include file, I had if ($page = about) echo href I changed it to if ($page == about) echo and it suddenly worked! Imagine that... Thanks all for you help, you are celebrities in my book now.

Re: [PHP] navigation include not functioning

2009-08-05 Thread Martin Scotta
You are using a value-filled array as a key-filled. Try this snippet and look the results... $pages = array('about' , 'services', 'portfolio', 'contact'); $page = array_key_exists( 'page', $_GET ) ? $_GET[ 'page' ] : 'about'; /*if*/ false === array_search( $page, $pages, true ) && ( $page

Re: [PHP] navigation include not functioning

2009-08-05 Thread Allen McCabe
Okay, I see how href="?page=contact" would work, and I do indeed have only one file (which loads includes), but it still is not working. Clicking a link, be href=?page=contact, href=?page=services, whatever, it still loads the page with the ?page=whatever attached to the URL, but it is not subsitut

Re: [PHP] navigation include not functioning

2009-08-05 Thread ollisso
On Wed, 05 Aug 2009 20:19:00 +0300, Allen McCabe wrote: Sure. When I load my site, default.php loads ( displaying: http://uplinkdesign.hostzi.com/ in the browser as expected). $thisPage is set to "about" via: in the tags. I am seeing this: The first 2 includes work just fine, loading

Re: [PHP] navigation include not functioning

2009-08-05 Thread Martin Scotta
I think you are looking for something like this: $page = array_key_exists( 'page', $_GET ) ? GET['page'] : 'index'; Then you MUST sanitize the $page variable. I often use the querystring to wrapp the module you are requesting: www.example.org/?path/to/molude (note that .htaccess is required) #

Re: [PHP] navigation include not functioning

2009-08-05 Thread Allen McCabe
Sure. When I load my site, default.php loads ( displaying: http://uplinkdesign.hostzi.com/ in the browser as expected). $thisPage is set to "about" via: in the tags. I am seeing this: The first 2 includes work just fine, loading to proper middle section and proper right-hand-side page conte

Re: [PHP] navigation include not functioning

2009-08-05 Thread Jerry Wilborn
I'm having trouble understanding your description of the problem. Can you tell us what you're seeing and what you expect to see? Jerry Wilborn jerrywilb...@gmail.com On Wed, Aug 5, 2009 at 12:00 PM, Allen McCabe wrote: > I am trying to generate pages by importing content in includes, and using

[PHP] navigation include not functioning

2009-08-05 Thread Allen McCabe
I am trying to generate pages by importing content in includes, and using my navigation include to tell PHP to replace a $thisPage variable which all the includes use The idea behind it (I know tons of people do it, but I'm new to this concept), is to have a 'layout' page where only a variable ch