Jump to content
steveooo

Are PageTable nestable?

Recommended Posts

Hello,

I am building a modular layout via PageTables. Are PageTables nestable? E.g. i am using a content field (PageTable) where I insert a template called test. If I use a PageTable in this test template, will everything work?

If this doesn't work, is there an alternative for this?

Share this post


Link to post
Share on other sites

But it may not be the best from an UI standpoint, as they would also nest in terms of modal-windows.

Share this post


Link to post
Share on other sites

I wouldn't do it. Consider using children pages and a page table inside them. I've been having better feedback from editors when creating blocks of content with children than with PageTables

  • Like 1

Share this post


Link to post
Share on other sites

I am trying to get my head round the concept and it makes me feel queasy...

Share this post


Link to post
Share on other sites

It should work. The modal will pop-up within the other modal. You just have to remember which one you're on when you click save :)

I have built a CRM system which uses my AdminPageFieldEditLinks module to make it easy to view selected pages in a page field. This often leads to nested modal windows, so I've increased the default size of the modals to make this work better. It works okay, and though it can get awkward, it is still better than the alternative of having to break your workflow and find/open the page somewhere else.

Edit: It would be nice if when more than one modal was nested, the nested modals would completely overlap and hide the previous, thus reducing the "tunneling" effect and only giving you only one "Save" button at a time to pick from.

Share this post


Link to post
Share on other sites

Ok. I had time to test it and it works. The only downside I see is a usability one: The modal windows for this. Is there a better way to use this? New browser tabs or new windows instead of modals? Would be cool if someone implements this functionality!

Share this post


Link to post
Share on other sites

Just used this on the frontendside...not in the backend UI...

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By louisstephens
      So I ran into a very strange issue today. I have a template with a pagetable and I went to add an item to it, when I went to select an image (for an image field) the page instantly threw up an error
      "ProcessPageSearchLive: No search specified"
      The page's content also switched to the image attached. This all worked perfectly last week (local mamp box). Has anyone experienced this before, and how did you solve it?
       

    • By jploch
      Hey folks,
      I have a question regarding rendering of template files that are in a subfolder of the template folder.
      How would I for example render these PageTable items, when their template files are inside templates/blocks/:
      <div class="grid"> <?php foreach($page->grid_ext as $item): ?> <div id="pteg_<?= $item->id ?>"> <?php echo $item->render(); ?> </div> <?php endforeach; ?> </div> I tried this, but get an error:
      <?php echo $item->render(wire('config')->paths->templates . '/blocks/'); ?>  
    • By tron1000
      Hello! I use PW 3.0.98 and I have frontend editing enabled for a PageTable Field. Somehow, when I double click the field in the frontend, the iframe in wich the content is displayed is very small (see screenshot). I couldn't find out if thats some CSS conflict or another problem. Any suggestions? Thanks, Andrej
       

    • By louisstephens
      Ill be honest, I am a bit unsure how accomplish this. I have a repeater (dev_repeater) that contains an image field set to 1 image. Nested within this repeater, is another repeater (dev_child_repeater) that allows a user to add in some urls. However, there is also a hidden field that I am trying to pass the parent repeater's image path. 
      I know I can output all the data by using:
      <?php foreach($page->dev_repeater as $repeater) { foreach($repeater as $url) { # do some stuff } } ?> For the life of me, I can not figure out how to obtain the image url in my php to pass to a variable inside the nested foreach loop. Hopefully this made some sense.
    • By Noel Boss
      I use a PageTable field to make edits to children of pages more intuitive…
      To register the hooks, insert the following Snippet inside your init function in your module (or add it to your init.php file):
      /** * Initialize the module. * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. */ public function init() { // Prefill pageTable field $this->wire()->addHookBefore('InputfieldPageTable::render', $this, 'addChildrenToPageTableFieldsHook'); $this->wire()->addHookBefore('InputfieldPageTableAjax::checkAjax', $this, 'addChildrenToPageTableFieldsHook'); } Then, add this hook method:
      /** * Fill pagetable fields with children before editing…. * * @param HookEvent $event */ public function addChildrenToPageTableFieldsHook(HookEvent $event) { $field = $event->object; // on ajax, the first hook has no fieldname if (!$field->name) { return; } // get the edited backend page $editID = $this->wire('input')->get->int('id'); if (!$editID && $this->wire('process') instanceof WirePageEditor) { $editID = $this->wire('process')->getPage()->id; } $page = wire('pages')->get($editID); // disable output formating – without this, the ajax request will not populate the field $page->of(false); // you could also insert a check to only do this with sepcific field names… // $page->set($field->name, $page->children('template=DesiredTemplate')); // just specific templates $page->set($field->name, $page->children); } Now whenever there is a page-table field on your page, it gets populated with the children
×
×
  • Create New...