Forum Moderators: coopster

Message Too Old, No Replies

Read HTML inside PHP script

         

smallcompany

6:03 am on May 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It never ends...

<?php
$q = $_SERVER["QUERY_STRING"];
$code = '<body>
<p>&nbsp;</p>
<!-- TemplateBeginEditable name="text" -->
<p><a href="links/links.php?m=link23999">Outgoing Link 1</a></p>
<p><a href="links/links.php?m=link24999">Outgoing Link 2</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="page1.html">Page 1</a></p>
<p><a href="page2.html">Page 2</a></p>
<p>&nbsp;</p>
<!-- TemplateEndEditable -->
</body>';
$code = str_replace('html">','html?' . $q . '">',$code);
$code = str_replace('999">','&myVariable=' . $q . '">',$code);
echo $code;
?>
</html>

In this template, DreamWeaver is not recognizing edit regions.

Is it possible to mark certain lines to be read like they are outside of PHP so DreamWeaver treats them the same way (outside)?

In addition, if this continues with other unpredictable cases (parts of HTML being ignored because they are inside PHP script), we better drop out such way of using PHP. Would you consider such way of combining PHP and HTML dangerous from the perspective of having site or some pages broken at some point? I mean, the whole <body> of each page will be parsed as PHP which worked great in testing mode, but stopped immediately as soon as we tried to apply it to a template in DreamWeaver.

Thank you.

wsmeyer

7:30 am on May 8, 2007 (gmt 0)

10+ Year Member



I don't use Dreamweaver but you could try the heredoc syntax and see if it likes that better:

[us.php.net...]

Or, you'll just have to break in and out of php, something like this:

<?php $q = $_SERVER["QUERY_STRING"];?>
<body>
<p>&nbsp;</p>
<!-- TemplateBeginEditable name="text" -->
<p><a href="links/links.php?m=link23<?php echo '&myVariable=' . $q?>">Outgoing Link 1</a></p>
<p><a href="links/links.php?m=link24<?php echo '&myVariable=' . $q?>">Outgoing Link 2</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="page1.html<?php echo '?' . $q?>">Page 1</a></p>
<p><a href="page2.html<?php echo '?' . $q?>">Page 2</a></p>
<p>&nbsp;</p>
<!-- TemplateEndEditable -->
</body>
</html>

William.

smallcompany

4:12 pm on May 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks, but that did not work.

jd01

9:09 pm on May 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That's a DreamWeaver setting, not really php.
If the above didn't work, and you don't get an answer here, you might want to try the Adobe site.

Unless someone here has had exactly the same issue (with DW, editables, and php/html specifically) we probably won't be able to answer.

(The answer's not going to be in the php manual, but might in the DreamWeaver one.)

Justin

smallcompany

9:29 pm on May 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Absolutely right. Thanks a lot.