Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

assign template to template var

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  

What is the best Template System
Smarty
100%
 100%  [ 8 ]
PHP FastTemplate
0%
 0%  [ 0 ]
PHPlib Template
0%
 0%  [ 0 ]
Total Votes : 8

Author Message
mfeldheim
Smarty n00b


Joined: 24 May 2003
Posts: 2
Location: Stuttgart, Germany

PostPosted: Sat May 24, 2003 3:27 pm    Post subject: assign template to template var Reply with quote

Hi all together,

I have a template (1) with var {$navbar}.
And I have one more template(2) which should be filled with content and included into template 1

template (2) example

<table>
<tr>
<td>{$Menu Block_n}</td>
<td>{$Menu_Item_n.1}</td>
<td>{$Menu_Item_n.2}</td>
<td>{$Menu_Item_n.3}</td>
</tr>
</table>

I have an array, filled with the content of eg three such blocks..

Menu_Block_1 -> Help
Menu_Item_1.1 -> F.A.Q
Menu_Item_1.2 -> Discussion Board
Menu_Item_1.3 -> Mail me

Menu_Block_2 -> Downloads
Menu_Item_2.1 -> Core
Menu_Item_2.2 -> Modules
Menu_Item_2.3 -> Documentation

Menu_Block_3 -> Member Area
Menu_Item_3.1 -> Login
Menu_Item_3.2 -> New Member
Menu_Item_3.3 -> Forgot password?

And I want to assign the block template (2) in this example three times to {$navbar}

How do I manage sth like that?
Generally how do I assign a template to a template var?

Thank you

Greets mfeldheim
Back to top
View user's profile Send private message Send e-mail MSN Messenger
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Sat May 24, 2003 4:51 pm    Post subject: Reply with quote

http://smarty.php.net/manual/en/language.function.fetch.php and the poll is kind of pointless seeing as this is a forum for Smarty users I doubt you will get anyone to say they prefer something over Smarty.
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
mfeldheim
Smarty n00b


Joined: 24 May 2003
Posts: 2
Location: Stuttgart, Germany

PostPosted: Sat May 24, 2003 6:24 pm    Post subject: no real help... Reply with quote

[Poll] .. perhaps you're right... Rolling Eyes

[Link] I don't know whether you didn't understand my question or you've pasted the wrong doc-link...

But I don't wanna know how to fetch complete sites..

I want to assign a array filled table several times to a template var by loop...

PHP FastTemplate example [Sorry... Wink]


Code:


$obj = new FastTemplate("./templates/");
$obj -> define (array("header" => "header.tpl", "main" => "main.tpl", "nav" => "dynamic_nav.tpl")); 

// Arrays out of mysql db.... and ..

while ($i < $num) {

       $obj -> assign ("BLOCK", $block[$i]);

       $query = "SELECT * from $table[navbar] WHERE block = '$block[$i]' AND link != 'block' AND link != 'no' ORDER BY 'pos'";
       $result = mysql_db_query ($db_name, $query, $connection);
       $x = 0;
       while ($row = mysql_fetch_array ($result)) {

              $linktext[$x] = $row[linktext];
              $link[$x] = $row[link];
              $pos[$x] = $row[pos];
              $new_link[$b_pos[$i]] .= "<p class=\"text\"><a href=\"$link[$x]\" onmouseover=\"status='$linktext[$x]' ;return true;\">$linktext[$x]</a></p>";
              $x++;

              }

       $obj -> assign ("NAV_LINK", $new_link[$i]);
       $up   = $b_pos[$i]-1;
       $down = $b_pos[$i]+1;

       $obj -> assign ("NAV_IMG", "<a href=\"#$up\" onmouseover=\"status='Hoch' ;return true;\"><img src=\"images/up.gif\" width=\"14\" height=\"10\" border=\"0\" alt=\"Hoch\"></a><a href=\"#$down\" onmouseover=\"status='Runter' ;return true;\"><img src=\"images/down.gif\" width=\"14\" height=\"10\" border=\"0\" alt=\"Runter\"></a>");
       $obj -> assign ("ANCH", $b_pos[$i]);
       $obj -> parse  ("NAVBAR", ".nav");
       $i++;

       }

// parse documents
$obj -> parse (header, "header");
$obj -> parse (main, "main");

$obj -> FastPrint(header);
$obj -> FastPrint(main);


maybe it's clear now what I want to do!??
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP