Reply to Re: [PHP] help out a noob w/ include & switch?

Your name:

Reply:


Posted by Philip Hallstrom on 09/21/05 02:09

> Hi All,
> My very first post to this group as I'm a freshly spanked new born php
> baby. Hope I have the correct stop for noob tech questions. Please
> re-direct me if I have it wrong. I've been doing web dev for a quite while
> with a variety of methods (html, xhtml/css, cfml, flash/as, on and on...).
> I work mainly for non-profit organizations and thought it was about time to
> get away from commercial software. I'm doing my first site now w/ a
> XHTML/CSS template that uses PHP to insert data from a switch container and
> from a MySQL db.
>
> My problem occurs only on the server (NT 5 b.2195, PHP 4.3.10, IIS 5.0) but
> works great on my dev rig (XAMPP 1.4.15, VectorLinux).
>
> My template "index.php" uses 'include' to get '$vars' from two files. one
> for the body text and title, and the other for the navigation. Click on a
> link in the navbar and index.php reloads with the new navbar and the
> associated content each into it's <div>. Works great on my test rig but the
> server the site will be hosted from ignores the urlencoded vars and just
> loads the switch defaults. For whatever reason I tried return() instead of
> break. Again, it worked on my rig but not the server. I know i'm missing
> some dumb little thing but I have not figured out what yet. I also tried
> session_unset() at the beginning of the index.php in case the problem was
> with caching. Didn't work either but may be due to incorrect usage. Any
> help or advice is very greatly appreciated!!

I'm guessing that register_globals is set to On on your dev box and Off on
your NT server. Check the manual for register_globals along with $_GET.

or if that fails, create a simple phpinfo() page on both servers and
compare the output to see what settings are different.


>
> jt.
>
> index.php:
> <?php
> include 'content.php'; //sets the section title
> echo $title;
> ?>
> <?php
> include 'navigate.php'; //sets appropriate navigation menu
> echo $navigate;
> ?>
> <?php
> echo $content; //loads body text
> ?>
>
> content.php:
> <?php
> switch ($cont)
> {
> case artist1:
> $title = 'event title';
> $content = '<p>some text</p>
>
> <p>some more text</p>
>
> <p class="sig">- artist name</p>';
> break;
> case artist2,3,4:
> [...]
> break;
> default:
> $title = 'event title';
> $content = '<p>some text</p>
>
> <p>some more text</p>
>
> <p class="sig">- artist name</p>';
> break;
> }
> ?>
>
> navigate.php:
> <?php
> switch ($nav)
> {
> case 1:
> $navigate = '<ul><li><a href="index.php?nav=1&amp;cont=artist1">Link
> title<br />by artist1</a></li><li><a
> href="index.php?nav=2&amp;cont=artist2">link title<br />by
> artist2</a></li><li><a href="">some more stuff</a></li><li><a
> href="">Contact</a></li></ul>';
> break;
> case 2,3,4:
> [...]
> break;
> default:
> $navigate = '<ul><li><a href="index.php?nav=1&amp;cont=artist1">Link
> title<br />by artist1</a></li><li><a
> href="index.php?nav=2&amp;cont=artist2">link title<br />by
> artist2</a></li><li><a href="">some more stuff</a></li><li><a
> href="">Contact</a></li></ul>';
> break;
> }
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация