I still have a problem with the output of PageTableExtended (PTE) in the backend. I took some screenshots to demonstrate it.
My configuration looks like this: In my PageTableExtended field I have a template containing a PageReference field. That reference field allows only one reference. The pages I then reference to contain just one image per page. That way I can reuse images on different pages. But also, with just one page allowed per reference field, I have the ability to reorder the images on my page in a visual manner. Mainly that for I have PTE in use.
The empty PTE field in the backend looks like this:
In the backend I add an image by clicking on the +Image button, respectively I create a new page with a template containing a page reference field. The modal window opens and I reference a page with an image named "sample-image". Then I hit save and the modal window closes. The PTE field now looks like this:
The template of the reference field in the PTE echoes the url of the image in the referenced page. Just as I would do to display the image, but for demonstrating purposes without the surrounding <img> tags.
Pause for a moment. Right now everything is as expected. BUT...
Now to the strange behaviour of PTE: After I hit Save on my actual page, where the PTE field lives in, I get this:
As you can see, the url of the referenced image is incomplete, the [name].[ext] part is missing. So it's not possible to display the image in the backend!
But on the frontend everything is fine:
@MadeMyDay Is this behaviour expected?
Has someone the same problems? Can anybody suggest a solution?
Thanks in advance!
Below are my .php files for the basic-page containing the PTE field and the subtemplate for the media_pagereference.
// basic-page.php
<?php namespace ProcessWire;
$out = "";
if (count($page->pageTableExtended)) {
foreach ($page->pageTableExtended as $pte) {
$out .= $pte->render();
}
}
?>
<main data-pw-id="main" class="main">
<?php echo $out; ?>
</main>
// media_pagereference.php
<?php namespace ProcessWire;
if ($page->pageReference) {
$refPage = $page->pageReference;
$img = $refPage->image;
echo $img->url;
}