Categories > TinyButStrong general >

problem in include order (header and footer)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: saibal
Date: 2014-10-17
Time: 23:22

problem in include order (header and footer)

Hi all,

I don't understand where is my error. I have this template:

[onload;script=header.inc.php;subtpl]

LOREM IPSUM ETC ETC

[onload;script=footer.inc.php;subtpl]

The order would be

1) header code
2) my text
3) footer code

instead, when i use "script" to include dynamic php pages, the order is:

1) header
2) footer
3) my text

why? Can't I use onload/script as INCLUDE in php?

thanks
lorenzo
By: saibal
Date: 2014-10-18
Time: 10:33

Re: problem in include order (header and footer)

very strange... this is the same wrong result:


<h1>Test</h1>

<div>
   [onload;script=footer.php;subtpl]
</div>

and the html is:

Footer text

<h1>Test</h1>

<div> </div>


why?
By: Skrol29
Date: 2014-10-18
Time: 23:18

Re: problem in include order (header and footer)

Hi,

Since TBS 3.9.0 your are supposed to use $TBS in the subtemplate script, instead of the PHP command echo.

Have a look at the option "old_subtemplate":
http://www.tinybutstrong.com/manual.php#php_setoption_methods_old_subtemplate
By: saibal
Date: 2014-10-19
Time: 21:20

Re: problem in include order (header and footer)

thank you. Could you provide a little example please? I tried the "old_subtemplate" option but it does not work. I'm sorry
By: Skrol29
Date: 2014-10-21
Time: 01:39

Re: problem in include order (header and footer)

The best solution is to avoid using the echo() command in the sub-script.
Instead use the variable $TBS, just like in the inline example :
http://www.tinybutstrong.com/examples.php?e=subtpl&s=login&m=php
By: Anonymous
Date: 2014-10-24
Time: 09:28

Re: problem in include order (header and footer)

Thank you
By: saibal
Date: 2014-10-24
Time: 12:31

Re: problem in include order (header and footer)

I avoid all echo command... but the subtpl method does not work. my example is very simple... take a look:

PAGE INDEX.PHP code:

(of course require "TBS CLASS bla bla")

$TBS = new clsTinyButStrong;
$TBS->LoadTemplate(THEME_URL.'/index.htm');
$TBS->Show();

TEMPLATE INDEX code:

lorem ipsum bla bla

[onload;script=subtemplate.php;subtpl]

lorem ipsum bla bla

PAGE SUBTEMPLATE.PHP code:

(of course require "TBS CLASS bla bla")
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('subtpl.htm');
$TBS->Show();

PAGE subtpl.html code:

text from subtpl

the result of all this code is that "subtpl" overwrite all html code. I expect this:

lorem ipsum bla bla

text from subtpl

lorem ipsum bla bla

instead I have:

text from subtpl
By: saibal
Date: 2014-10-24
Time: 12:33

Re: problem in include order (header and footer)

I think in previuos version of TBS, the "include" feature was more clear and simple to implement. Now it's quite intricate
By: saibal
Date: 2014-10-24
Time: 13:09

Re: problem in include order (header and footer)

finally I resolved. the problem was in this missing code (in subtpl template):

"if(isset($this))
        $TBS =& $this;
    else
        $TBS = new clsTinyButStrong;"
By: Skrol29
Date: 2014-10-27
Time: 01:56

Re: problem in include order (header and footer)

OK