Jump to content

Neue Rituale
 Share

Recommended Posts

The module provides a list of PageTable based content elements. It enables the backend user to easily create, publish, move, delete, copy and paste content elements.

The rendering logic of the module is detached from the ProcessWire backend scope via Shadow DOM and allows the elements rendering identical to the front end. It ships with some helper functions that simplify the handling of content elements.

Download/Install
Github: https://github.com/neuerituale/PageTableNext
Module directory: https://processwire.com/modules/page-table-next/
Composer: composer require nr/pagetablenext

  • Like 14
Link to comment
Share on other sites

  • 3 weeks later...
  • 8 months later...
  • 8 months later...
  • 1 month later...

Hello @Neue Rituale,

I’m exploring your module possibilities. It seems very useful.
I can’t figure out something though. I’m sure it’s very simple.
Let say I have a ptn field in my homepage. I defined a template (named "section") to be used with this ptn field as an element.

In the php template file of this section, how can I display the section title ? If I write $page->title, I get "Home" (so the title of the page where the ptn field lives), instead of the section title itself.
Said in another way, the $page variable is not scoped to the element template. It’s always scoped to the page template. So how can I catch the field value of the element templates?

Any help would be greatly appreciated.

Thanks
 

PS: for custom CSS, it seems that, because of the shadow DOM, the CSS custom properties like --bg-color scooped in the root of the page are not defined when used in the shadow DOM.

Edited by TomPich
Added a PS
Link to comment
Share on other sites

Hello @TomPich,

if I have understood correctly, you are looking for $value.
$page is the page on which the sections are created, $value is the section page (@see ___renderValueWrapper() ).

The :root properties in css must also be defined in :host for the shadow dom.

:root, :host {
	--color-white: #fff;
	--color-light: #F5F5F5;
	--color-gray-light: #EEEEEE;
	--color-silver: silver;
}

 

  • Thanks 1
Link to comment
Share on other sites

  • 9 months later...

I'm testing this module to see what it can do; I haven't before used PageTable in any way prior.

I used the image in the module's directory entry as an example of how to configure the naming of things, so I created the default field of "ptn" from the module config, then created a PHP template file (in the root template directory - I wasn't originally clear on where it needed to go) with a filename of "ce-header.php" (with fields "title" and "number_01" which would be used to denote the heading level such as h1, h2, etc.); I created a template within PW with the same name.

Upon loading the field to add the content element (page) template, it said it couldn't find the template, but told me where the file should be placed.  So that structure is now as shown below:

image.png.1113609605f521fb9e3ed208b7550c06.png

When trying to use the field template, I was uncertain of how to go about referring to the properties (fields) held within the PW template in the PHP field PTN template file. I ultimately discovered that I could access it via the following ... but is that the correct way?

<h<?=$page->ptn->['ce-header'}->number_01 ?>><?= $page->ptn->{'ce-header']->title ?></h1>

PHP property names with hyphens have to be escaped with the syntax as shown above ( {'property-name'} ) but that's due to using the image as shown on the module description page as an example; this could easily be changed on my end. But is that truly the way I should be referring to the property in the PHP field template file?

Link to comment
Share on other sites

  • 4 weeks later...

Hey @BrendonKoz, sorry for the late answer. You can access the data in the template file with $value.

$page // is the context page on which you create the content elements.
$value // is the data of the content element

I actually only use $page->renderValue($contentElement, 'file/to/content-element-file') to render the content element;

  • Like 1
Link to comment
Share on other sites

Version 2.0.4

  • Find abandoned pages (Check all pages in the ptn store to see whether they are still linked to a ptn field.)
  • Support for SearchEngine (Marks the field as Repeatable, thank you @teppo)
  • Add hookable title postfix

Version 2.0.5

  • Optimize Error Handling for content elements
  • Fix issue #5
  • Like 2
Link to comment
Share on other sites

Thanks for this great module.
I'd like to use it for an upcoming website but haven't totally wrapped my head around the instructions.
Any chance you could provide a tutorial beyond the existing documentation ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...