# Call page model in panel field

**URL:** <https://forum.getkirby.com/t/call-page-model-in-panel-field/7179>\
**Category:** Questions\
**Tags:** v2\
**Created:** [April 7, 2017, 11:00am UTC](https://forum.getkirby.com/t/call-page-model-in-panel-field/7179 "2017-04-07T11:00:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![bnomei](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bnomei/32/775_2.png) [@bnomei](https://forum.getkirby.com/u/bnomei)\
**Post date:** [April 7, 2017, 2:01pm UTC](https://forum.getkirby.com/t/call-page-model-in-panel-field/7179/3 "2017-04-07T14:01:43Z")

</div>

maybe the master of plugins @jenstornell might find this interesting…

```
// inside field code...

$page = $this->page();
$pageWithModel = null;
if(count(Page::$models) == 0) {
	// load only once even if field is called more often
	kirby()->models();
}
// if model exists
$cname = str::lower($page->template().'Page');
if(a::get(Page::$models, $page->template()) == $cname) {
	$pageWithModel = new $cname($page->parent(), $page->dirname());
}
// now do something with $pageWithModel that can not be done with $page
```

---

_[View the full topic](https://forum.getkirby.com/t/call-page-model-in-panel-field/7179)._
