Jump to content

Search the Community

Showing results for tags 'page reference field'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 10 results

  1. Hi! 😄 SITE SETUP / DESCRIPTION: What? Online art magazine with an "All featured works" and also an "All featured artists" index page, and also individual "Work" and "Artists" pages, and data relations between the different artists and their artworks. So, I have two different page reference fields, connected by @Robin S's awesome Connect Page Fields module (though that has nothing to do with the issue in fact, Robin's plugin works great! and the issue is the same with or without it). The two Page Reference type fields are called "works" and "artists". They are meant to simply connect different artists to different artworks. Fx: Work 1 (page) –> artists (Page Reference field) : Artist A (page) --->>> (automatically connected) Artist A (page) –> works (Page Reference field) : Work 1 (page) Work 2 (page) –> artists (Page Reference field) : Artist B (page) --->>> (automatically connected) Artist B (page) –> works (Page Reference field) : Work 2 (page) ISSUE: On both Page Reference fields, both on "artists" and on "works" this option "Allow unpublished pages" is activated: As it says in the option description, supposedly, unpublished pages should be selectable in the page reference field, but they should not be visible, they shouldn't appear, on the front-end... Frontend: To show all works related to the artist on the artist individual page I'm doing this: <?php foreach($page->works as $item) { echo "<img src='{$item->image->first->width(200)->url}' class='pr-2'><a class='pr-4' href='$item->url'>$item->title</a>"; } The problem is now, unexpectedly, if some work is set to "Unpublished", it shows up anyways! WORKAROUND: So to get around this I figured out that I can do this: <?php foreach($page->works as $item) { if($item->is(Page::statusUnpublished)) { return; }; echo "<img src='{$item->image->first->width(200)->url}' class='pr-2'><a class='pr-4' href='$item->url'>$item->title</a>"; } But ofc this is a rather inelegant "solution" which shouldn't really be necessary, right? I might be missing something basic here, but really can't figure out what it is... I hope one of you awesome guys can help me out 😊 Thanks a lot in advance! All the best, Jonatan
  2. Hello there, and thanks for ProcessWire! I'm getting to know ProcessWire while doing my first project using it and I really like it so far. The challenge I'm facing right now is the following: I have a One-Pager using fullpage.js, realized as a single PW-Page containing a Repeater Field where each Repeater Item is one Section. Some Sections are supposed to have a little menu at the Top which references/links to different Sections of the Website, so I wanted to use a Checkbox Field "Top Menu" to decide if a Section gets a Menu and a Page Reference Field to choose the different Sections (Repeater Items) it should contain. I've already accomplished this by pasting the following code into /site/ready.php: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'top_menu_entries') { $page = $event->arguments('page'); if($page instanceof RepeaterPage) $page = $page->getForPage(); $event->return = $page->; } }); The only problem that still remains is that when I select the Entry of the Repeater Item itself it doesnt save the selection, meaning after I saved it's unselected again. On some Sections I do want a Menu-Entry for the Section itself though (which would be styled differently and not link anywhere) for Continuity-Reasons, any ideas on how to achieve that?
  3. Hello everyone, Is there a way to access the key number of an item in a page reference field and then output it as a value? So for example I want to automatically output the number 1 if the referenced page is the first in the list and have it be updated when the list is reordered via drag and drop. Thanks in advance!
  4. Hi, I need a selector to find pages that are using the template "poi" and that are having a page reference to a page with the title "Zoo". The page reference field is called poi_type. How would I do this? I tried this: $poi = $pages->find(template=poi, poi_type.title='Zoo'); But it doesnt work because there is no field poi_type.title. /Jasper
  5. Hi everybody! I'm new to PW and just did the beginner-tutorial “Hello Worlds”, a beginning ProcessWire tutorial --> Link After extending the template from the original tutorial with a page_reference-Field (Page-Field value type is configured as single page), PW throws a fatal error when i try to output multiple pages: $planets = $pages->find("template=planet, sort=-title"); foreach($planets as $planet) { echo $planet->title; echo $planet->planet_reference->title; } Should return three Pages, but throws the following error: When i try to output the field with a single page, everything just works fine: $planet = $pages->get(1018); echo $planet->title; echo $planet->planet_reference->title; I've tried to solve the problem with myself (and google), but i can't fix the error. Thanks a lot! My enviroment: OSX Mojave / MAMP (PHP 7.2), PW v 3.0.123
  6. Hi, I'm working on a website where in the back-end in one template i have multiple page reference fields using the same conditions (parent and template). Is there a way if i selected a page in field A it won't show up anymore in the list of field B or field C etc? I was looking at creating a custom string but i couldn't wrap my head around it.
  7. Is it somehow possible to limit the number of pages one can select with the page reference field? I have a case where I need to have exactly three, not more, not less. Is this doable with a hook? Or would you suggest another approach? (three single pageref fields and make each mandatory)
  8. Good afternoon, I am attempting to loop through approximately 600 XML nodes. Each of those nodes has 2 child nodes (example below). One is an id for an existing page and the other contains values for a page reference field. I have put together a loop (below as well) to attempt to save each page with the label values. This all works....once. After getting the first XML node "label" saved to the correct page, nothing else is saved. I'm sure there is probably something that I have overlooked. But, I am also very new to this CMS. I'm hoping there is a veteran user who may be able to point me in the right direction. <row> <id>1041</id> <labels>lifestyle|savings</labels> </row> foreach ($xml->row as $items) { //get page id to update and set output formatting to false $blog_page = $pages->get('id='.$items->id); $blog_page->of(false); //create array from pipe separated label values $labelsArray = explode('|', $items->labels); //loop through array to get page ids by page name $labelIDS = array(); foreach ($labelsArray as $labelValue) { $labelPage = $pages->get('name='.$labelValue); array_push($labelIDS, $labelPage->id); } //add labels to label field in post $blog_page->labels = $labelIDS; //save page $blog_page->save(); }
  9. Good Day. I have created a repeater field on a website that I am building. Three of the fields within the repeater uses page reference fields (I hope that's the correct terminology). Everything works fine, except that I cannot get those three fields to display the Title and not the page IDs. I've tried different syntax, however I cannot seem to get this to work. I used a repeater template (repeater_sd_note.php file), as Ryan had mentioned. This works great. I have included these screenshots, that will hopefully help someone to guide me in the right direction. Screenshot 1 - A portion of what the web display looks like. Screenshot 2 - A portion of what the backend display looks like of the Screenshot 1 web page. Screenshot 3 - The sd_note repeater field contents. Screenshot 4 - The template file used on the web page. Screenshot 5 - A portion of the Zurb Foundation _main.php file that covers the rendering of the repeater. Screenshot 6 - The contents of the repeater_sd_note.php file. I have read quite a few forum articles and website documentation on repeaters, however I didn't find anything that I thought covered this subject. I apologize if a solution to this can be easily found. I worked on this for two days already. Thanks in advance. Using ProcessWire 2.4.1
  10. Hi, I must be missing something very basic here. I have the following code: $ref_page_id = $page->ref_page; $ref_page_title = $pages->get($ref_page_id)->title; But for some (probably a very good one) reason it doesn't work. In text: On the current page I have a Page reference fied called ref_page. When I echo $ref_page_id after the first line, it contains the page id of the reference page. So far so good. But the second line doesn't produce the correct result. $ref_page_title says Home. It works when I write the page id manually, like: $ref_page_title = $pages->get(1243)->title; What am I missing? /Jasper Edit: it does work when I add a second page to the page reference field.
×
×
  • Create New...