Action: Re-using Page Elements with the include Function

  1. Create the following file and save it as header.tpl in your template directory:
    <html>
    <head>
     <title>Smarty LLC</title>
    </head>
    <body>
  2. Create another file called footer.tpl in the same location, with the following content:
    </body>
    </html>
  3. Now make the following changes to your existing web pages:
    • Replace the following HTML snippets:
      <html>
      <head>
      <title>Smarty LLC</title>
      </head>
      <body>

      With:

      {include file=”header.tpl”}
    • Substitute the following:
      </body>
      </html>

      With:

      {include file=”footer.tpl”}
  4. Open your web browser and take a look at your website again. You should see exactly what you were seeing before. Try adding an image tag to add the image new.jpg to your header.tpl template file, and reloading the website in your browser. You should see the new image on all the web pages, as shown:
    Action: Re-using Page Elements with the include Function
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.239.110