Jump to content

PageTable: get parent


pppws
 Share

Recommended Posts

Hey there,

for a current project i'm using the 'PageTable' Module, which works great!

I created several 'modules' (PageTables) that the user can choose from. I also allow the user to set a 'checkbox' to display an excerpt of the page on the homepage. Now it gets a bit tricky: when a page contains an 'event'-module, the event module gets also displayed on the frontpage. which also still works. my problem is that the ->url (obviously) returns the url to the page used by the PageTable field and not by the 'parent'-page.

 

for better understanding:

// get all pages (modules) with template 'event'
$featured = $pages->find('template=Veranstaltung, sort=-module_event_datestart, module_event_dateend>=today');
// get all pages marked with frontpage
$featured->add($pages->find('frontpage_show=1, sort=created'));

 

i loop through all the posts with some if statements e.g. for 'events'

<?php if ($child->template == "Veranstaltung"): ?>
	<div class="article__event">
		<?= $child->module_event_text ?>
		<a class="article__readmore" href="<?= $child->url ?>">read more</a>
	</div>
<?php endif; ?>

All pages created by the PageTable module are stored in a page called 'never touch', so the $child->url returns something like: 'never-touch/never-touch-2018-2054/'

What i need is the url of the 'real' parent page. so if the event is created as a module of the page 'Exhibitions' i need to return the url of the 'Exhibitions' page and not of the PageTable page ('never-touch).

 

thanks for any tips!

philipp

 

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

  • Recently Browsing   0 members

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