Jump to content

Load child page on parent page in modal box through ajax


ttttim
 Share

Recommended Posts

I have a parent page containing a list of it's children. When you click on one of the children the page opens up in a modal box trough ajax. So far so good. 

But if i directly load the page through the url (parent/child) i get the child page. Is there a way of loading the parent page instead with the child page opened inside the modal box? I was first thinking of using URLSegments so it would load the parent page with the child name as segment however since the segment is an actual page it will load the page instead.

Any ideas?

Link to comment
Share on other sites

This can be done with a redirect from child template. The redirect should also pass a parameter with child page id that should be caught in parent template and shared with js with something like this

<php
echo "<script>var modalPageId=" . $input->get->childPageId . "</script>";

Then you should check this variable in your javascript and fire a popup if it is populated.

BUT! Do not do none of this cus it is bad for everything: SEO, usability, you name it. Just through a 404 on child pages. If you need direct link just include a get parameter.

Link to comment
Share on other sites

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

×
×
  • Create New...