Forum Moderators: coopster
I've tried using the alternative charcters generated by dreamweaver but to no avail.
any other ideas?
I guess what I'm asking is how do you parse php and/or xml code as a radio button value?
It may help you, not sure. I guess you can't just pass a value to the script and then the script can display the proper DTD based on that?
Oaf357 is basically trying to do what I am just with a different dtd. However, he didn't seem to find a working solution.
Coming back to what you said though, do you mean I could associate a value to the radio button (say value="wap") that would call an external script that would display the dtd?
and if so, how?
I'd like to try and help but I can't really figure out from this thread or the one linked above what the problem is...!
When you call an external file with include(), the file is not interpretted by PHP unless it encounters the opening tag, such as <?php
I get the impression that you want to offer a way to select from a form which DTD the server should use for the response page. This should be straight forward:
On your form:
<select name='whichDTD'>
<option value='1'>DTD A</option>
<option value='2'>DTD B</option>
</select>
And then at the top of your handler script:
<?php
switch($whichDTD)
{
case '1':
include("dtdA.inc");
break;
case '2':
include("dtdB.inc");
break;
}
Where the files dtdA.inc and dtdB.inc are simple text files that contain nothing but the appropriate type declarations.
You could always just echo the DTD, there's no need to call an external file.
Have I missed the point?
Cheers
I've tried your suggestion using the 2 code fragments you offered and recieved the following error messages:
When trying to submit with the WAP dtd it says:
Parse error: parse error in ../dtdA.inc on line 1
and when submitting using the WAP/PHP dtd it says:
Warning: Cannot add header information - headers already sent by (output started at ../testdisplay.php:12) in ../dtdB.inc on line 1
I believe this is still due to the fact that the text within the include is based in either xml or xml/php. I've tried setting the body of the include to 'test' to confirm that the call code is working and that all seems fine.
The problem is still that I am calling php code that is meant for pure display. How do I stop my response page from trying to interpret this data as more instruction?
When I was adding the includes, I used the actual dtd as opposed to the alternative character versions. This meant that the include started with < as opposed to < (which was exactly what you told me not to do).
I've now changed the include txt and it all works fine.
Many thanks to both of you, I am now a full convert to the power of webmasterworld!
Hello,
Just had an idea for you to try. This way may work since you include the file while being out of PHP [php.net] parsing mode.
<?php
switch( [php.net]$whichDTD)
{
case '1':
?>
<!--#include virtual="dtdA.inc" -->
<?php
break;
case '2':
?>
<!--#include virtual="dtdB.inc" -->
<?php
break;
}
?>
Great! Glad that's sorted - and if it's working, don't touch it...
However, i'm still surprised that you have had to entity encode the characters in your include file.
From:
[php.net...]
I quote:
"When a file is included, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags."
So i've got no idea what your PHP installation is doing! I fink it broke.
My problem was I needed the target file to be display only and not executed at all. The idea being that when users see the response page they can copy and paste the results into a seperate document which will then be executed itself.
The ability to execute code from multiple include files gets me thinking though...
Many thanks for your help, Webmasterworld is now well in truly in my bookmarks list. I was a bit worried that some of the more educated members might drop on me for my lack of working knowledge, but you know what, you guys are ok.
Cheers all.
I was a bit worried that some of the more educated members might drop on me for my lack of working knowledge
It's a good community here and even the educated members need to ask questions. Everyone is very helpful and welcoming which is what gives WebmasterWorld it's charm.
Plus there are moderators to make sure there is no dropping on anyone, it being against TOS and all. ;)