Hi!
I have one Template for the main content and another for the side bar. I’d like the side bar Template to know what’s in the main content Template. Is this possible? I imagine it is.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
October 11, 2010 5:50am
Subscribe [2]#1 / Oct 11, 2010 5:50am
Hi!
I have one Template for the main content and another for the side bar. I’d like the side bar Template to know what’s in the main content Template. Is this possible? I imagine it is.
#2 / Oct 11, 2010 7:34am
Yep you’re right! One way is to use conditionals in your sidebar template to evaluate the URL segment, something like this:
Say you have a page mysite.com/index.php/news/entry
{if segment_2 == "entry"}
This is an entry page
{/if}#3 / Oct 11, 2010 7:46am
Yep you’re right! One way is to use conditionals in your sidebar template to evaluate the URL segment…
Thanks for the reply, what you’ve suggested was / is my backup plan!
I thought there might have been a smarter way, in which one Template could grab the details of another.
Because of what I’m doing, conditionals will be monumentally messy. I need something that is dynamic, so the side bar Template grabs content automatically, without me creating a long list for it to sift through.
#4 / Oct 11, 2010 8:28am
There are a few approaches to making things dynamic but without any detailed info conditionals are nearly always the obvious choice 😊
Can you elaborate a bit on what you want to achieve, code samples are a good start…?
#5 / Oct 11, 2010 8:43am
Can you elaborate a bit on what you want to achieve…
I don’t think there’s much else I can say, really. What I’ve explained is all there is to say. I’m just using the Channel tag for both Templates to grab content specific to each.
#6 / Oct 12, 2010 1:19pm
Look in the User Guide, Embed Variables for the Embedded Template
#7 / Oct 13, 2010 5:47am
Look in the User Guide, Embed Variables for the Embedded Template
Hi Paul, since I’m new to this, it’s not easy finding something when you don’t really know how to describe what you’re looking for.
That aside, Sub-Templates looks to be what I need, so thanks!