I understand that, in a custom KirbyTag, $tag->parent()
accesses the parent page object, which can be used as a hook to access fields, files, etc.
I am doing a website with a number of running events, each of which has a consistent folder structure. In the course
folder for each I have a table in a structure field.
/race1/course/
/race2/course/
/race3/course/
...
I can access this structure field with $tag->parent()
, which enables me to spit out the data into an HTML table.
I would also like to be able to access that structure field data from an arbitrary page, not just the $tag->parent()
which contains the structure field. Is there a way to access data from an arbitrary page, say /race2/course/example/
? Something along the lines of:
$tagparent = $pages->find(
explode('/',$page->id())[0] .'/'. explode('/',$page->id())[1] . '/course'
);
Thanks,
Keith