Jump to content

Search the Community

Showing results for tags 'Repeater'.

  • 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

  1. I've been trying to figure a way to output the values of several fields within a single repeater using a foreach() without having to reference the name of the fields. Typically, for repeaters, I understand you would do foreach($repeater_field as $afield) { echo $afield->fieldname_a; } pretty straight forward. Anyways, what I'm doing is using a single repeater as just a container for other fields. I've tried using $page->my_repeater->getArray(), then looping through the array, and all sorts of methods, without luck. It seems I must specify the field name for output. For instance, my (single) repeater is set up to hold a few different fields: my_repeater field_a field_b field_c Trying to output it using something like this: foreach($page->my_repeater as $afield) { echo $afield->value; // I'm not wanting to have the reference the field name e.g. use $afield->field_a } Any suggestions?
  2. Is there a module or plugin that is like a repeater but you can choose a template? I want something that let's me: choose a template to get fields from, display these fields like a repeater does add new pages without adding a title or name (this might be achievable using other means like ProcessSetupPageName) delete pages I feel like somebody might have already made a module that does just this, however, I haven't found any. Perhaps there is a way of doing this with a standard repeater that I don't know about.
  3. I have a problem realizing a picture gallery with albums using repeater fields. Here is what I have: - The repeater field 'repeater_gallery' for all the albums - A text field 'album_name' in the repeater for the album name - An image field 'album_images' in the repeater for all the album images Now I'd like to pick a small selection of images (say 4) of ALL albums randomly and present them with their associated album name. How can this be done with the described repeater setup? Or is there a better way to realize such a gallery without repeaters? Thanks in advance for a little help.
  4. Following the example from the PW docs I set up a a repeater. I'm trying to fetch random fields from a repeater, for instance, display 4 random customer testimonials. Here is the basic setup in PW: created these fields: testimonial_text testimonial_name I then added them to a repeater field called: testimonials_repeater Next I added testimonials_repeater to a template called testimonials Last, I created a new page called Testimonials using the testimonials template. As far as fetching all the testimonials I'm doing this: <?php $testimonials = $pages->find("template=testimonials"); foreach($testimonials as $trepeater) { foreach($trepeater->testimonials_repeater as $t) { echo $t->testimonial_text . ' -' . $t->testimonial_name; }} ?> Could some please give me some guidance on how to pull, for instance, 4 random testimonials? I mean, I could stick the results in an array[] inside the foreach loops, then random sort the array, then output only 4, but there has to be a better way using PW. Also, is there a way to limit the number of records (customer testimonials) that can be added by the user? Repeaters just always seem to trip me up. :/ thanks much!
  5. wihtin a repeater field (composers) i am using a second nested repeater field (works). For the first repeater item labels show up correctly as defined in the "details" Tab ( "#n: {lastname}" ). The second (sub) repeater constantly displays the label of the repeater field itself ("works") as labels of the items ( ignoring my user definition "#n: {work_title}" ). All items of the nested repeater are labeled in the same way ("works") Is it a bug or have i misunderstood anything? EDIT: meanwhile i found an identical issue reported on https://github.com/processwire/processwire-issues/issues/173 seems to be a bug, a possible workaround can be found in the link
  6. Hello, on a fresh 3.0.62 install I have a page reference field 'mypages' with these settings for selectable pages: In my site/ready.php I have this hook: /** * custom page select */ wire()->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name != 'mypages') return; $pages = new PageArray(); $pages->add($this->pages->get(1)); $ids = $pages->explode('id'); $event->return = $event->pages->getById($ids); }); On a normal page, the hook is working and the mypages field has only 'Home' in the select dropdown . But when I put the mypages field inside a repeater, it is not working. I have this problem on a project that is in development right now and have spent quite some time to try and find the reason. Then I made a fresh PW install to verify the behavior. No matter if repeater dynamic loading is on or off, the page reference field always returns the set of pages defined by the settings in the page reference field. The hook is ignored. Can anyone please verify this and let me know so I can file a bug report. Also if you have an idea how to fix this, I would be happy.
  7. I used Profields: repeater Matrix to create a field. One of the repeater matrix types contains a repeater field. As a superuser I can create new entries within the nested repeater field. Any user that does not have superuser access cannot create new entries or expand existing entries. When a non-superadmin tries, the following JQuery error can be seen in the console: Uncaught Error: Syntax error, unrecognized expression: {"error":false,"message":"The requested process does not exist"}. “Repeater item visibility in editor” and “Repeater dynamic loading (AJAX) in editor” options are set to the default entries. I am using ProcessWire 3.0.62 and Profields Repeater Matrix 0.0.4
  8. Hello, To compare repeater items when someone added or removed items to/from the repeater, I use this hook wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments[0]; if($page->isChanged('repeater')) { //get page before changes : https://processwire.com/talk/topic/9734-determine-old-vs-new-value-of-field-when-saving/?do=findComment&comment=106166 $oldPage = $this->wire('pages')->getById($page->id, array( 'cache' => false, // don't let it write to cache 'getFromCache' => false, // don't let it read from cache 'getOne' => true, // return a Page instead of a PageArray )); bardump("new count: {$page->repeater->count}"); bardump("old count: {$oldPage->repeater->count}"); } }); When I add a repeater item, both counts are identical. But they shouldn't. When I remove a repeater item, the counts come out correct. I verified this behavior on a blank PW 3.0.62 install. So I think it is a bug. Can someone please check if they find the same behavior? Thank you. I also tried it with this hook wire()->addHookAfter('Page(template=basic-page)::changed(repeater)', function($event) { // old value bardump($event->arguments[1]->count); // new value bardump($event->arguments[2]->count); }); Same outcome. For the second hook to fire, you need to adjust line 1005 in wire/core/Wire.php to read if(($hooks && $hooks->isHooked('changed()')) || !$hooks) { because of this bug.
  9. Hi everyone I've started to build a newsfeed for a customer, but I'm stuck... I have a news-repeater field including date, title, text and images. I have the link (showing date and title) to each news on the left (with foreach) and the details on the right (showing date, title, text and images also with foreach). I would love to only show the current news on the right. The latest news should be visible on the right. When I click on the link on the left side, it should change the news content on the right side. Does anyone have a simple solution for this? Here's how it looks like at the moment: http://rolspace.net/hd/energiegossau/uber-uns/news/ Thank you! Roli
  10. Resources (Ryan's own): ImportPagesCSV FieldtypeMapMarker So I edit the accepted $fieldtypes on :76: /** * List of Fieldtypes that we support importing to * */ protected $fieldtypes = array( 'FieldtypePageTitle', 'FieldtypeText', 'FieldtypeTextarea', 'FieldtypeInteger', 'FieldtypeFloat', 'FieldtypeEmail', 'FieldtypeURL', 'FieldtypeCheckbox', 'FieldtypeFile', 'FieldtypePage', 'FieldtypeMapMarker', 'FieldtypePassword', 'FieldtypeRepeater' ); Page, MapMarker, Password and Repeater were added by me. Then alter importPageValue: /** * Assign a value to a page field * */ protected function importPageValue(Page $page, $name, $value) { $field = $this->fields->get($name); if($field->type instanceof FieldtypeFile) { $value = trim($value); // split delimeted data to an array $value = preg_split('/[\r\n\t|]+/', $value); if($field->maxFiles == 1) $value = array_shift($value); $data = $page->ImportPagesCSVData; $data[$name] = $value; $page->ImportPagesCSVData = $data; } elseif($field->type instanceof FieldtypePage) { $value = trim($value); if(wire("pages")->find("$name=$value")) $page->set($name, $value); } elseif($field->type instanceof FieldtypeMapMarker) { $value = trim($value); $page->set($name->address, $value); } elseif($field->type instanceof FieldtypeRepeater) { // } else { $page->set($name, $value); if($name == 'title') $page->name = $this->sanitizer->pageName($value, 2); // Sanitizer::translate elseif($name == 'fullname') { $page->name = $this->sanitizer->pageName($value, true); } } } Page import works with ID values, which was trivial to incorporate; passwords too. MapMarker and Repeater as you might guess do not. How can I save the map->address value? Hopefully it will update the corresponding map fields too but one thing at a time. As for the repeaters... LostKobrakai tipped me off to foreach($page->engines as $e) { foreach($e->fields as $field) { echo $field; echo $e->get($field); } } which works for their names and values, but in this function you're passed the field, and something like foreach($page->$field as $e) { foreach($e->fields as $field) { echo $field; echo $e->get($field); } } doesn't work... and what it would need to do inside anyway is check for a subfield whose name is equal to the column header (choose the repeater field itself e.g., engines in the select per repeater subfield value, e.g., engine_fueltype), then explode that cell value by pipes ('|'), and for each subvalue, populate the repeater#->subvalue... but before all that I need to be able to iterate through the subfields from the field in this function. Anyone have any ideas?
  11. Hi, I am creating a template that have two repeater fields: - One for "slideshows" images, other for "highlights" images The field "slideshows" has a "slideshow_images" field (image type) to be repeated and the fields "highlights" should have the field "highlights_images" field (image type) to be repeated. What is happening is when I add the the "slideshow_images" to the field "slideshows" the field "slideshow_images" is also added to the field "highlights" and if I had the field "highlights_images" to the "highlights" field the "slideshow_images" in the field "slideshows" is replaced by the "highlights_images" field. I already deleted all fields and create from scratch and the result is always the same. I am using the Processwire 3.0.39. Can anyone explain what is happening? Thank you
  12. Hi, when i use nested repeater in PW 3 it will only output the first entry from the second repeater. Code: <?php foreach ($page->first_rep as $c): ?> <?php echo $c->fields; ?> <?php foreach ($c->second_rep as $p): ?> <?php echo $p->fields; ?> <?php endforeach; ?> <?php endforeach; ?> Can anybody help me?
  13. i have a page with similar repeater fields of various names, and similar output in a loop so i really don't really want to write endless foreach repeater for rendering but need to aggregate all repeater fields and then pass them via one foreach loop $repeaters=$pages->get("/advert_page/"); foreach($repeaters->fields as $repeator){ if($repeator=="title")continue; echo $repeator->summary; echo $repeator->images->first; } it simply doesnt work, so i have to manually do for each repeater $repeater=$pages->get("/advert_page/"); foreach($repeater->Media as $m) { echo "<img src='{$m->images->first()->size(120, 60)->url}'>"; echo "<p>Year built: {$m->summary} </p>"; } echo '</div><div class="uk-grid uk-grid-width-medium-1-4" data-uk-grid-margin="">"'; foreach($repeater->featured as $m) { echo "<img src='{$m->images->first()->size(120, 60)->url}'>"; echo "<p>Year built: {$m->summary} </p>";
  14. I mean.. when the clients are entering values from products list table.. it will be great if they could duplicate the existing row with fields and to change only a few values (like size & price) of them. Just a suggestion. It will e an easy way for entering price tables. thanks a
  15. Hello, I'm new to PW and like it already I have just created my first site with PW and need some help getting repeater posts from one page to expl. home page. I have a page called Events with template events.php . Page has a repeater field called Events_repeat. Now I would like to show last three events on a homepage, how do I do that. I have tried with: <?php foreach ( $pages->find('template=events, limit=3') as $event ):?> <div class="hovereffect"> <img src="<?=$event->images->first->url ?>" width="100%" class="img-responsive" style="border: 9px solid white;"> <div class="overlay"> <h2><?= $event->images->description->first ?></h2> </div> </div> <? endforeach; ?> But it doesn't work, what am I doing wrong. I tried to look on a forum but couldn't find anything helpful really. Thank you very much R
  16. Hi, how do I enable frontend editing for repeater fields? It partially works with foreach($page->repeater_field as $item) { >? <li><edit list_item><?= $item->list_item ?></edit></li> <?php } But if I click a frontend item the text disappears. I'm not sure if this is a bug or because it does not know which text it should reference. I tried with: foreach($page->repeater_field as $item) { >? <li><edit list_item_repeater<?= $item->id ?>><?= $item->list_item ?></edit></li> <?php } But that results in an exception.
  17. Hi there! And thanks for Processwire which i really like! Got a specific repeater-related question which i couldn't resolve. Will appreciate any help. Let's imagine we have Places (pages), Offers (pages) and Partners (PW users). Any Place can have many Offers attached to it via a repeater field. Any Partner can have many Places (repeater or a multiple-value field). He can offer some Offers at each Place he is attached to. His Offers for any Place should be selectable only from Offers already attached to this Place. Partner-Places-Offers management should be performed in admin interface via PW input fields. The ideal solution which i imagined could be a "dynamic" partner_place_offers repeater where multiple Offers for a single Place could be selected from dynamically built list dependent on selected Place. But it appears that PW doesn't have such functionality yet. Thanks in advance for giving some idea on the subject!
  18. Thanks everyone for a perfect product! Got a problem during development of a website which has two different templates sharing the same "suboffers_prices" repeater field: the "offer" template and the "order" template. The idea is to take a single repeater item from offer page and to save it as a repeater item to a newly-created order page. Getting a single repeater is not complicated: $suboffers_prices = $pages->get("uid={$input->post->suboffers_prices_uid}"); But saving that suboffers_prices to a new order page appeas to be not that easy: $newOrder->suboffers_prices = $suboffers_prices; $newOrder->save(); //doesn't save the repeater ...another try... $newOrder->suboffers_prices = $suboffers_prices; $newOrder->suboffers_prices->save(); //in fact saves nothing ... $newOrder->save(); //doesn't save the repeater ...and another... $newOrder->suboffers_prices->getNew(); //$newOrder->suboffers_prices->of(false); //not callable in this context, PW crashes with error $newOrder->suboffers_prices = $suboffers_prices; $newOrder->suboffers_prices->save(); //again saves nothing ... $newOrder->save(); //again no repeater saved Tried some other approaches, still no result. Would like to get any advice on the best practice for saving a single repeater item to another page. Thanks in advance!
  19. Hi, I have the following simplified layout on my page: ... row1_card1 - row1_card2 - row1_card3 row2_card1 - row2_card2 - row2_card3 ... You can add as many rows and cards per row as you like. Each card has a title, text and a button whose text is the same on every card but should be editable too, just not individually. I wonder what is the best approach to do this without making it awfully complicated to setup in the admin from an editors perspective. I thought about a solution using a PageTable for the rows and a Repeater for the cards but that started to be complicated to setup even. It would be awesome if you could use the FrontpageEditing to edit these cards and even add more or add rows. How would you implement it?
  20. Hello everyone! I recently downloaded ProcessWire and after playing around with it I've found its flexibility and ease of use to be really promising. I'm working on a site to publicize upcoming live music events and archive past events at our venue. Each event has the usual start time/end time/price/etc fields and can be associated with any number of bands (usually just one or two). Each band has name/website/description (short bio)/image fields. At the moment I have a page field on my event template allowing each event to be tagged with the required bands, either by choosing existing band pages (for bands which have played at our venue before) or by creating a new band page. I can then reference each band's name/website/description/image in the event template php. There are two key ways users will discover events on the public-facing site: 1) Through the events index page, listing events which can be filtered using dates and keywords 2) Through the band index page, listing bands whose pages will list past/upcoming events where they have performed. However, since: a) many bands have gone through minor lineup changes since they started playing at our venue, b) many bands have released (and want to promote) new material since they started playing at our venue, each band's description and image fields might (but not always) need to vary between events. I would like past event pages to show the band's description/image that was relevant when the event occurred, not the most recent revision. On adding band pages to new events pages, I would like the default description/image to be the most recent version for the band, with the option to replace this with a new description/image if required. It would be unnecessary to provide a new description/image for each band at each event if there were no lineup changes or releases of new material since they last performed. My first thought was to have a repeater field for description/image/start time/end time on the band template, where the start and end times help my php template decide which description and image to pair with a particular event. However, the band page field on the events template will not allow me to edit the referenced band page's attributes; it only lets me select band pages and reorder them. If I wanted to update the band description (while preserving the history of previous revisions) I would therefore have to find that band's page elsewhere in the admin then add a repeater row and enter the new description there, keeping the image field blank for that row if the image doesn't need updating. This would require the start time (of the new row) and end time (of the previous row) to be input manually... I'm convinced there must be a simpler way to maintain the links between events and band info. My current structure is: Home -- Events Index ---- Event 1 ---- Event 2 ---- Event 3 -- Bands Index ---- Band 1 ---- Band 2 ---- Band 3 Apologies if I've misused any terminology Could anyone advise on sensible strategies for achieving this using Core ProcessWire or modules? Thanks!
  21. Hi, I was just playing around with the Repeater fieldtype and wondered if this might be a good fit for something I would call a "FieldCollection". In a FieldCollection the behavior should be exactly the same as in a Repeater fieldtype where minimum and maximum items are set to "1" – just the look and feel in the backend should be slightly different. Think of templates that share two or more fields for the exact same reason – e.g. a "published from" and a "published to" date field and a checkbox. Instead of adding those three fields to every template that needs them, why not create a FieldCollection? Changing the FieldCollection will change the fields on every page it is added to. The only caveat of using a Repeater item set to min and max 1 item is its appearance in the backend: Some of the Repeater features (delete item, add new item, ...) wouldn't be needed for that particular usecase. What do you think? Many greetings! Nik
  22. How can i add a repeater field in a module's config?
  23. Hi everyone, i just experienced a bug/case where the backend did not save the repeater state in a matrixRepeater. I haven't found any post about this bug so i thought it might be interesting if other people experience the same problem. I have some "standard template" with a matrixRepeater field on it. (Screenshot1, that red marked part is my matrix) This field has different types ofcourse ... one if its types is "Slider". (Screenshot2) If you click it - the slider type contains a repeater with an Image field and some other fields that looks like this... (Screenshot3) If I change the "Element label" from "#n" to anything else like "#n - {bild.name}" or "bild.title" for example - the page that contains the matrixrepeater does not save the image field anymore. You can upload i picture, save the page, it even tells that it has been saved but its not showing in the backend - its just an empty item with no picture in it. Does anyone have a fix or an idea how for this? PW version is: 3.0.42 FieldtypeReapeaterMatrix is v0.0.3
  24. Hello, Is there a way to group together fields, like in a repeater field, but only allow there to be one set per template? I looked into the fieldtab field but this doesn't allow for certain features that a repeater would - ie, allow the same field to be used at least twice within a page (eg, outside a repeater and within a repeater), and to add a group of fields into a template as one chunk. This would seem like a handy feature feature and I'm probably missing something! Many thanks in advance, ben
  25. From time to time people run into this issue: https://processwire.com/talk/topic/13089-repeater-field-limits-and-server-timeouts/ So the idea is simple: Admin > Setup > Fields > Details (tab) > Maximum items allowed / 0 = No limit Something like the one for images. And may be a nice little yellow boxed notice underneath, about why it is a good idea to impose a limit... I love these inline help bits, they help me a lot. EDIT: I forgot to add that - of course - we also need some GUI voodoo to support it.
×
×
  • Create New...