RE: [PHP] Re: including a php file in an html doc

2002-08-12 Thread Paul Colcutt

you could make a Flash movie that just contains a text field and fills
it with the output of your php page by using Flash's loadvariables() function

>[snip]
>So is there any way to accomplish what I want to using php without
>naming the files *.php??
>[/snip]


-- 
===
Paul Colcutt
http://www.paulcolcutt.co.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: including a php file in an html doc

2002-08-12 Thread Brian V Bonini

Yes, you need to tell your web server to parse html files for PHP
directives. How you accomplish this will depend on your webserver and
version.

I think something along the lines of AddType application/x-httpd-php .php
.html should work in an .htaccess file if your using Apache.

> -Original Message-
> From: Alexander Ross [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 12, 2002 10:13 AM
> To: 'Brian V Bonini'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Re: including a php file in an html doc
>
>
> So is there any way to accomplish what I want to using php without
> naming the files *.php??
>
> -Original Message-
> From: Brian V Bonini [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 12, 2002 10:11 AM
> To: Alexander Ross; [EMAIL PROTECTED]
> Subject: RE: [PHP] Re: including a php file in an html doc
>
> Because your trying to put PHP directives in an html file. Your web
> server
> does not know to parse html files as php files unless you tell it to do
> so.
>
>
>
> > -Original Message-
> > From: Alexander Ross [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, August 12, 2002 9:50 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Re: including a php file in an html doc
> >
> >
> > I still seem to be missing something.  I guess the easiest thing for
> me to
> > do is just show you my code.  All I want is to be able to reference
> the
> > $hotspots array from any .html page oon my site.  I thought I
> > could include
> > hotspot.php and then reference the array using  syntax.
> > What should I
> > do?  The one requirement is that I cannot make all my pages PHP. They
> must
> > be html.
> >
> > HTML PAGE (test.html):
> > 
> > 
> > Untitled Document
> > 
> > 
> > 
> >
> > 
> > 
> > 
> > 
> >
> > PHP PAGE (hotspot.php):
> >  > include_once("../board/db_fns.php");
> >
> > echo "hotspot = ".$hotspots;
> >
> > if (!isset $hotspots){
> >   $connect = connect_to_db();
> >   $query = "SELECT * FROM hotspots";
> >   $result = mysql_query($query);
> >   $count = mysql_numrows($result);
> >
> >   $hotspots = array();
> >   for($i=0;$i<$count;$i++)
> >   {
> > $hotspot = mysql_fetch_assoc($result);
> >  $hotspots[$hotspot['hotspot']]=$hotspot['val'];
> >   }
> >   print_r($hotspots);
> > }
> > ?>
> >
> >
> > "Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hi Alexander!
> > >
> > > You're missing the distinction between a server-side script (PHP)
> and a
> > > client-side script (JavaScript, VB etc). When you use the syntax you
> > > used, the browser attempts to download the src and execute it - and
> it
> > > can't do that, because in the best case the php code runs on the
> server
> > > and returns "test" (your echo()) and then it "tries" to run that as
> php
> > > code, which again it doesn't know how. It does work for JavaScript
> > > however, because it downloads the JavaScript file (which is plain
> text)
> > > and then executes the code (because it knows how to execute
> JavaScript).
> > >
> > > What you should do would be write
> > > 
> > > instead of " > >
> > > Bogdan
> > >
> > > Alexander Ross wrote:
> > > > I have a .php file whose purpose, ultimately, is to set one
> variable;
> > > > $hotspot.  Now I want to include that var in a bunch of places in
> my
> > html
> > > > page (it must remain html).  So this was my thought.  In the
> <head>
> > include
> > > > the following:
> > > >
> > > > <script language="php" src="hotspot.php">
> > > >
> > > > and then anywhere in the html doc I want to print the value
> > of $hotspot
> > I
> > > > type:
> > > >
> > > > 
> > > >
> > > > but it doesn't work.  I have a feeling I cant include a php
> > script that
> > way
> > > > because in trying to debug the problem I made the first line of
> > hotspot.php
> > > > = echo "test"; and the word test never shows.  What am I missing?
> > > >
> > > > Thnks
> > > > Alex
> > > >
> > > >
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: including a php file in an html doc

2002-08-12 Thread vic

You must have a space between  you
can also write  which might be easier to follow. And
you have to include ALL your php code between these tags (you may use as
many pairs as you wish in your page). And don't forget to name you file
.php not .htm or .html

- Vic


-Original Message-
From: Alexander Ross [mailto:[EMAIL PROTECTED]] 
Sent: Monday, August 12, 2002 9:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: including a php file in an html doc

I still seem to be missing something.  I guess the easiest thing for me
to
do is just show you my code.  All I want is to be able to reference the
$hotspots array from any .html page oon my site.  I thought I could
include
hotspot.php and then reference the array using  syntax.  What
should I
do?  The one requirement is that I cannot make all my pages PHP. They
must
be html.

HTML PAGE (test.html):


Untitled Document









PHP PAGE (hotspot.php):



"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Alexander!
>
> You're missing the distinction between a server-side script (PHP) and
a
> client-side script (JavaScript, VB etc). When you use the syntax you
> used, the browser attempts to download the src and execute it - and it
> can't do that, because in the best case the php code runs on the
server
> and returns "test" (your echo()) and then it "tries" to run that as
php
> code, which again it doesn't know how. It does work for JavaScript
> however, because it downloads the JavaScript file (which is plain
text)
> and then executes the code (because it knows how to execute
JavaScript).
>
> What you should do would be write
> 
> instead of "
> Bogdan
>
> Alexander Ross wrote:
> > I have a .php file whose purpose, ultimately, is to set one
variable;
> > $hotspot.  Now I want to include that var in a bunch of places in my
html
> > page (it must remain html).  So this was my thought.  In the 
include
> > the following:
> >
> >