Skip to main content
Known Participant
July 4, 2018
Answered

Can we apply a template to a template

  • July 4, 2018
  • 3 replies
  • 580 views

and so forth in an infinite nesting...

with dw CC 2018

    This topic has been closed for replies.
    Correct answer Nancy OShea

    You can Save PHP files as Templates.

    Go to File > New > PHP file.  Hit Create button.

    Insert your include statement.

    SaveAs Template and give it the 2nd extension as follows.

    mainTemplate.php.dwt

    3 replies

    Known Participant
    July 8, 2018

    It works perfectly fast and simply with PHP. For examples in my site: <?php require_once('includes/creativePouhons.html'); ?>

    But, as I have the same menu for all pages based on the main template, I would like <?php require_once('includes/menu.html'); ?> in place of repeating the code of this menu:

    -------------------------------------------------------------------

    <ul>

    <li>

    <li>

    <a href="/">Home</a>

    </li>

    <li>

    <a href="/creative.php">Creative</a>

    </li>

    <li>

    <a href="/professional.php">Professional</a>

    </li>

    <li>

    <a href="/HealthSport.php">Health and Sport</a>

    </li>

    <li>

    <a href="/Misceallenous.php">Misceallenous</a>

    </li>

    <li>

    <a href="/about.html">About Me</a>

    </li>

    <li>

    <a href="/contact.html">Contact</a>

    </li>

    </li>

    </ul>

    -----------------------------------------------------------------------

    for <div class="menu full">,

    for <div class="menu dropdown">,

    for <footer class="container">

          <div class="sixteen columns">

            <nav role="navigation">

    As much the include works fine for a. php file as it is rejected and considered an error by a .dwt file. And if I change the .dwt extension to .php, the file loses its template function, I guess.

    Could you help me a little bit more?

    Nancy OShea
    Community Expert
    Nancy OSheaCommunity ExpertCorrect answer
    Community Expert
    July 8, 2018

    You can Save PHP files as Templates.

    Go to File > New > PHP file.  Hit Create button.

    Insert your include statement.

    SaveAs Template and give it the 2nd extension as follows.

    mainTemplate.php.dwt

    Nancy O'Shea— Product User & Community Expert
    BenPleysier
    Community Expert
    Community Expert
    July 8, 2018

    If Nancy's answer does not work, try mainTemplate.dwt.php​, it is what works for me

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    Nancy OShea
    Community Expert
    Community Expert
    July 4, 2018

    Nesting Templates is a bad idea.  Just because you can do it, doesn't mean you should.   If you tell us what you're trying to do and why you think nesting templates would help you, maybe we can offer better options.

    Nancy O'Shea— Product User & Community Expert
    Known Participant
    July 4, 2018

    Thanks Nancy & Ben. I'll tell you more a bit later.

    BenPleysier
    Community Expert
    Community Expert
    July 4, 2018

    If you wish to live dangerously, have a look at Creating a nested template in Dreamweaver

    If you wish to have an easy life, have a look at Alt-Web Design & Publishing: Server-Side Includes with PHP , with thanks to Nancy

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!