Copy link to clipboard
Copied
Hi,
I am currently building a website which uses a dreamweaver .dwt.php template file. All of the child pages are .php. The problem is when I insert the php code to the very top of the .dwt.php template file, and then insert the end code to the bottom of the file I get error messages saying that I need to add '<!-- TemplateInfo codeOutsideHTMLIsLocked="true" -->' into the head code (which I already have done) and 'The template doesn't have any editable regions. Are you sure you want to continue?' (whereas the template DOES have editable regions).
The code I am adding into the top (above the opening <html> tag) looks like this...
<?php
Here in between is the actual php code, I have taken it out as that is not the problem and I do not want to bore you with lines and lines of code!
$s_Body = <<<END1
Then inbetween is the page content which contains editable regions.
And the code going into the bottom (after the closing <html/> tag) looks like this....
END1;
echo $s_Body;
?>
I dont really understand why it doesnt allow me to add this code. But I need to keep the template file as there are so many files on the website, and I would like to maintain the php code as it all works just the way I want it to.
Any help would be much appreciated
Thanks
Copy link to clipboard
Copied
It won't let you do it because Dreamweaver templates are designed to work with HTML code. What you're trying to do is to get a template to understand PHP heredoc syntax.
Dreamweaver templates permit you to embed PHP code blocks inside HTML, but they do not support HTML embedded in heredoc. You're trying to put diesel into a petrol (gasoline) engine. It doesn't work.
Copy link to clipboard
Copied
ahhh that makes sense. Is there any other way of using a template file with this kind of code on the pages? Ive tried to add the php code to the child pages instead, but when updating the template file, the code is deleted :S
Copy link to clipboard
Copied
PHP code that is in a locked area should be preserved and updated when you edit the main template, but anything in an editable area won't be updated. Generally, I find it much more efficient to use PHP includes, rather than templates.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more