hello,
in a dhtml page generated from php I want to include a file which is
in fact the body of the dhtml page. My hosting ISP does not allow SSI
but supports php includes. In the dhtml page, the generated statment
<?php include('fspecs') ?>
is ignored. I've the feeling that I'm overlooking something in the
way php is parsing dhtml (if it does). The dhtml code saved in a file
execute correctly after that...
Any hints about this?
Thanks in advance.
--
jj - Mercredi 10 Mai 2006 --- 23:14:59 17 1645
Jacques Jamain wrote: hello, in a dhtml page generated from php I want to include a file which is in fact the body of the dhtml page. My hosting ISP does not allow SSI but supports php includes. In the dhtml page, the generated statment <?php include('fspecs') ?> is ignored. I've the feeling that I'm overlooking something in the way php is parsing dhtml (if it does). The dhtml code saved in a file execute correctly after that... Any hints about this? Thanks in advance.
Jacques,
What do you mean "ignored"?
Have you looked at the source for the page when it gets to your browser?
Perhaps it's there and you don't see it.
Otherwise, you must be getting an error which isn't being displayed. Turn on
all errors and display them to see if there are any.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Jacques Jamain wrote: In the dhtml page, the generated statment <?php include('fspecs') ?> is ignored. I've the feeling that I'm overlooking something in the way php is parsing dhtml (if it does).
What do you mean, generated statement? Is 'fspecs' a file, and do you
already include it while sending the page to the browser? How do you
generate it?
The server side php can perform actions on the server, and output data to
browsers. With a few exceptions, it doesn't really care about what data,
that's your job as programmer. Sending HTML or JS is equal to sending pdf or
txt, it's just data... No checking for validity, no parsing.
PHP can't be executed on the clients machine, so if you generate <?php
include('fspecs') ?> with javascript, it's just nonsense to your browser.
So, building client side PHP code has no use, except when sending it back to
the server and eval() it, which is a huge security risk.
If it's generated on the server: echoing <?php //something ?> will not
execute it, look at eval().
If it's generated on the clients machine: look at javascipts
XHTMLhttprequest() instead.
If it's genuine PHP code on the server: what is the surrounding code, and
where does the file 'fspecs' reside?
Grtz,
--
Rik Wasmus
hi Jerry,
Wed, 10 May 2006 17:58:54 -0400
comp.lang.php -- Jerry Stuckle <js*******@attglobal.net> écrivait (wrote): Jacques Jamain wrote: hello, in a dhtml page generated from php I want to include a file which is in fact the body of the dhtml page. My hosting ISP does not allow SSI but supports php includes. In the dhtml page, the generated statment <?php include('fspecs') ?> is ignored. I've the feeling that I'm overlooking something in the way php is parsing dhtml (if it does). The dhtml code saved in a file execute correctly after that... Any hints about this? Thanks in advance.
Jacques,
What do you mean "ignored"?
... intended code in 'fspecs' not included ...
Have you looked at the source for the page when it gets to your browser? Perhaps it's there and you don't see it.
yes, the <?php include('fspecs') ?> statment is there, well generated
by php at server side but not processed and now it becomes obvious
to me that it cannot be processed at client side, too late...
My problem seems to be (or could be): "how to force php to work recursively"
Anyway thanks to take care...
had a good day
--
jj - Jeudi 11 Mai 2006 --- 11:16:40
hi Rik,
Thu, 11 May 2006 01:49:25 +0200
comp.lang.php -- "Rik" <lu************@hotmail.com> écrivait (wrote): Jacques Jamain wrote: In the dhtml page, the generated statment <?php include('fspecs') ?> is ignored. I've the feeling that I'm overlooking something in the way php is parsing dhtml (if it does). What do you mean, generated statement? Is 'fspecs' a file, and do you already include it while sending the page to the browser? How do you generate it?
The server side php can perform actions on the server, and output data to browsers. With a few exceptions, it doesn't really care about what data, that's your job as programmer. Sending HTML or JS is equal to sending pdf or txt, it's just data... No checking for validity, no parsing.
ok, I have to explain a bit more what I intend to obtain.
At server side I generate an html file to include some data obtained
from mysql, to be passed to JS. This is done by echoing the html head
and the JS directives and the data with php. It's ok, and now I have
to add the html body and I was thinking that instead of echoing all
the html directives it would be nice to include a file holding all
those directives. That's SSI, but helas my hosting isp does not support,
hence the tentative with php.
The actual question: "is recursion possible with php and if yes how?"
Hope this clarify a few my situation.
Thanks for your help and suggestions.
PHP can't be executed on the clients machine, so if you generate <?php include('fspecs') ?> with javascript, it's just nonsense to your browser. So, building client side PHP code has no use, except when sending it back to the server and eval() it, which is a huge security risk.
ok, I agree
If it's generated on the server: echoing <?php //something ?> will not execute it, look at eval().
It's the case, I've to look at this...
If it's generated on the clients machine: look at javascipts XHTMLhttprequest() instead.
If it's genuine PHP code on the server: what is the surrounding code, and where does the file 'fspecs' reside?
this file is on the server
thanks again
Cheers
--
jj - Jeudi 11 Mai 2006 --- 11:28:57
Jacques Jamain wrote: ok, I have to explain a bit more what I intend to obtain. At server side I generate an html file to include some data obtained from mysql, to be passed to JS. This is done by echoing the html head and the JS directives and the data with php. It's ok, and now I have to add the html body and I was thinking that instead of echoing all the html directives it would be nice to include a file holding all those directives. That's SSI, but helas my hosting isp does not support, hence the tentative with php. The actual question: "is recursion possible with php and if yes how?"
I still don't really get what you are trying to do:
You have some data retrieved from the database, and after that you want a
HTML body...
Why not just end parsing with php (?>), and write the HTML? Echoing is nog
necessary. I think I'm missing something here.
The HTML body, is it dynamic, and if so, how do you control that: php or
client side js?
Am I to understand that a simple:
include("your/desired/file.html");
does not work?
Grtz,
--
Rik Wasmus
Jacques Jamain wrote: hi Jerry, Wed, 10 May 2006 17:58:54 -0400 comp.lang.php -- Jerry Stuckle <js*******@attglobal.net> écrivait (wrote):
Jacques Jamain wrote:
hello, in a dhtml page generated from php I want to include a file which is in fact the body of the dhtml page. My hosting ISP does not allow SSI but supports php includes. In the dhtml page, the generated statment <?php include('fspecs') ?> is ignored. I've the feeling that I'm overlooking something in the way php is parsing dhtml (if it does). The dhtml code saved in a file execute correctly after that... Any hints about this? Thanks in advance.
Jacques,
What do you mean "ignored"?
... intended code in 'fspecs' not included ...
Have you looked at the source for the page when it gets to your browser? Perhaps it's there and you don't see it.
yes, the <?php include('fspecs') ?> statment is there, well generated by php at server side but not processed and now it becomes obvious to me that it cannot be processed at client side, too late... My problem seems to be (or could be): "how to force php to work recursively" Anyway thanks to take care... had a good day
No, PHP is never processed client-side. So if you're trying to add it inline,
i.e. with echo, it won't work.
Several ways you can do this. You can use a template processor. You can use
eval to execute the code (my personal least favorite). You can write it to a
temporary file then include the file. And probably several other ways.
But why generate the statement in the first place? Why not just execute the
statement instead?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Jacques Jamain wrote: hi Rik,
Thu, 11 May 2006 01:49:25 +0200 comp.lang.php -- "Rik" <lu************@hotmail.com> écrivait (wrote):
Jacques Jamain wrote:
In the dhtml page, the generated statment <?php include('fspecs') ?> is ignored. I've the feeling that I'm overlooking something in the way php is parsing dhtml (if it does).
What do you mean, generated statement? Is 'fspecs' a file, and do you already include it while sending the page to the browser? How do you generate it?
The server side php can perform actions on the server, and output data to browsers. With a few exceptions, it doesn't really care about what data, that's your job as programmer. Sending HTML or JS is equal to sending pdf or txt, it's just data... No checking for validity, no parsing.
ok, I have to explain a bit more what I intend to obtain. At server side I generate an html file to include some data obtained from mysql, to be passed to JS. This is done by echoing the html head and the JS directives and the data with php. It's ok, and now I have to add the html body and I was thinking that instead of echoing all the html directives it would be nice to include a file holding all those directives. That's SSI, but helas my hosting isp does not support, hence the tentative with php. The actual question: "is recursion possible with php and if yes how?"
Hope this clarify a few my situation. Thanks for your help and suggestions.
PHP can't be executed on the clients machine, so if you generate <?php include('fspecs') ?> with javascript, it's just nonsense to your browser. So, building client side PHP code has no use, except when sending it back to the server and eval() it, which is a huge security risk.
ok, I agree
If it's generated on the server: echoing <?php //something ?> will not execute it, look at eval().
It's the case, I've to look at this...
If it's generated on the clients machine: look at javascipts XHTMLhttprequest() instead.
If it's genuine PHP code on the server: what is the surrounding code, and where does the file 'fspecs' reside?
this file is on the server thanks again Cheers
Jacques,
PHP should parse the contents of any file with a .php extension - even if it's
referenced by include(). So if you include('xyz.php') and in that file have
include('fspecs'), it should be processed just fine.
And btw - this isn't recursion.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
Rik,
Thu, 11 May 2006 12:29:21 +0200
comp.lang.php -- "Rik" <lu************@hotmail.com> écrivait (wrote): Jacques Jamain wrote: ok, I have to explain a bit more what I intend to obtain. At server side I generate an html file to include some data obtained from mysql, to be passed to JS. This is done by echoing the html head and the JS directives and the data with php. It's ok, and now I have to add the html body and I was thinking that instead of echoing all the html directives it would be nice to include a file holding all those directives. That's SSI, but helas my hosting isp does not support, hence the tentative with php. The actual question: "is recursion possible with php and if yes how?"
I still don't really get what you are trying to do: You have some data retrieved from the database, and after that you want a HTML body... Why not just end parsing with php (?>), and write the HTML? Echoing is nog necessary. I think I'm missing something here.
The HTML body, is it dynamic, and if so, how do you control that: php or client side js?
Am I to understand that a simple: include("your/desired/file.html"); does not work?
well, think to a quiz. At the server the Q&A are in mysql. The client
invokes that quiz as www.mysite.com. At mysite there is an index.php
which read the db, and build a dhtml set with all the things, JS data,
JS source and html body allowing to call the JS functions presenting
the quiz to the client and handling its answers. The data, the JS and
the html body are on the server. There is no problem echoing the data
and the html head directives including the JS source. My problem is to
include the html body file using php code in the index.php.
The interesting effect is that, if I save the dhtml echoed with the
<?php include('fspecs') ?> inside at client side and then I transfer
that file as is to the server I get exactly what I want.
If SSI was enabled the method would be to echo:
<!-- #include virtual=\"fspecs\" -->
instead
am I doing something wrong?
thanks
--
jj - Jeudi 11 Mai 2006 --- 14:47:39
Jacques Jamain wrote: ... intended code in 'fspecs' not included ...
What if you replace this:
<?php include('fspecs') ?>
with this:
<?php phpinfo(); ?>
??
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
What file extension does your primary page have? If your web server
isn't setup to parse .html files for php code, the code will pass
through to the client browser without any interpretation. So if on the
client-side you are seeing "<?php include('fspecs') ?>" when you view
the page source, then I suspect you need to modify your web server's
config to parse html files for php code.
hi,
14 May 2006 15:20:21 -0700
comp.lang.php
-- "wi************@gmail.com" <wi************@gmail.com> écrivait (wrote): What file extension does your primary page have? If your web server isn't setup to parse .html files for php code, the code will pass through to the client browser without any interpretation. So if on the client-side you are seeing "<?php include('fspecs') ?>" when you view the page source, then I suspect you need to modify your web server's config to parse html files for php code.
I can't do anything to the config of my isp server but on my test
machine, which is an apache server (all in one, client and server on
the same machine), the server is well configured to parse php
code (addtype, addoutputfilter, includes...). The problem is that if the
dhtml echoed by php contains php directives (<?php include('fspecs') ?>)
these directives are not parsed again by php... Anyway I think it's
not possible and I changed my design (if any d;-) and have set the db
ouput for JS in a file from a separate run and all the includes are made
from a static html file.
Thanks for your help.
--
jj - Lundi 15 Mai 2006 --- 22:48:17
Hm..
<?php include('fspecs') ?>
And the extension?
hi,
15 May 2006 22:33:31 -0700
comp.lang.php -- "RainCT" <ra******@eurion.net> écrivait (wrote): Hm..
<?php include('fspecs') ?>
And the extension?
any extension, .php .htm .shtml ...
to clarify you can cut and paste to your server the following
and thanks to the kindness of your browser about html standards
you would see what I mean...
__________________________________________________ _____________________
<?php echo ' <html><head> <title>Hello</title></head>' . "\n";
$fdhtml= 'fn.php';
$finc = 'inc.php';
if (!$handle=fopen($fdhtml,'w+')){echo "Can't open file ($dhtml)";exit;}
if (!$handle_i=fopen($finc,'w+')){echo "Can't open file ($finc)";exit;}
$htmStuff =
'<body><h1>Hello</h1></body></html>'. "\n";
$incStuff =
'<?php include(\'fn.php\') ?><body><h1>Hello</h1></body></html>'. "\n";
if (fwrite($handle, $htmStuff) === FALSE)
{ echo "Cannot write to file ($fdhtml)"; exit;}
if (fwrite($handle_i, $incStuff) === FALSE)
{ echo "Cannot write to file ($finc)"; exit;}
fclose($handle); fclose($handle_i);
$inc = "<?php include('fn.php') ?><br>...include not included<br>";
echo $inc;
echo '<br><a href=fn.php>fn</a>';
echo '<br><a href=inc.php>inc</a><br>';
?>
__________________________________________________ _____________________
This write 2 files: fn.php and inc.php, echo an approximative dhtml and
intend to include on the fly fn.php, well echoed but not processed as
indicated in the title and in the rendered html.
In the dhtml, links to fn.php and inc.php are provided.
The link to inc.php shows that the php include is working on that server
when statically invoked...
If you are too far of your server you can try this link:
<http://jjamain.free.fr/samp.php>
HTH.
--
jj - Mardi 16 Mai 2006 --- 15:01:31
Jacques Jamain wrote: $inc = "<?php include('fn.php') ?><br>...include not included<br>"; echo $inc;
Of course it isn't included. You're sending the <?php...?> to the client.
The client can't do anything with it.
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
hello Toby,
Tue, 16 May 2006 15:33:09 +0100
comp.lang.php
-- Toby Inkster <us**********@tobyinkster.co.uk> écrivait (wrote): Jacques Jamain wrote:
$inc = "<?php include('fn.php') ?><br>...include not included<br>"; echo $inc;
Of course it isn't included. You're sending the <?php...?> to the client. The client can't do anything with it.
yes, I know that, but my point is (was after a bypass) "is it possible
to have a php directive like <?php include('fn.php') ?> processed on
the server within a php execution?". Now, my answer is "no, php does
not allow self recursion", but I don't want to be alone to think that
and I don't have obtained a clear answer to that question here until
now.
Thanks to take care.
--
jj - Mardi 16 Mai 2006 --- 22:31:27
Jacques Jamain wrote: yes, I know that, but my point is (was after a bypass) "is it possible to have a php directive like <?php include('fn.php') ?> processed on the server within a php execution?".
Yes it is:
Call this file "foo.php", save it to your server and visit it:
<?php
global $foocount;
$foocount++;
print "This file has been included recursively $foocount times<br>\n";
if ($foocount < 100)
include("foo.php");
?>
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
hi,
Toby Inkster wrote: Jacques Jamain wrote:
yes, I know that, but my point is (was after a bypass) "is it possible to have a php directive like <?php include('fn.php') ?> processed on the server within a php execution?".
Yes it is:
Call this file "foo.php", save it to your server and visit it:
<?php global $foocount; $foocount++; print "This file has been included recursively $foocount times<br>\n"; if ($foocount < 100) include("foo.php"); ?>
great and so simple... often you search for complicated methods when
it's obviously under your eyes.
Many thanks for this kind solution. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: viator |
last post by:
Hello everybody. I am a student doing my masters in Comp. Sci. Will
some explain to me why it seems completely two worlds when taking
about DHTML in NN and IE. Is there any way to write truly...
|
by: Mark Findlay |
last post by:
Is it possible to change a popup window's 'resizable attribute from within
the popup window itself?
I create the popup window with the window.open(....) function and use a
resizable=no...
|
by: Ilpo |
last post by:
Hi!
Is it possible to open DHTML menu from a select box option?
I need a select box which shows a new sub-menu when pointing the mouse
over an option. Does anyone know is this possible? The...
|
by: mr_burns |
last post by:
hi there,
i would like a book that will explain concepts of javascript and dhtml
instead of, for example, ten tutorials on how to do specific things in
js or dhtml.
ideally a book thats can...
|
by: bissatch |
last post by:
Hi,
Is it possible to change the class style of an HTML element using
DHTML? For example...
<td class="my_class">Text</td>
I have used DHTML to change style elements such as backgroundColor...
|
by: ninhovid |
last post by:
Hi...
i'm new at dhtml, and i want to use it in help windows (instead of window.open() of javascript)...
i'm done it... but it works only in internet explorer.. in firefox 2 and 3 it opens the...
|
by: vunet |
last post by:
I am still not clear about how to reference an object within another
object to pass first object to a function:
var Parent = {
myFunc : function(){
alert("Parent = "+this)
},
Child : {
//how...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| | |