Page 1 of 1

render/compiling order

Posted: Wed Oct 04, 2006 7:10 pm
by sloecoach
Could anyone tell me in what order the individual parts of the site get rendered, i.e., the user-defined tags, global content blocks, main content, etc.

Also, is it possible to create variables to share across blocks or tags? A typical strategy I employ when making non cmsms websites is to have a php switch in the header which sets a bunch of variables for each particular page, then at a certain place in the layout, I might call for $rightPanel and that might be different depending on which page I'm on. I'm wondering if this is possible.

sloe

Re: render/compiling order

Posted: Wed Oct 04, 2006 11:15 pm
by Dr.CSS
Sounds like you may need to use diff. templates for diff. pages and/or Global Content Blocks which you can write once and use on diff. pages.

Re: render/compiling order

Posted: Wed Oct 04, 2006 11:59 pm
by sloecoach
mark wrote: Sounds like you may need to use diff. templates for diff. pages and/or Global Content Blocks which you can write once and use on diff. pages.
Did a little testing and found what I was looking for thanks to your suggestion. User Defined Tags and Global Content Blocks can both be used in the template (obviously) and the content (which i didn't realize). Also found you can use the UDTs in the GCBs.

This makes my problem much easier. As you suggested, I will create a GCB for each part of the site and dole them out in the conent pages.

Thanks.

Re: render/compiling order

Posted: Thu Oct 05, 2006 12:43 am
by calguy1000
you can just create global php variables in one user defined tag
and then use them again in another....

see the 'global' keyword in the php docs.

Re: render/compiling order

Posted: Fri Oct 06, 2006 6:24 pm
by sloecoach
thanks. I thought I had tried that. and I had, but played around some and this is what I found. If I create two UDTs say:

Code: Select all

global $myVar;
$myVar = "hello world";

Code: Select all

global $myVar;
echo $myVar;
I can put the first at the top of a template and the second one at the bottom. and it will echo "hello world". If you omit either of the:

Code: Select all

global $myVar;
lines, it won't work (at least it didn't for me).

This is just what I was looking for.