PWaddict Posted May 3, 2018 Share Posted May 3, 2018 How to check if the current page from template-1 has been selected (using page field) from another page from template-2? Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 3, 2018 Share Posted May 3, 2018 Maybe... <?php if(count($pages->find("template=template-2, pageField=$page"))) { // do this } else { // or that }; ?> 1 Link to comment Share on other sites More sharing options...
PWaddict Posted May 3, 2018 Author Share Posted May 3, 2018 I'm trying to get the url from the selected page by using the following code on template-1 but I'm getting the url from the current page of template-1. $related_page = $pages->find("template=template-2, mypagetable=$page"); if(count($related_page)) { ?> <a href="<?= related_page->url ?>">Related Page</a> <?php } ?> Link to comment Share on other sites More sharing options...
PWaddict Posted May 3, 2018 Author Share Posted May 3, 2018 It seems that I just forgot to use the foreach for it to work $related_page = $pages->find("template=template-2, mypagetable=$page"); if(count($related_page)) { foreach($related_page as $rp) { ?> <a href="<?= $rp->url ?>">Related Page</a> <?php } } ?> 1 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