I would like to use this thread when I require assistance with PHP, not just one question, thus it's ongoing, so I am REALLY new to PHP and I am trying to do the simple "Hello World" thing so I got my website set up and within the
<html><body>
and
<html></body> I have
<?php
echo "Hello IsaT I see you";
?>
Yet it does not display on the webpage why is this?
None.
woops saved as index.php.txt lawl
None.
Okay this time I have actual questions!!
if I made templates in php e.g header.php, navigation.php, login.php and main.php
if I were then for the actual page to do this:
filename: index.php
<html>
<body>
<?php include("header.php"."navigation.php"."login.php"."main.php" ?>
</body>
</html>
Q1) Would it be "header.php"."navigation.php"."login.php"."main.php" or "header.php";"navigation.php";"login.php";"main.php" or neither?
Q2) If i were to call these as templates for the layout how would I make text stick within a certain 'panel' but not write the text into the actual file.php?
None.
I found that
<?php
include("header.php");
include("login.pho");
include("navigation.php");
include("main.php");
?>
works but is there a shorter concatenated form to that?
if(false)
{
System.out.println("Well then im fine doing tons of includes");
}
None.
There is no shorthand way of doing multiple includes that i know of.
I'd use require() instead because missing file = failure.
$required = array("header", "login", "navigation", "main", "footer", "lol");
foreach ($required as $k => $v)
require($v.'.php');
lol?
None.
Stupid site that I used was using javascript and I had an onSubmit function which without javascript couldn't work so I just deleted code.
Post has been edited 1 time(s), last time on Mar 10 2008, 8:38 pm by Shocko.
None.
lol onsubmit...
<?php
echo <<<EOF
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<form method="post" action="staff.php">
<select name="name">
<option value="home">Home</option>
<option value="forums">Forums</option>
<option value="staff">Staff</option>
<input type="submit" value="Go">
</select>
</form>
<br /><br />
EOF;
if ($_POST['name'] == "forums")
echo "in forums";
else if ($_POST['name'] == "home")
echo "in home";
else if ($_POST['name'] == "staff")
echo "in staff";
echo <<<EOF
<br /><br />
</body>
</html>
EOF;
?>
None.
Relatively ancient and inactive
Maybe you can do require("whatever", "whatever", "whatever");, but I'm too lazy to try it out. You shouldn't use requires/includes too much, if possible, since they do slow down the server reply time. Throwing some of the extra luggage on the browser if you need to link to a js functionlist or a stylesheet would be good, if you're planning on implementing those. <link> tag.
Say, IP, do you have a good tutorial on AJAX or something? I'm not that hot with Javascript, so I need something to take me through it
. I think it'll work magnificently if I start working on my site again if the content is reloaded via ajax, and it wouldn't hurt to do the same for a shoutbox either.
None.
Just google AJAX tutorial ;o
The basics are relatively simple and straight forward. There are a lot of AJAX kits you can download and use as well, with all the functions you could ever want already written out.
I have yet to perfect my AJAX so I'm not going to give advice on it ;o
None.
I wanted to see if your code works and I get those same chinese characters...
HALP
my code is generating tons of chinese symbols no matter what:
<html>
<body>
Hello
</body>
</html>
there's nothing wrong with that and it generates this:
fixed it, accidently saved as uni-code
nvm fixed it for IE for FFox it's still broken.
Post has been edited 3 time(s), last time on Mar 10 2008, 10:28 pm by Shocko.
None.
Relatively ancient and inactive
Err.. try using notepad to do it and renaming the file to .htm. Its pretty obviously some program problem. Maybe some other saving issue.
None.
already fixed it for him:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
None.
Yes IP helped but I did try re-saving and what not before I had to use that meta thing.
None.
I'm working on my own PHP project now too actually.
I'm what you would suggest as a good PHP compiler/error checker.
None.
I'm what you would suggest as a good PHP compiler/error checker.
You asking for one or saying you are one?
If the first, DTBK might have suggestions.
None.
Relatively ancient and inactive
Well, there are no PHP compilers, as far as I know. Error checker.. The best I've found are the default PHP error messages, but there might be better ones.
None.
Quote from isolatedpurity
I'm what you would suggest as a good PHP compiler/error checker.
You asking for one or saying you are one?
If the first, DTBK might have suggestions.
I didn't reread my post lol.
I'm asking for a php compiler for myself. As far as I can tell the only way for me to know if my code is free of format errors is because a blank page is loaded up instead of what i want.
I'm referring to simple formating errors like opening a parenthesis and not closing it or leaving a semicolon off the end of a statement.
None.
I passed HTML quiz on w3schools with 100% proud
?
xD!
I did XHTML now (zzz soo whiney)
and im on CSS then I think after CSS is javascript then encorporate it all with PHP and then with MYSQL and pwn sen with pew pew lasers
None.
A blank page? It should at least show the error in black text. Maybe your php environment has error reporting disabled/hidden?
None.
Quote from isolatedpurity
A blank page? It should at least show the error in black text. Maybe your php environment has error reporting disabled/hidden?
Yeah its blank, my classmates and I set up our own server. I guess i was looking for some way to test it before uploading...
PS. I should see if I pass that W3 schools quiz now cause I learned a lot in the past few weeks.
None.