Jump to content

Omega

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Omega's Achievements

Newbie

Newbie (2/6)

2

Reputation

  1. The module displays this error: I looked into my database and it's true: the required table "pages_paths" doesn't exist there... Any ideas? Page Path History is already installed, the table "page_path_history" exists.
  2. @Robin S sorry, your code didn't work for me, I had to change it that way: // media_pagereference.php <?php namespace ProcessWire; if ($page->pageReference) { $refPage = $page->pageReference; $img = $refPage->getUnformatted('image')->first(); echo $img->url; } Now it's possible to set the configuration of the 'image' field to return a single element instead of an array. A second way next to the workaround I described above and a good opportunity to learn more about output formatting...
  3. I got a solution for my problem described above. I canged the settings for the image field that is allowed to contain just 1 image. Instead of returning a single element it now returns always an array of elements (hope the description is correct in english). Therefor I definitely need to either loop through the returned array (which is way too much, as there is just one image in it). So as szabez pointed out, a short and clean way is to use ->first() @Robin SThank you for your suggestion, you where literally a few moments too late But I'll give it a try!
  4. 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; }
  5. @DV-JF I came across a similar issue. I'm using a page reference field to select several pages containing just 1 image per page. As Ryan describes in this post. I haven't checked for the frontend yet, but in the backend I'm getting the same error. So even though the image field in the referenced pages is set to contain just 1 image, I have to loop through it as if it's a WireArray. I changed your code in way that worked for me: foreach($page->rep_imgTitleBody as $item) { foreach($item->sing_img as $image) { $img = $image->size(600,400)->url; $out = "<img src=\"{$img}\" alt=\"{$item->title}\">"; } }; @MadeMyDay Is this an expected behaviour? I'm using ProcessWire 3.0.77 and PageTableExtended 2.3.3
×
×
  • Create New...