inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 17, 2005 23:34:45 GMT -8
Hey, Since this is the General Programming forum, i presume that it is fine to ask about a code for a website here... Anyway... I have learnt HTML, Javascript, CSS and quite a bit of PHP, so please when you answer don't say i'm inexperienced and i shuold go back to learning HTML or JS. Ok, anyway, enought chit chat and to my question. QUESTION: I have decided to put everything i have learnt so far into a web site that i am currently making, just to see how much i know well. anyway, i have decided to link the pages with page=pagename so the the directory looks like www.domainnamehere.com/index.php?page=pagenamehere. (like how here it is .com/index.cgi?board=boardname, but i am doing index.php?page=pagename). Now what i want to know is what do i name the file... just say i want it to be www.domainnamehere.com/index.php?page=abcdef what do i call abcdef... I can remember being told it somwhere, but i can't find the site or anything as my computer has been wiped. Please could you help me at this one simple thing, because all i have the codes left, (which i copied over to my USB before it got wiped, so please can someone help me)! Thanks...
|
|
inherit
Banned
29372
0
Sept 7, 2005 14:30:48 GMT -8
It's me again
3,197
August 2004
prohibited
|
Post by It's me again on Jul 17, 2005 23:53:13 GMT -8
Well, I do it like...
say the URL is yoursite.com/index.php?action=register
I do:
<?php $action = $_GET['action']; if($action == register) { include("FILE_NAME.html"); } else { echo "Page does not exist..."; } ?>
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 18, 2005 0:11:54 GMT -8
like what do you mean? Where do i put that?? Please and thanks... pleas help
|
|
inherit
Banned
29372
0
Sept 7, 2005 14:30:48 GMT -8
It's me again
3,197
August 2004
prohibited
|
Post by It's me again on Jul 18, 2005 0:53:01 GMT -8
<?php // This gets the url so it goes action=register $action = $_GET['action']; // If the url is yoursite.com/index.php?action=register if($action == register) { // Include this file if the url is index.php?action=register include(" FILE_NAME.html"); } // Else, if someone types in something different display error else { echo "Page does not exist..."; } ?>
Read comments //... See from my understanding, you are wanting to use the index.php?action=Pro and half each "Action" display a different page.
|
|
inherit
22517
0
Apr 30, 2009 18:49:13 GMT -8
Bradley
Has a new webhost. :) Needs to transfer a lot of stuff. :-/
5,246
April 2004
ccworldwebmaster
|
Post by Bradley on Jul 18, 2005 8:50:25 GMT -8
Here's a slightly different way. It's more organized when using a lot of pages: <?php
// declare and set varibles $page = $_GET['page']; $inc;
// check for no value of page and set to home if($page === null){ $page = "home"; }
// use switch statment for page varible and // for each posssible page add a case section switch ($page) { // for the home page case "home": // file to include with home page code and/or text $inc = "pages/home.php"; // prevent the code from running into the next case break; case "page1": $inc = "pages/page1.php"; break; case "page2": $inc = "pages/page2.php"; break; // for anything else entered display error or main default: $inc = "pages/error.php"; break; }
// include the file into the current page require($inc);
?>
|
|
bile
Full Member
Warning: Listen to the Staff Expires: 02/02/06
FINAL WARNING: Cursing at Staff Expires: May 8, 2006
Posts: 539
inherit
Warning: Listen to the Staff Expires: 02/02/06
FINAL WARNING: Cursing at Staff Expires: May 8, 2006
33541
0
Dec 5, 2006 23:17:32 GMT -8
bile
539
November 2004
bile
|
Post by bile on Jul 18, 2005 9:10:35 GMT -8
|
|
inherit
Banned
29372
0
Sept 7, 2005 14:30:48 GMT -8
It's me again
3,197
August 2004
prohibited
|
Post by It's me again on Jul 18, 2005 14:17:37 GMT -8
PHP is also a part of "Code Support" Here's a slightly different way. It's more organized when using a lot of pages: <?php
// declare and set varibles $page = $_GET['page']; $inc;
// check for no value of page and set to home if($page === null){ $page = "home"; }
// use switch statment for page varible and // for each posssible page add a case section switch ($page) { // for the home page case "home": // file to include with home page code and/or text $inc = "pages/home.php"; // prevent the code from running into the next case break; case "page1": $inc = "pages/page1.php"; break; case "page2": $inc = "pages/page2.php"; break; // for anything else entered display error or main default: $inc = "pages/error.php"; break; }
// include the file into the current page require($inc);
?> Probably so, I just like using it how I do.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 18, 2005 22:50:46 GMT -8
i know how ti works... but i just want to know one thing... Where do i put it? Do i put it instead of <a href............... or what? Also, last time i used include it includes a file for example i used it to include a nav menu... But i want it to go to a new page in the same window, like when you are at www.support.proboards.com and you click General Talk, it changes everything...
|
|
inherit
Proboards Legend
212
0
May 11, 2006 12:32:55 GMT -8
california
21,035
December 1999
california
|
Post by california on Jul 18, 2005 23:08:23 GMT -8
Just use <a href="/index.php?page=blah">blah</a> in your navigation.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jul 19, 2005 1:16:29 GMT -8
Please don't send people somewhere else when they can make use of this board, it's what it is for.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 19, 2005 4:44:16 GMT -8
ok.......
and back ontopic.... help please!
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jul 19, 2005 5:05:56 GMT -8
What do you need help with now?
Cali has answered your last question.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 19, 2005 17:21:57 GMT -8
the 1st one...
i know i do the thanks to cali....!
But does that make it work, or what, are you saying that if i have a file called abcd which is a _______ file type, i should just put the following in as a line of code <a href="/index.php?page=blah">blah</a> then if i have another page in the same folder calld blah which is a _______ file, it should work....
Just fill in the underlines..... that's what i'm asking... i just need to know the file types and to know if that will work
P.S. thanks so far cali...
|
|
inherit
Proboards Legend
212
0
May 11, 2006 12:32:55 GMT -8
california
21,035
December 1999
california
|
Post by california on Jul 19, 2005 19:05:52 GMT -8
1) You mean the index file? It needs to be a PHP file i.e. index.php 2) HTML or PHP, depending on the content. In the CCWorld's code, see this line:
$inc = "pages/page2.php";
that calls for a PHP file in the subdirectory "pages". You could just as easily make in an HTML file, or you can have a PHP file that writes HTML. Doesn't matter.
|
|
inherit
29687
0
Dec 11, 2006 0:27:09 GMT -8
Legendary SSJ Goku
The Legendary Strength revealed...
450
August 2004
lssjg
|
Post by Legendary SSJ Goku on Jul 19, 2005 20:52:19 GMT -8
a php file that writews HTML.... how.... sorry... i'm still learning as much as possible, so anything that ssounds different i like to learn!
How do i use html in a php file
|
|