PHP and the DOM

12 views
Skip to first unread message

Will

unread,
Feb 4, 2008, 10:27:35 AM2/4/08
to Connecticut PHP Developers Group - CPDG
I've been having an issue with a few of my scripts. I'm echoing
elements to the page that I wish to use with some of javascript's DOM
functions such as getElementById, etc. These work fine if I echo the
elements from the main script, or if I echo them from an include
file. The problem I'm running into is that when I echo from an
include to an include, the echoed elements are not being included in
the DOM for some reason:

< main.php >
echo "<input id='maininput' />\n"; // Javascript sees this object.
include ('incone.php');

< incone.php >
echo "<input id='secondinput' />\n"; // Javascript sees this object
too.
include ('inctwo.php');

<inctwo.php >
echo "<input id='thirdinput' />\n"; // Javascript does not see this
object.

I thought it could be an issue with the output buffer, but ob_start()
and ob_end_flush() didn't do anything. The only solution I have at
this point is moving the echo statement from the inner include to the
outer include (from inctwo.php to incone.php in the example above).
I'm looking for a solution that doesn't include moving the statement
from one file to the other. Anyone have any ideas?

Enrique Rojas

unread,
Feb 4, 2008, 10:39:51 AM2/4/08
to ct...@googlegroups.com
The best thing to do is a class. With a blank function you can fill
anything that you need and re-use it with 1 single code.

--
Enrique Rojas
(PHP Developer/SEO Specialist) roja...@gmail.com

CONFIDENTIALITY NOTICE
=======================
This email message and any attachments are for the exclusive use of
the intended recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution
is prohibited. This communication is intended to be and to remain
confidential.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message along with
any attachments, from your computer system. If you are the intended
recipient, please be advised that the content of this message is
subject to access, review and disclosure by the sender's Email System
Administrator.

Reply all
Reply to author
Forward
0 new messages