$page
The $page
object is the heart and soul of Kirby. It is used to construct pages and all their dependencies like children, files, content, etc.
- $page->audio()
- $page->blueprint()
- $page->blueprints()
- $page->changeNum()
- $page->changeSlug()
- $page->changeSort()
- $page->changeStatus()
- $page->changeTemplate()
- $page->changeTitle()
- $page->children()
- $page->childrenAndDrafts()
- $page->clone()
- $page->code()
- $page->content()
- $page->copy()
- $page->createChild()
- $page->createFile()
- $page->createNum()
- $page->decrement()
- $page->delete()
- $page->depth()
- $page->dirname()
- $page->diruri()
- $page->documents()
- $page->draft()
- $page->drafts()
- $page->duplicate()
- $page->errors()
- $page->exists()
- $page->file()
- $page->files()
- $page->find()
- $page->findPageOrDraft()
- $page->go()
- $page->grandChildren()
- $page->hardcopy()
- $page->hasAudio()
- $page->hasChildren()
- $page->hasCode()
- $page->hasDocuments()
- $page->hasDrafts()
- $page->hasFiles()
- $page->hasImages()
- $page->hasListedChildren()
- $page->hasNext()
- $page->hasNextListed()
- $page->hasNextUnlisted()
- $page->hasPrev()
- $page->hasPrevListed()
- $page->hasPrevUnlisted()
- $page->hasTemplate()
- $page->hasUnlistedChildren()
- $page->hasVideos()
- $page->id()
- $page->image()
- $page->images()
- $page->increment()
- $page->index()
- $page->indexOf()
- $page->intendedTemplate()
- $page->is()
- $page->isAccessible()
- $page->isActive()
- $page->isAncestorOf()
- $page->isCacheable()
- $page->isChildOf()
- $page->isDescendantOf()
- $page->isDescendantOfActive()
- $page->isDraft()
- $page->isErrorPage()
- $page->isFirst()
- $page->isHomeOrErrorPage()
- $page->isHomePage()
- $page->isLast()
- $page->isListable()
- $page->isListed()
- $page->isLocked()
- $page->isMovableTo()
- $page->isNth()
- $page->isOpen()
- $page->isPublished()
- $page->isReadable()
- $page->isSortable()
- $page->isUnlisted()
- $page->isValid()
- $page->kirby()
- $page->lock()
- $page->modified()
- $page->move()
- $page->next()
- $page->nextAll()
- $page->nextListed()
- $page->nextUnlisted()
- $page->num()
- $page->panel()
- $page->parent()
- $page->parents()
- $page->permalink()
- $page->permissions()
- $page->prev()
- $page->prevAll()
- $page->prevListed()
- $page->prevUnlisted()
- $page->publish()
- $page->purge()
- $page->render()
- $page->root()
- $page->search()
- $page->siblings()
- $page->site()
- $page->slug()
- $page->status()
- $page->template()
- $page->templateSiblings()
- $page->title()
- $page->toArray()
- $page->toSafeString()
- $page->toString()
- $page->translation()
- $page->translations()
- $page->uid()
- $page->unpublish()
- $page->update()
- $page->uri()
- $page->url()
- $page->uuid()
- $page->videos()
- new Page()
- Page::create()
You can extend this set of methods with custom page methods or in a page model.
How to fetch the $page
object
The $page
class is available in Kirby's templates/snippets etc. through the $page
variable that - unless otherwise defined – always refers to the current page. However, you can also define a $page
object by calling a specific page using the page()
helper:
Or getting it from a collection of pages
When getting a specific page via the page()
helper or when trying to create a page object from field values stored in content, always verify that you have a page object before you call any of the Page methods.
Content fields
The $page
class offers a magic caller for your content fields. Instead of getting them via e.g.
you can use the shorthand
You can not use the shorthand for fields with names that conflict with the default methods of the $page
class (see above) or used by custom page methods.
Examples
With the $page
object defined, you can start using the methods of the class: