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);
            
/site/modules/PageTableNext/data/ptn.php
/site/templates/fields/[fieldname].php
/site/modules/PageTableNext/templates/ptn-content.php
ptn.php
ptn-content.php
ptn.php