Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
There are 2 templates that are not related to each other: folder.php and companies.php I should have used relation, but for some dumb reason I haven't, and now it's too late for that.
Now I have to create a report and need some info from both of them, so I'm trying to set company name from folder.php as a global value and use it in custom_field on companies.php in order to link the 2 templates.
Code: Select all
<cms:set my_page_id="<cms:gpc method='get' var='id' />"/>

<cms:pages masterpage='members/folders.php' id="<cms:show my_page_id />" >
   <cms:set my_firm=firm scope='global' />   
</cms:pages>
   
<cms:pages masterpage='members/companies.php' custom_field="company == 'my_firm'" >
   <cms:set my_address=address scope='global' />   
</cms:pages>
.......................................
<cms:show my_address />

It looks like <cms:show my_address /> doesn't return anything, because my_firm from custom_field="company == 'my_firm'" it's not working. If I hardcode the custom_field field like: custom_field="company == 'SOME COMPANY LTD'" then tings work as expected.
So my question is: can global values be used like this (but I'm doing something wrong) or they can't .
Or there is a better approach to this?
Thank you.
If I hardcode like: custom_field="company == 'SOME COMPANY LTD'" then tings work as expected.


Do it like this —

custom_field="company == <cms:show my_firm />" >


P.S. Relations may not be beneficial if there are hundreds of 'folders' and thousands of 'companies'. So it's ok if you don't have a hard relation between the two.
trendoman wrote:
If I hardcode like: custom_field="company == 'SOME COMPANY LTD'" then tings work as expected.


Do it like this —

custom_field="company == <cms:show my_firm />" >


P.S. Relations may not be beneficial if there are hundreds of 'folders' and thousands of 'companies'. So it's ok if you don't have a hard relation between the two.

Thank you trendoman!!! Works great!
And it's good to know that relations doesn't always represent a solution to prefer.
3 posts Page 1 of 1
cron