1
yuriko
How create simple template xoops2?
  • 2004/5/12 5:45

  • yuriko

  • Just popping in

  • Posts: 8

  • Since: 2004/5/12


I have.
php code:
...
$xoopsOption['template_main'] = 'create_list.html';
$test = array ("dir1" => array("date_file_in_dir1" => "111.txt","date_file_in_dir1" => "222.txt" ),"dir2" => array ("date_file_in_dir2" => "test.txt","date_file_in_dir2" => "ss.txt"));
$xoopsTpl->assign('list',$test);
...

dir1, dir2 ... -- randomise;

how do template "create_list.html"
to be show:
dir -- date -- name ?
I try using this code template "create_list.html"
<{section name=i loop=$list>
<{section name=z loop=$list[i]}>
<{$list[i][z]}>
<{/section}>
<{/section}>
Not working
Plz.. help..

2
Mithrandir
Re: How create simple template xoops2?

<{$list.i.z}>

3
yuriko
Re: How create simple template xoops2?
  • 2004/5/12 9:09

  • yuriko

  • Just popping in

  • Posts: 8

  • Since: 2004/5/12


not working ;-(
my files
./index.php

require('header.php');
$xoopsOption['template_main'] = 'create_list.html';
require(XOOPS_ROOT_PATH.'/header.php');
$test[dir1][file1]=test;
$test[dir1][file2]=test1;
$test[dir1][file3]=test3;
$test[dir2][file1]=test1;
$test[dir3][file1]=test2;
print_r($test); //test array
i see
Array ( [dir1] => Array ( [file1] => test [file2] => test1 [file3] => test3 ) [dir2] => Array ( [file1] => test1 ) [dir3] => Array ( [file1] => test2 ) )
$xoopsTpl->assign('list1',$test);
require(XOOPS_ROOT_PATH.'/footer.php');


./template/create_list.html
<{section name=i loop=$list1>
<{section name=z loop=$list1[i]}>
<{$list.i.z}>
<{/section}>
<{/section}>

how?
this simple example, but not working?

4
Mithrandir
Re: How create simple template xoops2?

Try turning on Smarty debug in system admin -> preferences -> general settings and go to your test page again.

A popup window should emerge showing all smarty variables.
See if you can find the "list" item and paste the contents here.

5
yuriko
Re: How create simple template xoops2?
  • 2004/5/12 9:58

  • yuriko

  • Just popping in

  • Posts: 8

  • Since: 2004/5/12


{$list1} Array (3)
dir1 => Array (3)
file1 => test
file2 => test1
file3 => test3
dir2 => Array (1)
file1 => test1
dir3 => Array (1)
file1 => test2

Im change $list to $list1
in template.. but not work.

6
Mithrandir
Re: How create simple template xoops2?

try this:
<{foreach item=dir from=$test}>
     <{foreach 
item=file from=$dir}>
         <{
$file}>
     <{/foreach}>
<{/
foreac}>

I am more familiar with foreach than section

7
yuriko
Re: How create simple template xoops2?
  • 2004/5/12 10:51

  • yuriko

  • Just popping in

  • Posts: 8

  • Since: 2004/5/12


IMHO
<{foreach item=dir from=$list1}>
<{foreach item=file from=$dir}>
<{$file}>
<{/foreach}>
<{/foreac}>

i'm try create new array $test1
$test1[dir1]="qq";
$test1[dir2]="qq1";
$test1[dir3]="qq2";
$xoopsTpl->assign('list2',$test1);

in template
<{foreach item=file1 from=$list2}>
<{$file1}>
<{/foreac}>

not work
xoops2 2.0.6

8
Mithrandir
Re: How create simple template xoops2?

When things aren't working, please say WHAT isn't working. Getting blank screen? No content? Only half content? Getting error messages?

In
<{foreach item=file1 from=$list2}>
<{
$file1}>
<{/
foreac}>

I see a wrong end tag <{foreac}>, which should be <{/foreach}> - but I don't know if it is a bad paste or a typo in the actual code, and hence I don't know whether it is a code problem or a typo problem.

9
yuriko
Re: How create simple template xoops2?
  • 2004/5/13 2:52

  • yuriko

  • Just popping in

  • Posts: 8

  • Since: 2004/5/12


Get only XOOPS content(header, menu,footer), but not content my test module.
Content array test2 & test1 not display.

Login

Who's Online

302 user(s) are online (187 user(s) are browsing Support Forums)


Members: 0


Guests: 302


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits