In a loop template-variables for template-files?!

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
Post Reply
Franklin
Registered User
Posts: 15
Joined: Wed Apr 12, 2006 12:19 pm

In a loop template-variables for template-files?!

Post by Franklin »

I know how to make a loop:

Code: Select all

$template->assign_block_vars('loop', array(
   'VAR'  => $i
));
[ in a php-loop, e.g. for() ]

I know how I can include a file with an template variable, too. (look at viewtopic.php?t=21503)

Code: Select all

$template->set_filenames(array(
   'test'  => 'test.html'
));
$template->assign_display('test', 'FILE_VAR');
But how can I include a template file with an template variable in a loop?

I hope you understand what I want :oops:
I'm German, so I can't speak English very well...
User avatar
DoubleJ
Registered User
Posts: 105
Joined: Thu Jan 13, 2005 4:19 pm
Location: The Netherlands
Contact:

Re: In a loop template-variables for template-files?!

Post by DoubleJ »

do you mean something like:

Code: Select all

<?php
for( $i = 0; $i <= $end; $i++ )
{
    $template->set_filenames('test_' .$i, 'test.html');
    $template->assign_display('test_' .$i, 'VAR');
}
?>
DoubleJ - Blah
Franklin
Registered User
Posts: 15
Joined: Wed Apr 12, 2006 12:19 pm

Re: In a loop template-variables for template-files?!

Post by Franklin »

DoubleJ wrote: do you mean something like:

Code: Select all

<?php
for( $i = 0; $i <= $end; $i++ )
{
    $template->set_filenames('test_' .$i, 'test.html');
    $template->assign_display('test_' .$i, 'VAR');
}
?>
No, I don't...
This code includes always the same file...

And the template code have to be in a loop

Code: Select all

<!-- BEGIN sth -->
{sth.file}
<!-- END sth -->
{sth.file} must include first file, second file, third file...
I'm German, so I can't speak English very well...
User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: In a loop template-variables for template-files?!

Post by Acyd Burn »

This can be achived by assign_display too.

Image
Post Reply