Unstoppable Domains

Newbie PHP Question

Spaceship Spaceship
Watch

thetzfreak

Established Member
Impact
19
If I just create a .php text file, but don't put in the <? in the beginning, does anything I put in there count as regular html? So basically it's an html file before I put in the <? ? If so, then I can just get a regular html site and just insert some php code where needed?

Thanks :) - I'm learning :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Yes to the if there is no <? it is regular HTML.

If you put <? ?> in there and the filename ends with .php it auto parsels it as PHP.

iNod.
 
0
•••
iNod is correct. If you have no need to have it as a .php file however it is best not to as before it outputs to you it has to go through the php parser because it has php as an extension therefore takes up server resources (not noticeable on a small site but a large 1 will soon have excess activity).
 
0
•••
I'll give you a little example.

INDEX.PHP
----------

<html>
<head>
<title>Test</title>
</head>
<body>
<?php echo "Test"; ?>
</body>
</html>

That will work because the file is called index.php.
Now, if you didn't feel like putting any php in there, you can still name it index.php, it just has nothing to parse, so it acts the same as .html. (except in filth's situation).
 
0
•••
Wow, that's cool. Thanks a lot guys! Basically, I can just use a template I made and just insert the small php parts as needed :)

Thanks!
 
0
•••
yep, not a problem.
 
0
•••
<? before yes of course like this?

PHP:
<html>
<body bgcolor="black">
<?php
if (code/action)
}
else (what happens^^)
}
?>
</body>
</html>

I am to lazy to do a code lol :lol:
-coolprogram
 
Last edited:
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back