vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP problems getting annoying... (https://vborg.vbsupport.ru/showthread.php?t=66081)

Ryan Ashbrook 06-11-2004 09:24 PM

PHP problems getting annoying...
 
I'm recoding my site, and I have it so that based on a certain condition the content changes from one include of a .htm file to another include.

Well, I get sorta what I want, but when I try to go to a page other than the index, one page just shows up for them all.

Like if I go to www.domain.com/index.php?page=aff_apply the affiliation page shows, but if I go to www.domain.com/index.php?page=staff the affiliation page still shows.

It's probably something in my coding...

You can look for your self here: www.theglassprison.net click on any link that has ?page= in it, and you'll be taken to the affiliation page.

Here's the code I'm using...

PHP Code:

if (!$page)
{
    
$content './news.htm';
}
else
if (
$page="aff_apply")
{
    
$content './aff_apply.htm';
}
else
if (
$page="fanart")
{
    
$content './fanart.htm';
}
else
if (
$page="fanfiction")
{
    
$content './fanfic.htm';
}
else
if (
$page="host_apply")
{
    
$content './host_apply.htm';
}
else
if (
$page="staff")
{
    
$content './staff.htm';
}
else
if (
$page="wallpaper")
{
    
$content './wallpaper.htm';


I really need help on this...

ViaraiX 06-11-2004 09:55 PM

try changing

else
if (...

to

elseif (...

filburt1 06-11-2004 10:02 PM

Quote:

Originally Posted by ViaraiX
try changing

else
if (...

to

elseif (...

Don't use = when comparing items. Use the comparison operator ==. Right now every condition you have returns true.

filburt1 06-11-2004 10:04 PM

BTW, you can optimize that down to two statements:

PHP Code:

$pages = array
(
    
"" => "news",
    
"aff_apply" => "aff_apply",
    
"fanart" => "fanart",
    
"fanfiction" => "fanfic",
    
"host_apply" => "host_apply",
    
"staff" => "staff",
    
"wallpaper" => "wallpaper"
);
$content $pages[$page]; 


Ryan Ashbrook 06-11-2004 10:15 PM

Quote:

Originally Posted by filburt1
BTW, you can optimize that down to two statements:

PHP Code:

$pages = array
(
    
"" => "news",
    
"aff_apply" => "aff_apply",
    
"fanart" => "fanart",
    
"fanfiction" => "fanfic",
    
"host_apply" => "host_apply",
    
"staff" => "staff",
    
"wallpaper" => "wallpaper"
);
$content $pages[$page]; 


Oh heh, thanks filburt. ^_^


All times are GMT. The time now is 03:49 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01024 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete