I am glad you got it working
It seems it is the same solution that Cheesypoof had suggested very early on in the thread.
Please let me try and explain the part that was confusing to you -
Let us say we have two templates 'events.php' and 'concerts.php'.
On 'events,php', if we use this tag
it will, of course, show 'events.php'.
Now suppose on the same 'events.php' we use the following code
(notice that we are within 'events.php' and are making the 'cms:pages' tag fetch in pages from a different template 'concerts.php')
The 'cms:pages' tag within its opening and closing tag creates (so to say) a micro-cosm that makes it look as if we are on 'concerts.php'.
This id does by setting all variables (within its pair of tags) with reference to its masterpage i.e. 'concerts.php'.
So basically, we now have two sets of variable -
1. On the main template 'events,php' (outside the cms:pages block) that reference 'events.php'
2. Within the cms:pages block (i.e. between the opening and closing tags) that reference 'concerts.php'.
For example, take a look at this -
Let us see using the code above what was happenning with your original code -
And finally the code suggested by cheesypoof
Hope this clears up the confusion somewhat.
Thanks.
It seems it is the same solution that Cheesypoof had suggested very early on in the thread.
Please let me try and explain the part that was confusing to you -
Let us say we have two templates 'events.php' and 'concerts.php'.
On 'events,php', if we use this tag
<cms:show k_template_name />
it will, of course, show 'events.php'.
Now suppose on the same 'events.php' we use the following code
<cms:pages masterpage='concerts.php' limit='5'>
</cms:pages>
(notice that we are within 'events.php' and are making the 'cms:pages' tag fetch in pages from a different template 'concerts.php')
The 'cms:pages' tag within its opening and closing tag creates (so to say) a micro-cosm that makes it look as if we are on 'concerts.php'.
This id does by setting all variables (within its pair of tags) with reference to its masterpage i.e. 'concerts.php'.
So basically, we now have two sets of variable -
1. On the main template 'events,php' (outside the cms:pages block) that reference 'events.php'
2. Within the cms:pages block (i.e. between the opening and closing tags) that reference 'concerts.php'.
For example, take a look at this -
- Code: Select all
<cms:show k_template_name /> // Will show 'events.php'
<cms:pages masterpage='concerts.php' limit='5'>
<cms:show k_template_name /> // Will show 'concerts.php'. The variables here 'overshadow' the variables outside this block.
</cms:pages>
<cms:show k_template_name /> // Will show 'events.php' again
Let us see using the code above what was happenning with your original code -
- Code: Select all
<cms:show k_template_name /> // Will show 'events.php'
<cms:pages masterpage='concerts.php' limit='5'>
<cms:show k_template_name /> // Will show 'concerts.php'. The variables here 'overshadow' the variables outside this block.
<cms:if k_template_name=='concerts.php'> class="current"</cms:if> // comparing 'concerts.php'=='concerts.php'. Will always be TRUE
</cms:pages>
<cms:show k_template_name /> // Will show 'events.php' again
And finally the code suggested by cheesypoof
- Code: Select all
<cms:show k_template_name /> // Will show 'events.php'
<cms:set current_template_name=k_template_name /> // We are saving 'events.php' in 'current_template_name'
<cms:pages masterpage='concerts.php' limit='5'>
<cms:show k_template_name /> // Will show 'concerts.php'. The variables here 'overshadow' the variables outside this block.
<cms:if k_template_name==current_template_name> class="current"</cms:if> // comparing 'concerts.php'=='events.php'. Will be FALSE
</cms:pages>
<cms:show k_template_name /> // Will show 'events.php' again
Hope this clears up the confusion somewhat.
Thanks.