Hi,
I'm a newbie to PHP and from what I saw it seems impossible to use PHP code in a .html file unless you configure the server to parse html files as php.
However, if there is a function in a php file, let's call it function.php, and I want to acces it from, say, example.html, is it possible to include in the latter <script language="php" src="function.php></script> at the point where I want to implement it?
Why wouldn't that work?
Thanks.
PHP in HTML
Moderator: General Moderators
- redhair
- Forum Contributor
- Posts: 300
- Joined: Fri May 30, 2003 4:36 pm
- Location: 53.23N-6.57E
- Contact:
Re: PHP in HTML
<script language="php" src="function.php></script> would suggest that php is a client side scripting languige..however..it is server sided.marvinz wrote:Why wouldn't that work?
Browsers dont have php plugins
True .. . Browser reads that kind of stuff on Client System. . while PHP runs on Server Side and outputs HTML which is shown in browser...
Please try to understand process flow, and you will get answer for your question.
in case of HTML, javascript :
in case of PHP :
if you see what happenes here, you will come to know
Please try to understand process flow, and you will get answer for your question.
in case of HTML, javascript :
Code: Select all
client request -> server -> HTML page -> browser -> render HTML / javascript & showin case of PHP :
Code: Select all
client request -> server -> PHP script -> output -> browser -> render HTML & show" Why wouldn't that work? "