Jump to content

Search the Community

Showing results for tags 'page reference field'.

  • 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

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 11 results

  1. Where I am: Edit Page -> Settings -> Parent -> "+Change". Edit Field -> Page Reference field -> Input tab -> "Selectable pages (Select the parent of the pages that are selectable)" -> "+Change". ... and possibly other locations where the Page Tree is used. Quality of life improvement: When modifying Parent Pages (Edit Page) or Selectable pages (on a Page Reference field) and I press "+Change" to change the Parent Page, it would be nice if the current Parent Page came into focus without effort. Current solution: As an editor, I am required to find the Parent Page / "Page Reference parent page" manually which makes me think ("where did I put that page?"), takes a bit of time ("click, click, click"), and is hard on a larger site with a deep structure. The unmet goals are: I instantly see the context for the current Parent Page. I can effortlessly select another Parent Page. Constraints: Large website makes it hard to navigate and get a view of the Page Tree. I don't want to pick an incorrect Parent Page. It's sometimes difficult to see if I choose the right parent. The Parent Page must be in the current "Page Branch" ("/foo/bar/baz/" -> "/foo/quz/baz/"). I don't always need to see/browse the full Page Tree. Sometimes a lot of parent pages are unnessarily shown (larger websites with 4-5 levels of pages). Better: When I open the Edit Page / Edit Field page and click "+Change", I want the tree structure to expand (in a modal?) and bring the current Parent Page into focus. It's one of those small things that help create a smooth user experience. Additional thoughts: The displayed Page Tree only shows the current Page Branch; this might optionally be specified on the Template. Hide "unneeded" parent pages in a larger websites with 4-5 levels of pages (how?). Perhaps you have additional ideas that might improve working with Parent Pages when editing a page or a field?
  2. 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
  3. 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?
  4. 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!
  5. 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
  6. 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
  7. 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.
  8. 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)
  9. 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(); }
  10. 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
  11. 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...