Page Object

Page Object

Page Object Structure

Using dot notation page_o is the page object and within the page object are collections and entities representing the data for the page.

page_o.article:=New article entity object
page_o.articles:=New collection of article entities
page_o.category:=New category entity object
page_o.categories:=New collection of category entities
page_o.menu:=New current menu object
page_o.modules:=New collection of module entities
page_o.pagination:=New pagination object
page_o.paginate:=Boolean (True = include pagination)
page_o.tag:=New tag entity object
page_o.tags:=New collection of tag entities

Single Article Object Example

Any data within the page_o.article object can be referenced in an hmtl page as follows:

<!--#4DHTML page_o.article.fulltext--> Returns the html content of the article

 
List Articles Collection Example 

Any data within the page_o.articles collection can be referenced using and 4DEACH statement in an html page as follows:

<!--#4DEACH $post in page_o.articles--> Each post in the page_o.articles collection
<h2 class="post-title h3 mt-1 mb-3"><a class="link-dark"
    href="/<!--#4DTEXT $post.filepath-->"> The relative url
    <!--#4DTEXT $post.title--></a></h2>
<div class="post-content">
<!--#4DHTML $post.introtext--> Equivalent to page_o.article.introtext
</div>
<!--#4DENDEACH-->



Pagination Example

The page_o.pagination object is built for each list type page if the number of articles, categories or tags is greater then the list length defined by the list source usually the menu or module. 

<!-- Pagination -->
<!--#4DIF (page_o.paginate)--> Boolean True if length of page_o.articles > the list length param.
<nav class="navigation pagination" role="navigation" aria-label="Posts">
    <h2 class="screen-reader-text">Posts navigation</h2>
    <div class="nav-links"><a class="prev page-numbers" href="<!--#4DHTML page_o.pagination.startpath-->"><i
                class="fa fa-angle-double-left"></i></a>
        <a class="page-numbers" href="<!--#4DHTML page_o.pagination.startpath-->">
            <!--#4DHTML page_o.pagination.start--></a>
        <span class="page-numbers dots">&hellip;</span>
        <a class="page-numbers" href="<!--#4DHTML page_o.pagination.previouspath-->">
            <!--#4DHTML page_o.pagination.previous--></a>
        <span aria-current="page" class="page-numbers current">
            <!--#4DHTML page_o.pagination.current--></span>
        <a class="page-numbers" href="<!--#4DHTML page_o.pagination.nextpath-->">
            <!--#4DHTML page_o.pagination.next--></a>
        <a class="next page-numbers" href="<!--#4DHTML page_o.pagination.nextpath-->"><i
                class="fa fa-angle-double-right"></i></a></div>
</nav> <!-- Pagination -->
<!--#4DENDIF-->