469,358 Members | 1,599 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

HTML call

Pat
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
Jul 24 '06 #1
5 15496

Pat wrote:
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
You can include an html page into you php file, just by doing
include("file.ext"); you can't call php into html, im not sure exactly
what you mean by use the values in the html.. you can set a variable in
php, include an html page and within that html page have <input
type='name' value=' <?php echo $something; ?>'>

Flamer.

Jul 24 '06 #2
Pat wrote:
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
Easy way:
Write all your php code and require the html file
# test.php
<?php
$test = "Hi there";
require_once( 'test.html' );
exit(); // stop execution of script
?>

#test.html
<html>
<body>
<?php echo $test ?>
</body>
</html>

Little more complicated, but worth it if you want to get into
professional PHP development.
Smarty - PHP templating engine
http://smarty.php.net

1. Allows for logic in the template - Seperation of template logic and
business logic
2. Template caching
3. Many more benefits, check out the documentation

Jul 24 '06 #3
Pat wrote:
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
From HTML you can include a PHP file with SSI - Server Side Includes, i..e

<!-- include file="myfile.php" -->

See SSI documentation for your server for more information and/or follow
up in alt.html.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 25 '06 #4
reb


Le 24/07/2006 23:43, Pat a écrit :
I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.
You can call a php script from your HTML with an inline frame ; you'll
get the generated content of the php file :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test</title>
</head>
<body>
<p>Lorem ipsum...
<iframe src="test.php"></iframe>
</body>
</html>
Jul 26 '06 #5
Pat
Pat wrote:
Hello,

I have a question in regards to the use of php and html. The question
is: can someone write a script separate from the html page and then call
the script in like in a css style and use the values in the html page?
If so how?

I am just learning php and am not ignorant to programming, but I would
use a function or created class in the separate file but how would you
call the php file into the html file is what's killing me.

I hope that makes sense and I hope someone can at least point me in the
right direction to find the answer; because, to me putting all the code
in an html document is redundant especially on the oop side.

Thank you,
Patrick
Thank you everyone this helps me a lot.

Thank you again,
Patrick
Jul 26 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

21 posts views Thread by deko | last post: by
4 posts views Thread by Fergus O'Shea | last post: by
4 posts views Thread by CLEAR-RCIC | last post: by
3 posts views Thread by Epetruk | last post: by
5 posts views Thread by Andy G | last post: by
reply views Thread by bp_jobemail | last post: by
3 posts views Thread by Chuck Renner | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.