Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Smarty Question !!!

Smarty Question !!!

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
phphtmlwpftutorialquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohammad Dayyan
    wrote on last edited by
    #1

    Hi friends.
    I usually use Smarty to create templates.

    When I wanted to create somethings like this :

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>
    </head>
    <body>

    <table>
    <tr>
    <td> </td>
    </tr>
    </table>

    <table>
    <tr>
    <td> </td>
    </tr>
    </table>

    <table>
    <tr>
    <td> </td>
    </tr>
    </table>

    <table>
    <tr>
    <td> </td>
    </tr>
    </table>

    </body>
    </html>

    I created three files ( for example Header.tpl , Footer.tpl , Body.tpl )

    Header.tpl :

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>
    </head>
    <body>

    Body.tpl :

    <table>
    <tr>
    <td> </td>
    </tr>
    </table>

    Footer.tpl :

    </body>
    </html>

    Then I wrote this Smarty code in PHP to created above HTML file :

    $smarty -> display('Header.tpl');
    for ($i=0; $i<=3; $i++)
    $smarty -> display('Body.tpl');
    $smarty -> display('Footer.tpl');

    This way is bad, because designing template is very difficult.
    Are there any ways to use Smarty and create above HTML file.
    Thanks in advance

    Sorry for my English. I'm a freshman .

    B 1 Reply Last reply
    0
    • M Mohammad Dayyan

      Hi friends.
      I usually use Smarty to create templates.

      When I wanted to create somethings like this :

      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Test</title>
      </head>
      <body>

      <table>
      <tr>
      <td> </td>
      </tr>
      </table>

      <table>
      <tr>
      <td> </td>
      </tr>
      </table>

      <table>
      <tr>
      <td> </td>
      </tr>
      </table>

      <table>
      <tr>
      <td> </td>
      </tr>
      </table>

      </body>
      </html>

      I created three files ( for example Header.tpl , Footer.tpl , Body.tpl )

      Header.tpl :

      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Test</title>
      </head>
      <body>

      Body.tpl :

      <table>
      <tr>
      <td> </td>
      </tr>
      </table>

      Footer.tpl :

      </body>
      </html>

      Then I wrote this Smarty code in PHP to created above HTML file :

      $smarty -> display('Header.tpl');
      for ($i=0; $i<=3; $i++)
      $smarty -> display('Body.tpl');
      $smarty -> display('Footer.tpl');

      This way is bad, because designing template is very difficult.
      Are there any ways to use Smarty and create above HTML file.
      Thanks in advance

      Sorry for my English. I'm a freshman .

      B Offline
      B Offline
      Bradml
      wrote on last edited by
      #2

      Can't you just output the HTML? It doesn't stop normal PHP from working.


      Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.

      M 1 Reply Last reply
      0
      • B Bradml

        Can't you just output the HTML? It doesn't stop normal PHP from working.


        Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.

        M Offline
        M Offline
        Mohammad Dayyan
        wrote on last edited by
        #3

        Thanks Bradml.

        Bradml wrote:

        Can't you just output the HTML?

        Yes, I can. but I want generate output by SMARTY ! :^)

        Sorry for my English. I'm a freshman .

        B 1 Reply Last reply
        0
        • M Mohammad Dayyan

          Thanks Bradml.

          Bradml wrote:

          Can't you just output the HTML?

          Yes, I can. but I want generate output by SMARTY ! :^)

          Sorry for my English. I'm a freshman .

          B Offline
          B Offline
          Bradml
          wrote on last edited by
          #4

          .... why? What benefit does that provide?


          Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.

          M 1 Reply Last reply
          0
          • B Bradml

            .... why? What benefit does that provide?


            Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.

            M Offline
            M Offline
            Mohammad Dayyan
            wrote on last edited by
            #5

            Bradml wrote:

            What benefit does that provide?

            With Smarty you can sift Template through program , so we can change template easily.

            Sorry for my English. I'm a freshman .

            B 1 Reply Last reply
            0
            • M Mohammad Dayyan

              Bradml wrote:

              What benefit does that provide?

              With Smarty you can sift Template through program , so we can change template easily.

              Sorry for my English. I'm a freshman .

              B Offline
              B Offline
              Bradml
              wrote on last edited by
              #6

              Ok, well sorry I haven't really looked into Smarty so I'm not going to be of too much help. Check out the Smarty Forums[^]. They can probably help you out.


              Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.

              M 1 Reply Last reply
              0
              • B Bradml

                Ok, well sorry I haven't really looked into Smarty so I'm not going to be of too much help. Check out the Smarty Forums[^]. They can probably help you out.


                Brad Australian The PHP MVP - Christian Graus on "Best books for VBscript" A big thick one, so you can whack yourself on the head with it.

                M Offline
                M Offline
                Mohammad Dayyan
                wrote on last edited by
                #7

                OK, That's all right. Thanks

                Sorry for my English. I'm a freshman .

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups