Search the Community
Showing results for tags 'Page Reference'.
-
Thanks to @Macrura for the idea behind this module. Page Field Info Adds information about options in Page Reference fields. Supports InputfieldSelect and inputfields that extend InputfieldSelect: InputfieldSelect InputfieldRadios InputfieldSelectMultiple InputfieldCheckboxes InputfieldAsmSelect Requires ProcessWire >= 3.0.61 and AdminThemeUikit. Screenshots Field config Example of changes to inputfield Example of info field filled out in Page Edit Installation Install the Page Field Info module. Configuration In the Input tab of the settings for a Page Reference field... Tick the "Add info tooltips to options" checkbox to enable tooltips for the options in the field. Tooltips are not possible for Select or AsmSelect inputfield types so for those types you would want to tick the next option. Tick the "Append info about selected options" checkbox to append information about the selected options to the bottom of the inputfield. If the Page Reference field is a "multiple pages" field then the info for each selected option will be prefixed with the option label (so the user will know what option each line of info relates to). In the "Info field" dropdown select a text field that will contain information about the page, to be used in the tooltips and appended info. Of course this field should be in the template(s) of the selectable pages for the Page Reference field. Hook In most cases the "Info field" will supply the text for the tooltips and appended info, but for advanced usages you can hookPageFieldInfo::getPageInfo() to return the text. For example: $wire->addHookAfter('PageFieldInfo::getPageInfo', function(HookEvent $event) { $page = $event->arguments(0); // The page $inputfield = $event->arguments(1); // InputfieldPage $field = $event->arguments(2); // The Page Reference field $info = $event->return; // Text from the info field, if any // Set some custom text as the $event->return... }); https://github.com/Toutouwai/PageFieldInfo https://modules.processwire.com/modules/page-field-info/
- 11 replies
-
- 15
-
Hello, This is my first post here, I've been using processwire for a while now and having a great time with it! Quick question regarding the Pages field: I am using a multiple-select pages field on the User template, so that a dealer can be associated with each user of certain roles. This works flawlessly without any conditions being set, but if I set 'Show this field only if' to roles=dealer|dealer-admin the field shows and hides as desired, but revert to null when saved. Is there anything I'm missing here? Thanks, Tom
- 9 replies
-
- page reference
- show if
-
(and 1 more)
Tagged with:
-
I want to select the first option in a page reference fieldtype when adding a new page (admin). Dont want to target the option id because the value may change. Field = booking_searchactivator_option Template = booking Page reference template = searchactivator My current code is only targeting the page id and not the value. So now it becomes id=1. Also i want to be able to change the value to the second value, third value / position in the dropdown. $wire->addHookAfter('Pages::added', function(HookEvent $event) { $page = $event->arguments(0); if (!$page->matches('template=booking')) return; $aktivator = 1; $page->setAndSave('booking_searchactivator_option', $aktivator); }); i also have another hook that removes already selected page references. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { $page = $event->arguments(0); if($event->object->hasField == 'booking_searchactivator_option') { $pages = $event->wire()->pages; $already_selected_on_another_page = $pages->find("template=searchactivator, booking_searchactivator_option.owner.template=booking, booking_searchactivator_option.owner.id!=$page->id"); $event->return = $event->pages->find("template=searchactivator, sort=sort, id!=$already_selected_on_another_page"); } }); Please help!!
-
I have a couple of pages that has a specific template. In the template i have a page reference field (Activator). What im trying to achive is when i select an option in the dropdown (Activator) in admin and save, then the specific option is disabled (greyed out) in all of the other pages that has the page reference field (Activator). So basically you can only select one specific option once. But when i unselect the same one i want it to be reset and can be selected again in other pages. Please help!
- 3 replies
-
- select options
- hooks
-
(and 1 more)
Tagged with:
-
Hello, I'm getting stuck trying to build a filter between subcategories and some items. For the final Item itself, I setup a reference field and wrote following selector: If there are more entries, filtering by manufacturer (which is part of the item) would be very helpful. The problem I'm stuck: How I can get and select an existing manufacturer field, which exist here: fieldset_device.manufactor I tried a hook, just not happy with the result, I despair on: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { $page = $event->arguments('page'); if($event->object->hasField == 'hardware_manfilter') { $subcat = $page->hardware_subcategory; $items = $event->pages->find("parent=$subcat"); $event->return = $items->each('fieldset_device.manufactor'); } });I I appreciate any help.
- 2 replies
-
- dynamic
- page reference
-
(and 1 more)
Tagged with:
-
How to check if each page reference checkbox is checked?
SwimToWin posted a topic in General Support
It's incredible what you can do with ProcessWire. I did hit a limitation on my side though... ? and would like to ask for some support: Problem: I'm using a Page Reference Checkboxes field that gets it's Options from a few Pages; Page field value type is set to "Multiple pages PageArray". Screenshot: What I want: to check if each checkbox is checked or not (without using a foreach loop). What I tried: var_dump( $page->config->has(1898)); var_dump( $page->config->getValues()); // (WireArray is output, I don't know how to use that.) var_dump( $page->config->getValues(1898)->id ); // Warning: Attempt to read property "id" on array var_dump( $page->config->get(1898) ); // NULL var_dump( $page->config->get(1898)->id ); // Warning: Attempt to read property "id" on null var_dump( $page->config->first()->id ); // int(1898) ... better, but how to get the next value? var_dump( $page->config[1898] ); // bool(false) var_dump( $page->config->find(1898) ); var_dump( $page->config->find(1898)->id ); var_dump( $page->config(1898) ); NULL (checkbox is set) var_dump( $page->config->1898 ); // unexpected integer "1898", expecting identifier or variable or "{" or "$" var_dump( $page->config->find(1898)->id ); // Fatal Error: Uncaught Error: Call to a member function find() on null var_dump( $page->config->has(1898)); // Fatal Error: Uncaught Error: Call to a member function has() on null $a = $page->config->getValues(); echo isset($a->1898->id) ? 1 : 0; $a = $page->config->getValues(); echo isset($a->1898->id) ? 1 : 0; // Parse Error: syntax error, unexpected integer "1898", expecting identifier or variable or "{" or "$" echo isset($a[1898]->id) ? 1 : 0; // 0 (but checkbox is set?) echo isset($a[1898]['id']) ? 1 : 0; // 0 (but checkbox is set?) var_dump( $page->config->eq('foo')->id ); // int(1898) var_dump( $page->config->eq('foo') ); // wirearray var_dump( $page->config->has('foo')); // bool(true) // Is this a bug? eq() returns same Page ID for two names. echo $page->config->eq('foo'); // 1898 (correct) echo $page->config->eq('bar'); // 1898 (incorrect, the ID is 1899. ... and thanks for always being a helpful, constructive, and knowledgeable community! Make a great day! ?- 3 replies
-
- checkboxes
- page reference
-
(and 2 more)
Tagged with:
-
Select Once Per Table Adds a setting to "Select", "Page (Select)" and "Page (Autocomplete Single)" columns in a ProFields Table field so that each option can only be selected once per table. Requires the ProFields Table module. There could be a number of situations where this module might be useful, but perhaps the primary situation is when you want to store extra information for pages that are selected in a Page Reference field. So instead of using a Page Reference field like this... ...you could use a ProFields Table field together with Select Once Per Table to store extra information for each selected page like this... The module ensures that pages/options that are already selected in the Table field are disabled as you add new rows or edit existing rows. Configuration To enable the module for any "Select", "Page (Select)" or "Page (Autocomplete Single)" column in your Table field, edit the column settings and add selectOnce=1. https://github.com/Toutouwai/SelectOncePerTable https://processwire.com/modules/select-once-per-table/
- 15 replies
-
- 11
-
- module
- extra information
-
(and 3 more)
Tagged with:
-
I have a template for courses for a website on training. Within the template I use a multiselect page reference field to define attributes associated with the course. While rendering the page I want search for a combination of attributes -in the multiselect page reference field - presence and absence of some of them -- and perform an operation accordingly. How do I search for a combination of values in the multiselect page reference field? Thanks. Here is the pseudo code: if ($page->pageReferenceField->has("title=one|two") && $page->pageReferenceField->doesnothave("title=three")) { echo ...; }
-
Page Reference Default Value Most ProcessWire core inputfield types that can be used with a Page Reference field support a "Default value" setting. This module extends support for default values to the following core inputfield types: Page List Select Page List Select Multiple Page Autocomplete (single and multiple) Seeing as these inputfield types only support the selection of pages a Page List Select / Page List Select Multiple is used for defining the default value instead of the Text / Textarea field used by the core for other inputfield types. This makes defining a default value a bit more user-friendly. Note that as per the core "Default value" setting, the Page Reference field must be set to "required" in order for the default value to be used. Screenshot https://github.com/Toutouwai/PageReferenceDefaultValue https://modules.processwire.com/modules/page-reference-default-value/
- 1 reply
-
- 12
-
- page autocomplete
- page list select
-
(and 3 more)
Tagged with:
-
Hi Everyone, I wish to display a gallery of images from multiple pages on the site. These images have custom fields created through page reference called 'furniture_list_type'. Each image now has a radio button which has been selected. In the example code below all images appear from the "gallery20", however the selector "gallery20.furniture_list_type=3390" does not have any effect. "3390" is the id of the page reference "chair" selected through the page reference. I wish only images selected as chair to show. Hope someone can help with this. Thanks, Calum $imagePages = $pages->find("template=makers-child, gallery20.furniture_list_type=3390") ; foreach($imagePages as $p) { echo "<ul>"; foreach($p->gallery20 as $image) { echo "<li><img src='{$image->url}'>{$image->furniture_list_type}</li>"; } echo "</ul>"; }
- 2 replies
-
- images
- custom fields
-
(and 2 more)
Tagged with:
-
Hello, i must count products per category like so: category 1 (4 products) --category 1.1 (2 products) ----category 1.1.1 (1 product) and so on. category 1 --category 1.1 ----category 1.1.1 ----category 1.1.2 ----category 1.1.3 --category 1.2 ----category 1.2.1 ----category 1.2.2 ----category 1.2.3 produkts have page references for the categories: product 1 -- page reference->category 1.1.1 -- page reference->category 1.1.3 -- page reference->category 1.2.2 -- page reference->category 1.2.3 what is the best way to do this, i have many categories and many many products. Thank you.
-
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
- 11 replies
-
- unpublished
- page reference field
-
(and 1 more)
Tagged with:
-
categories Page Reference field to supply select options on front
jds43 posted a topic in General Support
Hello, I'm trying to list the categories, on the front through select options, that have been selected by page reference field (multiple pages PageArray) on the child pages. Things to Do (would only display three, six, seven, nine in select) -thing one (-category three, -category nine) -thing two (-category six, -category seven) Lodging (would only display one, two, three, four in select) -lodging one (-category one, -category two) -lodging two (-category three, -category four) Dining (would only display five, six, seven, eight in select) -dining one (-category five, -category six) -dining two (-category seven, -category eight) Categories(hidden page) -category one -category two -category there -category four -category five -category six -category seven -category eight -category nine -category ten $categories = $pages->find(1129)->children('include=hidden'); foreach($categories->references('category') as $ref) { echo $ref->title; } This selector isn't working, but it seems 'references' would be helpful. I've never used it before, so I'm not sure how to employ for this. https://processwire.com/blog/posts/processwire-3.0.107-core-updates/#page-gt-references -
Hi, Everyone! I'm currently working on a page reference field and set it for multiple pages (AsmSelect) for the input. Is there a way for me to add an image field (aka Avatar) and the title of page in the radio button? I used the field name enclosed in the { }. Didn't work. It appeared a text instead. Thanks in advance and hope to hear from you soon!
-
Hi, can you guys help a beginner with a problem.. On my template (profile_page) i have a dropdown (page reference) where i can choose a sports team (team_page) that is related to that profile which is also its parent. Then on my Competition1 page (competition_page) I have page reference field (profiles) a dropdown that i want to display only profiles that has choose a specific sports team (template=team_page) the page parent to be specific. Structure/Template Sports_team1 (team_page) Profile1 (profile_page) Profile2 (profile_page) Profile3 (profile_page) Competition1 (competition_page) ready.php <?php $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'profiles') { $relative = $page->parent->name; $event->return = $event->pages->find("template=profile_page, sports_team=$relative"); } }); ?> This returns with no results in the dropdown. If i remove sports_team=$relative then it displays all profiles that have profile_page as template, so it works almost. But i will have more sports teams so this is just an example. I only want to display the profiles that has choosen the parent team on there profile page in admin not front end. I hope i was able to explain it so you guys can understand a little bit. Need some help please! /Thanks
-
Question to professionals) I use the "Page Reference" field (name = categories, types = multiple, asm-select) and checkbox field (name = notify_user). When editing the page, I need to check if: - (categories) values has changed (deselected one or more current pages), make (notify_user) required. - (categories) values has changed (selected one or more new pages), make (notify_user) required. - (categories) values don't change, then the (notify_user) is not required. I tried to make a condition, required if: 1. "categories!=1020|1490" - does not work. 2. "categories!=1020|1490, categories.count != 2" - does not work. 3. "categories%=1020|1490 - js error. Please advise how best to solve this problem.
-
This is the first collaborative project that my wife and myself have worked together on. The goal was simple --- Create a public online experience that showed off the "Custom Artisan" jewelry that she has made for years. https://yellowrosecreations.biz The website is built around an e-commerce platform. Through ongoing work with a new client of mine, I had gotten to know about Ecwid as an e-commerce solution that was tied in closely in with Square (a financial services, merchant services aggregator and mobile payment company). My work with Ecwid for the past few months afforded me with the opportunity to get this web project up and online in no time. Let me be clear, while this e-commerce solution works fine, our long term goal is to use Padloper for the online store. That long term goal is more about controlling where our data resides and being able to freely enhance the total shopping experience. I already know that a solution based on ProcessWire will give us the ultimate e-commerce flexibility. The great thing about the ProcessWire platform is that there are numerous tools that enable you to get things done. To my delight, I discovered that using the Hanna Code module allowed me to easily integrate Ecwid (which actually means e-commerce widget) code into a ProcessWire website. I will write a separate article about how that works at a later time. The website makes use of the UnSemantic Responsive CSS grid with Zurb Foundation components added/mixed in. This is an unconventional combination to use, but it works for us. On the ProcessWire side, there were a few critical modules that contributed to gettng this website online: TextformatterHannaCode ProcessDatabaseBackups CronjobDatabaseBackup AdminLinksInFrontend ProCache FormBuilder PrevNextTabs WireMailSmtp ImportPagesCSV ProcessEmailToPage MarkupProcesswirePhotoswipe Hanna Code snippets were used throughout to populate the Ecwid Online Shopping Bag, the Ecwid Main Online Store, different Ecwid Product Category Listings, the green Foundation Buttons in the website sidebar and some other webiste features. ProcessWire Page Table and Page Reference fields were instrumental in generating the product descriptions that are used on the Ecwid Online Store. Each jewelry item has it's own page within ProcessWire that can be later used with the Padloper e-commerce solution. On the backend side, we were able to create a repository page that keeps track of each product, SKU, pricing and their current disposition status related to the Online Store. This has been a fun and fascinating project to work on. It took us a few weeks to get everything worked out. As I have said before, ProcessWire makes projects of this type possible because you are not limited by the front-end framework you can use. Even when there are not dedicated modules to incorporate a feature that you like, this platform and it's openness allows you to do things that are impossible to do on other systems. It just takes a little ingenuity, planning and time on your part to make things work.
- 4 replies
-
- 12
-
- online e-commerce
- page table
-
(and 2 more)
Tagged with:
-
It's a bilingual site. There are two pages: "Artists" and "Events" each with a "Page Reference" field connecting each other. - Artists has a field where one can choose events available. - Events has a field where you can either choose artists available or create new ones. The problems: - When I create an "Artist" page and select events from the list, it doesn't update the collection of participating artists on the "Event" page. - When I create an artist from the "Event" page. The field 'artist page > settings > language' is not "Active" for the second language. When the artist page is created manually,"Active" is on by default. I know this all have to do with hooks, but I'm don't fully understand the logics.
-
Going through my long quest to get better with ajax and utilizing the api, I have hit yet another roadblock. I currently have a form with an image field (thanks to flydev for getting that sorted), "title" text input, and a select field set to multiple. In my ajax call, I added in: tags = $("#select-tags").val(); form_data.append('tags', tags); $.ajax({ type: 'POST', data: form_data, contentType: false, processData: false, url: '/ajax/upload-preview/', success: function(data) { console.log("Woo"); }, error: function(xhr, ajaxOptions, thrownError) { alert(xhr.responseText); } }); And in the ajax template: $tags = $sanitizer->text($_POST['tags']); $image = $sanitizer->text($_POST['image']); $p = new Page(); $p->template = "preview"; $p->parent = $pages->get("/previews/"); $p->name = $title; $p->title = $title; $p->tags = $tags; $p->save(); If I select a "tag" from the select input and submit, it does indeed add it to the Page Reference field in the backend. However, this does not work with an array being passed to it of multiple options. So it does appear that my ajax call is trying to submit multiple options, but I am really just unsure how to get these two added in. I saw in other forums posts of add($page) and even add(array()). Do I need to handle this js array differently or do I need to foreach through the $tags to add it like: foreach($tags as $tag) { $p->tags->add($tag); $p->save(); } I tried this approach, but apparently I am still missing something. Edit: I was doing some tweaking, and I know I can split the js array out like: for (i = 0, len = tags.length; i < len; i++) { console.log(tags[i]); } However, I am not sure then how to handle the POST in php if I were to split it out.
- 9 replies
-
- api
- page reference
-
(and 1 more)
Tagged with:
-
This might be a completely dumb question, but I cant seem to wrap my head around it. I have a page reference field that allows users to select "Tags". In the front end I would like to use the titles as class names for a single item. ie: <?php $previews = $pages->find("template=preview"); ?> <?php foreach($previews as $preview): ?> <div class="tagOne TagTwo tagThree"> <!-- use another foreach to output--> <img src="<?=$preview->preview_image->url; ?>" /> </div> <?php endforeach; ?> I am little stumped as I know I need a foreach loop to produce each tag title, but how do I insert them all into one corresponding div class with spaces? Whelp, that was the easiest thing, but my brain just didnt "get it". Just put the foreach in the "class" inside of the overall foreach. Ugh ?
-
Wondering if anyone can help me get past a sticking point. I'm setting up a Processwire instance in a multiple site setup (using Soma's multisite) to run several related websites. I am getting stuck on the tagging system that I am using (adapted from a standalone PW site I'm running). I have the tags themselves set up as Pages, and the Tags field on the related pages is and ASMselect field that populates based on the pages underneath /tags/ in the tree. This system works fine on the standalone site. Where I am running into issues, is with trying to use them with the multisite setup. Specifically, choosing the proper subset of pages for tags on the ASMselect input tab. I want to choose only the tag pages for the site in question. My tree is laid out like this: Multisite / | site1.com | subsections | site2.com | subsections | Tags | site1.com | tagA | tagB | site2.com | tagC So far, the best I've been able to do is to use 'parent.has_parent=/tags/' in the Custom Find or Selector String portion of the Selectable Pages section of the input. This gives me the options of choosing tagA, tagB, or tagC on a page under site1.com. What I'd like to find is a selector that allows me to only see tagA, tagB as options from a page under site1.com and only tagC on a page under site2.com. Elsewhere in my php templates, I'm using $page->rootParent->title to set the proper scope and URLs for things, but I have not found a way to get that to work in this field input setup. I am trying to avoid creating specific fields and templates for each site, as unified templates were part of the purpose of going with a multisite install. Thanks in advance for any ideas.
-
I want the admin to select one of the child of a parent in "page reference" as radio buttons, but it comes out empty here is my hook in site/ready.php $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if ($event->object->hasField == 'childLinks') { $page = $event->arguments('page'); $parent = "parent=" . $page->path; $event->return = $event->pages->find($parent); } });
-
I added a field type 'page reference' using checkboxes knows as services. now i want to display the pages according to service. I can display all services list but when i click on any services then I can see whole code of site any idea where i am wrong ? main cate1 subcate1 subcate2 cate2 subcate1 subcate2 services first-service second services these services is being used as a page reference in subcate1, subcate2 templates. and in the navbar when i click on services and then when i click on any of the following service then i can see whole source code of my site.
- 3 replies
-
- page reference
- field
-
(and 1 more)
Tagged with:
-
Hello all. A few days ago I decided to redo my first PW theme (knowledge sharing one) trying to apply some more elegant logic and most important - to learn to filter page results by a Page reference field with some values. So far it is all going well except the fact that I am now at a stage to add some page parameters and am a bit stuck as to how to filter them. Here is an example of the structure planned to use: !-- Articles (template = articles.php) !---- Article 1 (template = articles-inner.php) !---- Article 2 .. !---- Article 3 .. !-- Categories (no template file) !---- Category1 (same template as parent) !---- Category2 .. !---- Category3 .. !-- OS (no template file) !---- Windows (same template as parent) !---- Linux !---- MacOS So far the home page and articles-inner pages are fully working. I need to show in the sidebar two blocks; Categories, OS where clicking on one would show only the posts containing the PageReference field value. To list the categories and OS in the block won't be a problem as I would just need to query the parent and list all the children (if any) with the proper markup. However, how to have the Categories and OS blocks link only to the specific posts that is the issue. In my previous version of the knowledge profile, I had the "categories" listed as a parent and the posts matching the category were just children of it. But now my goal is to learn how to add different parameters using Page Reference and have a way to show the results per the specific value. How would you organize a similar structure and what approach to take to have a simple and elegant solution? Or, if you know of a PW profile that I could dissect and learn the filtering mechanism of Page Reference etc. it would be even better. I am presently looking at the Ghost profile however Wire-approach is still not very much clear to me, unfortunately.
- 4 replies
-
- filter categories
- page autocomplete
-
(and 1 more)
Tagged with:
-
I have the following page structure Continents Countries Regions I then have pages "walks" which has a multi-select Page Reference field Regions (I've tried using dynamic fields for this but it wasn't accomplishing what I needed) which has the regions listed by country and then the region (continent is more for searching later on so doesn't need to be seen here). I'm trying to get a count of firstly all the walks within a continent, then country, then region but can't seem to figure out the selector for this. Thanks, Heather
- 3 replies
-
- page reference
- selector
-
(and 1 more)
Tagged with: