SmArTaSs
11-28-2003, 09:27 PM
First off, I've only been working with PHP for 3 or 4 weeks.
So this might be an easy problem to solve, maybe not.
Here's my problem: EVERY page on my site has ?p= (eg. ?p=games) except for the index page, so that func.php knows that file to include. The problem comes about when ?p= does not appoear in the URL (on the index).
When people are looking at /index.php or / I want to include news/show_news.php. I have tried all the diff combinations of if, elseif, else, etc. and nothing works.
Right now when you look at index.php, with no ?p=, it shows no content. I want it to show the news when ?p= does not appear in the URL.
http://smartass.buildtolearn.com/
Any suggestions?
the code w/ the problem in index.php:
if($_GET['p']){
include('func.php');
content();
}
else{
include("news/show_news.php");
}
func.php:
<p align="center">
<?php
function content() {
if($_GET["p"] == "") { require("links/config.php");}
if($_GET["p"] == "join") { include("links/join.php");}
if($_GET["p"] == "lostcode") { include("links/lostcode.php");}
if($_GET["p"] == "lostid") { include("links/lostid.php");}
.......
}?>
</p>
So this might be an easy problem to solve, maybe not.
Here's my problem: EVERY page on my site has ?p= (eg. ?p=games) except for the index page, so that func.php knows that file to include. The problem comes about when ?p= does not appoear in the URL (on the index).
When people are looking at /index.php or / I want to include news/show_news.php. I have tried all the diff combinations of if, elseif, else, etc. and nothing works.
Right now when you look at index.php, with no ?p=, it shows no content. I want it to show the news when ?p= does not appear in the URL.
http://smartass.buildtolearn.com/
Any suggestions?
the code w/ the problem in index.php:
if($_GET['p']){
include('func.php');
content();
}
else{
include("news/show_news.php");
}
func.php:
<p align="center">
<?php
function content() {
if($_GET["p"] == "") { require("links/config.php");}
if($_GET["p"] == "join") { include("links/join.php");}
if($_GET["p"] == "lostcode") { include("links/lostcode.php");}
if($_GET["p"] == "lostid") { include("links/lostid.php");}
.......
}?>
</p>