Can a template call a template?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
OrcaSoul
Forum Newbie
Posts: 8
Joined: Wed Aug 26, 2009 10:08 pm

Can a template call a template?

Post by OrcaSoul »

Still new to php, have managed to get a working site cobbled together, but still working out some details.

And take a look at the attached image - that should clear up some of what I've managed to confuse... :lol:

I need a way to do one of two things;

1: Use a form to create the button and submit to the master template.

What I see in the books on php makes me use a dynamic form structure that is called from the master template template.tpl (it starts the session and handles setting up vars depending on which template is loaded in the div of orcatools.tpl) - that code:

Code: Select all

 
if ($buttons & B_ABOUT)
      {
         $this->setCurrentBlock("form");
         $this->setVariable("ACTION", S_ABOUT);
         $this->setVariable("NAME", "about");
         $this->setVariable("VALUE", "About Page");
         $this->parseCurrentBlock("form");
      }
 
creates the button, using the following template in orcatools.tpl:
<!-- BEGIN buttons -->
<dd class="nav1">
<!-- BEGIN form -->
<form name='homebtn' action="{ACTION}" method="GET">
<input type="submit" name="{NAME}" value="{VALUE}">
</form>
<!-- END form -->
</dd>
<!-- END buttons -->
And this does work - but leaves some things out. :(

Or, I could:

2: Have the HTML button in my skeleton template orcatools.tpl call about.php and load it's template about.tpl that fills a content div in the skeleton.

The HTML in orcatools.tpl:

Code: Select all

<dd class="nav1"><a class="nav1" href="about.tpl" title="Find out more about the OrcaTools Online Store"><img class='nav1_firstletter' src='Images/tropAlt.gif'>bout OT</a></dd>
Notice that the "A" in "about" is an image, followed by the text "bout".

As I said, the first works, but does not give me the image. :banghead:

The second method seems cleaner - but I can't find a way to do it! I understand that the main problem is that HTML runs on the client, PHP on the server - so I may need to use the form...if so, how do I set it up to load the image? I have thought it might work to use a static form instead of the dynamic one - but still can't see the image...

I've attached an example using both methods to display the buttons...obviously, I'd really like to keep the images.

Any suggestions will be appreciated.
Attachments
menu.gif
menu.gif (17.38 KiB) Viewed 53 times
Post Reply