PHP code example of nr / pagetablenext

1. Go to this page and download the library: Download nr/pagetablenext library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nr / pagetablenext example snippets


// if your field name is "ptn":
echo $page->render->ptn;

/** @var PageArray $contentElements */
$contentElements = $page->ptn;
$renderIndex = 0;

/** @var Page $contentElement */
foreach($contentElements as $contentElement) {
    echo $page->renderValue(
        $contentElement->set('_myRenderIndex', $renderIndex++),
        'ptn/' . $contentElement->template->name
    );
}

//...
<my-content>
    <template id="content">
        
            $cssFilePath = $ptn->getFileLocation('content.css', 'paths');
            $cssFileUrl = $ptn->getFileLocation('content.css', 'urls');
            $cssFileUrl = $cssFileUrl . '?modified=' . filemtime($cssFilePath);
            

// find the abandoned page ids as array
$abandonedPageIds = $modules->get('PageTableNext')->findAbandonedPageIds();

// OR

// find the abandoned pages as PageArray and delete
$options = [
    'selector' => 'limit=25, sort=-modified, )->pages->delete($p);

/site/modules/PageTableNext/data/ptn.php
/site/templates/fields/[fieldname].php