473,802 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php within dhtml, is that possible?

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
May 10 '06 #1
17 1688
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*******@attgl obal.net
=============== ===
May 10 '06 #2
Rik
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
XHTMLhttpreques t() 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
May 10 '06 #3
hi Jerry,
Wed, 10 May 2006 17:58:54 -0400
comp.lang.php -- Jerry Stuckle <js*******@attg lobal.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
May 11 '06 #4
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('fspec s') ?> 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
XHTMLhttpreque st() 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
May 11 '06 #5
Rik
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
May 11 '06 #6
Jacques Jamain wrote:
hi Jerry,
Wed, 10 May 2006 17:58:54 -0400
comp.lang.php -- Jerry Stuckle <js*******@attg lobal.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*******@attgl obal.net
=============== ===
May 11 '06 #7
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('fspe cs') ?> 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
XHTMLhttprequ est() 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.ph p') 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*******@attgl obal.net
=============== ===
May 11 '06 #8
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("you r/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=\"fspec s\" -->
instead

am I doing something wrong?
thanks
--
jj - Jeudi 11 Mai 2006 --- 14:47:39
May 11 '06 #9
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

May 12 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2002
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 portable webpages using DHTML ofcourse.
2
1437
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 parameter. But within the popup window itself, would it be possible to then change the resizable property to enable the window to be resized? Many thanks for your expertise!
2
1742
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 option onMouseover doesn't seem to work. Thanks for any help!!
2
2000
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 explain from the basics of javascript, to more complex things such as dhtml and dom onto things like creating javascript objects (if that is possible, but u get the idea). rather than this is how you make a drop down menu tutorial; this is how you
9
1784
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 so I assume that it can be used to change the class too.
9
5323
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 dhtml modal window but in the background of my main page... what do i have to correct so it opens up in front as it does in internet explorer? i'm using c# and ajax... it's an asp.net app... in masterpage i have this: <link rel="stylesheet"...
7
2385
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 to get reference to Parent? myChildFunc : function(){
0
9699
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10536
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10304
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.