Categories > TinyButStrong general >

conditional display

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: pfpro
Date: 2006-02-02
Time: 18:59

conditional display

yo dev-squad!

tryin to handle conditional display

getting data from mysql table,
i try to display different templates
field "type" should be my switch

wheres my mistake? could someone help me out...?

cheers
phil



////////////////////////////////////////////////// TEMPLATE :: HTML


[blk_paged;block=begin]

[blk_paged.type;if [val]='A';then [onload;file=[var.CFG.root_dir][var.TPL.path]content/directory_company_type_a.tpl.htm]]
[blk_paged.type;if [val]='B';then [onload;file=[var.CFG.root_dir][var.TPL.path]content/directory_company_type_b.tpl.htm]]

[blk_paged;block=end]




////////////////////////////////////////////////// PHP :: SIDE

include_once "inc/common.inc.php";

$mod = "Directory";

$paging = true;
#$CFG["debug"] = true;

// template settings

$TPL["nav"] = get_template("nav/nav_index.tpl.htm");
$TPL["template"] = get_template("content/directory.tpl.htm");

// search

include_once "inc/paging_search.inc.php";

// sql

$sql = "SELECT * FROM xyz";

// paging

include_once "inc/paging.inc.php";

// template

init_template($TPL["template"]);

// fire

include_once "inc/common_outro.inc.php";

By: pfpro
Date: 2006-02-02
Time: 19:05

Re: conditional display

ah, got it:

<div>
[blk_paged.type;block=div;when [blk_paged.type]='A']
[onload;file=[var.CFG.root_dir][var.TPL.path]content/directory_company_type_a.tpl.htm]
</div>

<div>
[blk_paged.type;block=div;when [blk_paged.type]='B']
[onload;file=[var.CFG.root_dir][var.TPL.path]content/directory_company_type_b.tpl.htm]
</div>

sorry for disturbing the peace...
;)

keep die geilheit tight
big up skrol
By: Tom
Date: 2006-02-02
Time: 20:26

Re: conditional display

Hi pfpro,

Even though you found your solution ;-) perhaps you'd linger long enough to help us newbies learn from what/how your using TBS...

Your php code has your own functions (I couldn't find then inside of TBS-class) to do higher-level (higher than TBS it seems)stuff

What do your init_template() and get_template() do when interacting with TBS ?

and what's in your common.in.php ?

Thanks for any learning you care to give,

TomH