Light-weight, fast, simple and powerful!
Translations of this page?:


The childrenCount() function returns a count of how many child pages belong to the current page. A simple echo $this->childrenCount(); will return the number of “published” pages to the current page.1)

childrenCount() can be useful, then, for determining when to include navigation, for example:

<?php if ($this->childrenCount() > 0) {
  // if count is > 0, there are child pages, so do stuff
  } else {
  // no child pages, so do something else

It takes the same parameters as the children() function; see the documentation there for details.

1) See the children() function documentation for how to include “hidden” pages.
functions/childrencount.txt · Last modified: 2011-09-12 00:46 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 / design by yello studio / Wolf CMS Inside