i know, stupid question, but how..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
eaposztrof
Forum Newbie
Posts: 12
Joined: Sun Jan 07, 2007 8:58 pm
Location: székelyudvarhely / erdélyország (transylvania)
Contact:

i know, stupid question, but how..

Post by eaposztrof »

in the /page/eng/ dir i have htm and php files
what i want: when the $page.htm not exits, include the $page.php

i try this, but i can't find the "or" function

Code: Select all

if ($page) {
read_html("page/".$language."/".$page.".htm") or read_html("page/".$language."/".$page.".php");
}
and i try this, but not working, when can't find the $spage_htm, crash:

Code: Select all

$spage_htm="page/".$language."/".$page.".htm";
$spage_php="page/".$language."/".$page.".php";
...
$spage = include_once $spage_htm;
	if(!$spage) {
		read_html($spage_php);
	} else {
		include($spage_htm);
	}
i hope i was clear.. thx..
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Code: Select all

if(file_exists("page/".$language."/".$page.".htm"))
{
    // use the html page
}
else
{
    // use the php page
}
This is assuming you want the HTML version of the file to have priority
User avatar
eaposztrof
Forum Newbie
Posts: 12
Joined: Sun Jan 07, 2007 8:58 pm
Location: székelyudvarhely / erdélyország (transylvania)
Contact:

$_SERVER['PHP_SELF']

Post by eaposztrof »

thx.. and congrat for your page design!

when i want to request the selfpage (/asd/index.php) i use:

Code: Select all

$_SERVER['PHP_SELF']
and how i can request the selfpage vih options? like:
/asd/index.php?p=ceg
wildwobby
Forum Commoner
Posts: 66
Joined: Sat Jul 01, 2006 8:35 pm

Re: $_SERVER['PHP_SELF']

Post by wildwobby »

eaposztrof wrote:thx.. and congrat for your page design!

when i want to request the selfpage (/asd/index.php) i use:

Code: Select all

$_SERVER['PHP_SELF']
and how i can request the selfpage vih options? like:
/asd/index.php?p=ceg
use $_GET['p']
User avatar
eaposztrof
Forum Newbie
Posts: 12
Joined: Sun Jan 07, 2007 8:58 pm
Location: székelyudvarhely / erdélyország (transylvania)
Contact:

Re: $_SERVER['PHP_SELF']

Post by eaposztrof »

wildwobby wrote:use $_GET['p']
so i can't get the full line?
User avatar
eaposztrof
Forum Newbie
Posts: 12
Joined: Sun Jan 07, 2007 8:58 pm
Location: székelyudvarhely / erdélyország (transylvania)
Contact:

the problem:

Post by eaposztrof »

the problem is:
i have included asd.php in the index.php, once i have more options, eg ?p=asd1&a=asd2, once just one, eg ?p=asd1. in the asd.php has a link, like ..href="".$page_url_with_options."&loadimage=".$nextimage."";
how i can get the real $page_url_with_options?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Well it's a hell of a lot more sensible to $_GET['whatever'] per variable so you can actually use them, but to each his own.

Code: Select all

$_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING'];
User avatar
eaposztrof
Forum Newbie
Posts: 12
Joined: Sun Jan 07, 2007 8:58 pm
Location: székelyudvarhely / erdélyország (transylvania)
Contact:

Post by eaposztrof »

superdezign wrote:Well it's a hell of a lot more sensible to $_GET['whatever'] per variable so you can actually use them, but to each his own.

Code: Select all

$_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING'];
thx.. really:

Code: Select all

$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

... Did I do that? :?
Post Reply