Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with .dwt.php file and php coding

New Here ,
Dec 08, 2010 Dec 08, 2010

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

TOPICS
Server side applications
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 08, 2010 Dec 08, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 09, 2010 Dec 09, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 09, 2010 Dec 09, 2010
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines