Mackski Posted September 12, 2015 Share Posted September 12, 2015 I'm forever writting code like this: $currency_id = $pages->get($page->currency); $packages = $pages->get('template=packages, currency='.$currency_id); Where $page->currency is a page select referencing another page.It would be great to shortcut this method to something like this: $packages = $pages->get('template=packages, currency='.$page->currency->getPage()->id');Or if I wanted to get the title of the currency referenced by the page field: echo $page->currency->getPage()->title;So in essence I'm chainging calls to get a page field, the get the corresponding page and retrieve the value of a selected field. Link to comment Share on other sites More sharing options...
tpr Posted September 13, 2015 Share Posted September 13, 2015 Have you tried this? $packages = $pages->get('template=packages, currency='.$page->currency->id); Perhaps you can leave the last "->id" part too. If you are using this regularly, create a getPackages function in _func.php that accepts $page as parameter and returns the snippet I wrote above. Thus you could use getPackages($page) when you need it. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now