TYPO3 page x of y

From snippet wiki
Jump to: navigation, search

This generates the current page number in the tree and the total number of siblings.

The html template has the usual markers:

<div id="pagenum">Page ###PAGENUM### of ###PAGECOUNT###</div>

And the typoscript calculates the numbers for every page.

lib.pagenum = CONTENT
lib.pagenum {
  table = pages
  select {
    selectFields = COUNT(*)
    pidInList.data = leveluid:-2
    orderBy = sorting
    andWhere.dataWrap = (hidden=0 AND deleted=0 AND sorting<={page:sorting})
  }
  renderObj = COA
  renderObj {
    10 = TEXT
    10 {
      field = COUNT(*)
      wrap = |
    }
  }
}
 
lib.pagecount = CONTENT
lib.pagecount {
  table = pages
  select {
    selectFields = COUNT(*)
    pidInList.data = leveluid:-2
    andWhere = (hidden=0 AND deleted=0)
  }
  renderObj = COA
  renderObj {
    10 = TEXT
    10 {
      field = COUNT(*)
      wrap = |
    }
  }
}
 
# ...
 
page.10 {
  marks.PAGENUM < lib.pagenum
  marks.PAGECOUNT < lib.pagecount
}

Autoren der Seite / Contributors of the page

» Kai Kretschmann, (google+)