render/compiling order

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
sloecoach

render/compiling order

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: render/compiling order

Post 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.
sloecoach

Re: render/compiling order

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: render/compiling order

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
sloecoach

Re: render/compiling order

Post 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.
Locked

Return to “CMSMS Core”