Jump to content

[SOLVED] How to check if page is selected from another page?


PWaddict
 Share

Recommended Posts

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

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 } 
   } ?>

 

  • Like 1
Link to comment
Share on other sites

  • PWaddict changed the title to [SOLVED] How to check if page is selected from another page?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...