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 19, 2005 21:05:43 GMT -8
This would be php writing HTML (if I didn't just screw up the simplest script ever).
<?php
echo("<h1>Hi.</h1><p> Teeeeeeeessssssssstttttttttt<br />ing :P</p>");
?>
Or you could just make a regualr HTML file and give it the .php extension and it'd work to.
|
|
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 22:30:31 GMT -8
i was more thinking about using HTML in the index file, because as i'm still learning stuff for PHP, i am using layouts and junk in HTML... Also, where do i put the code you posted before....? Do i have to put it in the index.php file only, or all the files? I am putting a link in all the pages, so where should i put that code?
|
|
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 21, 2005 23:46:14 GMT -8
bump..... Where do i put CCWorld's code? ??
|
|
inherit
Proboards Legend
212
0
May 11, 2006 12:32:55 GMT -8
california
21,035
December 1999
california
|
Post by california on Jul 22, 2005 2:30:31 GMT -8
If you don't already know how to use echo() to write HTML then why are you even trying to do something this complex? You need to start at the beginning, read some PHP tutorials.
|
|
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 23, 2005 13:28:45 GMT -8
i knew echo()..... i just forgot about it... sorry i post late at night and i didn't think.
I have read PHP tut's it's just i haven't found one that covers this.....
i just nneed to know where i put CCWorld's code
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jul 23, 2005 13:47:18 GMT -8
Just place it where you want it. Simple as that really
|
|
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 23, 2005 14:26:44 GMT -8
Welll this is what i have.
index.php
<?php// declare and set varibles$page = $_GET['page'];$inc;// check for no value of page and set to homeif($page === null){ $page = "home";}// use switch statment for page varible and// for each posssible page add a case sectionswitch ($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 pagerequire($inc);?>
<a href="index.php?page=page1">blasjdbksajd</a>
and it shows
Notice: Use of undefined constant php - assumed 'php' in ********\www\index.php on line 1 blasjdbksajd
I have put **** instead of typing out the directory. Yes i am running it on my computer as i don't feel like spending for ever on the web.
Anyway, i click on the link and gues what at the adress http://****/index.php?page=page1 (i have taken away the adress)
i get the exact same thing as the 1st one... in fact i don't think it even changed pages... and the code for the 2nd is
<?php// declare and set varibles$page = $_GET['page'];$inc;// check for no value of page and set to homeif($page === null){ $page = "home";}// use switch statment for page varible and// for each posssible page add a case sectionswitch ($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 pagerequire($inc);?> <a href="index.php">blasjdbsdafdsafasdfaaasdfsadfksajd</a> adsfdsafas
The first one is in the main root and the 2nd one is in a folder called pages and the file is in there it's called page1.php
|
|
squalleh
inherit
-148635
0
Dec 2, 2024 12:49:22 GMT -8
squalleh
0
January 1970
GUEST
|
Post by squalleh on Jul 23, 2005 17:09:30 GMT -8
Welll this is what i have. index.php <?php// declare and set varibles$page = $_GET['page'];$inc;// check for no value of page and set to homeif($page === null){ $page = "home";}// use switch statment for page varible and// for each posssible page add a case sectionswitch ($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 pagerequire($inc);?> <a href="index.php?page=page1">blasjdbksajd</a> and it shows Notice: Use of undefined constant php - assumed 'php' in ********\www\index.php on line 1 blasjdbksajd I have put **** instead of typing out the directory. Yes i am running it on my computer as i don't feel like spending for ever on the web. Anyway, i click on the link and gues what at the adress http://****/index.php?page=page1 (i have taken away the adress) i get the exact same thing as the 1st one... in fact i don't think it even changed pages... and the code for the 2nd is <?php// declare and set varibles$page = $_GET['page'];$inc;// check for no value of page and set to homeif($page === null){ $page = "home";}// use switch statment for page varible and// for each posssible page add a case sectionswitch ($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 pagerequire($inc);?> <a href="index.php">blasjdbsdafdsafasdfaaasdfsadfksajd</a> adsfdsafas The first one is in the main root and the 2nd one is in a folder called pages and the file is in there it's called page1.php So your server side scripts honestly look like that? Uhm...eh...
|
|
inherit
13333
0
Mar 19, 2012 20:30:58 GMT -8
hey
4,271
September 2003
hey
|
Post by hey on Jul 23, 2005 17:14:24 GMT -8
Umm, let's just say php scripts really mess up when they're all on one line. Copy and paste it exactly like CCWorld had it before.
|
|
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 23, 2005 17:56:32 GMT -8
Ok.... i have just fixed that.... i didn't know because i usually don't copy other people.... I write stuff myself!
**tests**
Notice: Undefined index: page in c:\*****\www\index.php on line 3
Notice: Undefined variable: inc in c:\*****\www\index.php on line 4
Warning: main(pages/home.php): failed to open stream: No such file or directory in c:\******\www\index.php on line 30
Fatal error: main(): Failed opening required 'pages/home.php' (include_path='.;C:/*******\php\pear\') in c:\********\www\index.php on line 30
Nom it's not working...
The code was exactly CCWorld had it was a PHP file and it had a link to page1.php
Any ideas?
|
|
inherit
Proboards Legend
212
0
May 11, 2006 12:32:55 GMT -8
california
21,035
December 1999
california
|
Post by california on Jul 23, 2005 23:54:21 GMT -8
Meh, that was CCWorld's fault for using to post codes
|
|
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 24, 2005 3:35:10 GMT -8
so i should fix it by ___________________
**looks blancly at CCWorld and California**
Please some help!
|
|
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 24, 2005 16:55:11 GMT -8
Well, it looks like when you copy it, it comes out on one line. For me it comes out just as I posted it. If it refuses to come out properly spaced for you, you'll have it add the spaces and line breaks in yourself.
Also it looks like you're trying to include a file that doesn't exist.
|
|
inherit
EXOH
27575
0
Nov 12, 2007 22:40:30 GMT -8
J. Meeter
i do my crosswords in pen
8,249
July 2004
modernxxromance
|
Post by J. Meeter on Jul 24, 2005 17:20:08 GMT -8
|
|
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 25, 2005 0:32:04 GMT -8
Thanks illeatyourhartout ...
Anyway.. i'm going to try the following. Thanks anyway. P.S. Yes i did put it in exactly as you typed it, including every tab... every space everything!
<?php switch( $_GET['page'] ) {
case 'news' :
include 'news.php';
break;
case 'portfolio' :
include 'portfolio.php';
break;
case 'bush' :
include 'go_to_war_with_iraq_for_no_reason.php';
break;
case 'me' :
print 'war sucks... GO ANTI WAR ME';
default:
include 'news.php';
break;
} ?>
i got that code off the site in the post above me!
EDIT: i have justed tested it and...... ---drum roll--- *hears base drum*
guess what.... have a look at this...
Underfined Index page **IT HAS THE ROOT HERE** Line 2
And it repeats itself a billion times (slightly exgerated)
It then fowarded on to an error 'page can't be found' oh and by the way, the 2nd line in both the news and the other file where
switch( $_GET['page'] ) {
|
|