Categories > TinyButStrong general >

using dynamic content from a template using PHP instead of HTM

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Rizwan Raza
Date: 2010-08-15
Time: 02:59

using dynamic content from a template using PHP instead of HTM

I have the following piece of code that usign TBS

$template        = "themes/$user_theme/templates/main_1.htm';
$inner_template1     = "themes/$user_theme/templates/inner_index.htm";
$TBS             = new clsTinyButStrong;
$TBS->NoErr     = true;

$TBS->LoadTemplate("$template");

$TBS->MergeBlock('mp', $recent);
$TBS->MergeBlock('blkfeatured_videos', $browse_videos);
$TBS->MergeBlock('blkfeatured_audios', $browse_audios);
$TBS->MergeBlock('blkfeatured_blogs', $browse_blogs);
$TBS->MergeBlock('blkfeatured_images', $browse_images);

$TBS->Render     = TBS_OUTPUT;
$TBS->Show();

I would like to throw in some  dynamic content so instead of doing the above I would like to do the following

$template        = "themes/$user_theme/templates/main_1.php';
$inner_template1     = "themes/$user_theme/templates/inner_index.php";
$TBS             = new clsTinyButStrong;
$TBS->NoErr     = true;

$TBS->LoadTemplate("$template");

$TBS->MergeBlock('mp', $recent);
$TBS->MergeBlock('blkfeatured_videos', $browse_videos);
$TBS->MergeBlock('blkfeatured_audios', $browse_audios);
$TBS->MergeBlock('blkfeatured_blogs', $browse_blogs);
$TBS->MergeBlock('blkfeatured_images', $browse_images);

$TBS->Render     = TBS_OUTPUT;
$TBS->Show();

Notice the template name change to *.php to throw in some dynamic content. The problem php inside is not getting execute so I end up getting php code instead of the result from php code.

Is it possible to do something like this?


By: TomH
Date: 2010-08-15
Time: 04:26

Re: using dynamic content from a template using PHP instead of HTM

What you ask is very simple in TBS ... you just identify the sub script you want to execute inside the template

Try starting here http://www.tinybutstrong.com/examples.php

Look over the example "Execute another script"

If you can't get it working from there, just post back here with the code you're trying

HTH,
TomH