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. Hi, Can i make repeater inside repeater? If yes, how to call it? Plz help. Regards Peterpp
  2. Dear friends, i am a newbe but very glad to join the team... My question is ... from a page www.pagename.com/portfolio/1091 i want to echo a repeater's title, images etc. The 1091 is the repeater's id i tried the one below: $repeater_id = filter_var($input->urlSegment(1), FILTER_SANITIZE_NUMBER_INT); $repeater = $fields->get($repeater_id); echo $repeater->title; But Nothing happens. Any idea?
  3. Hallo, for a number of floating flexboxes I want to limit the number of them in each row. This is what I tried : <?php foreach($page->projectBox as $box) { if (count($box)<3 | count($box)>3) { echo "<div class='projektbox'>"; echo "<h2>{$box->boxTitle}</h2>"; echo "{$box->boxText}"; echo"</div>"; } if (count($box)=3) { echo "<br>"; } } ?> Which throws a 500 error... any help, pls? Thank youuu!
  4. Hi, I need a frontend form with an repeater field (single text field with user input). After the form is submitted it will generate a new page, save it and than fill all the additional fields (works fine with images). But during add an item repeater says: Is there another way to build an "repeater field" used in a frontend form? Is there a solution to get it work?
  5. Hello, I am developing a module that lets a user create, modify and save a "TV Grid" (the schedule for a TV channel). Here you can view some images that illustrate the concept: https://www.google.com/search?q=tv+grid&tbm=isch Of course, those are just examples and do not represent my specific implementation, but with that I hope you get the idea. The module installs a template for a "channel" (among other things). The "channel" has a "Repeater" field, where I store the complete grid for that channel. The repeater (grid) contains repeater items (grid items) that represent a scheduled show, e.g. ["Friends", Monday, 1st show of the day, lasts 60 minutes]. The repeater field is hidden from the user if he/she tries to edit the channel page via the admin's page edition interface. The intended way to edit this TV grid is by using the module's page that I've developed, which provides a custom interface for creating, manipulating and saving the grid. This of course means that I'm doing many things programmatically. The problem is that the repeater items I'm creating via code using the user's input just WON'T save. I've made all the code changes I could think of, trying different stuff, without positive results. Looking at the database, I notice the following when I run my code: - The corresponding row for the repeater field in its table is updated/saved. - However, no new rows are created for the repeater item fields (e.g. TV Show, duration, day, etc.). Would you please help me out here? I'm becoming insane ... I've included some code below. /* * More code before this, ommited because it isn't relevant. */ // Get the channel object (a Page). $channel = wire("pages")->get($channelId); if(!$channel->id) { $this->error("Channel does not exist. Grid can't be processed."); return ""; } // We need to clean this channel's grid before working with it. // "channel" is the Page // "tvChannelGrid" is the Repeater $channel->tvChannelGrid->removeAll(); $channel->tvChannelGrid->save(); $channel->save(); // Save the page.*/ // Add the grid items received from the module's form to the channel's grid. foreach($tvGridData as $i => $item) { // "tvGridData" is an associative array with data received from a form. $showId = intval($item["tv_show_id"]); $duration = intval($item["duration"]); $day = intval($item["col"]); $row = intval($item["row"]); $gridItem = $channel->tvChannelGrid->getNew(); // this must be done according to the documentation. $gridItem->save(); // Save the newly built item. // Assign values to repeater fields. $gridItem->tvChannelGridShow = wire("pages")->get($showId); // FieldtypePage $gridItem->tvChannelGridShowDuration = $duration; // FieldtypeInteger $gridItem->tvChannelGridShowDay = $day; // FieldtypeInteger $gridItem->tvChannelGridShowRow = $row; // FieldtypeInteger $gridItem->save(); // Save the newly built item. $channel->tvChannelGrid->add($gridItem); // Add the new item to the repeater. } $channel->tvChannelGrid->save(); // Save the repeater. $channel->save(); // Save the page.
  6. Hi folks, I have a repeater set up on a page and wondered if it's possible to only return the repeater rows that have a certain 'item' selected from a dropdown select field? So, for example, on my dropdown select I have two options 1: Article and 2: Sector guide, and I can return each row of the repeater easily enough with: <?php $articles = $pages->get('/practice/publications/'); ?> <?php foreach ($articles->practice_publication as $article) : ?> <?php echo $article->practice_publication_title; ?> <?php endforeach; ?> But this will of course return all the repeater fields, whereas I need it to only return the fields which have the practice_publication_type=1, for example. I tried looking around for the answer to this but couldn't find anything. Maybe it's not possible... Cheers, R
  7. Hi folks, I use the Page field quite often to cross reference data on the sites that I build and they are super useful, but I have a question regarding doing the same thing but with a repeater field? I know a lot of you know might think that perhaps I am using the repeater field wrongly and that the data should in fact be pages but I believe in this case that the repeater field is the best option. I have a Publications section on my site, which include image and title only, for each. I had thought about making each Publication a 'page' but then all you have on each page to edit is an image and thought this was maybe a bit clunky to do and a repeater would be better? So, if I make Publications a repeater... can I grab a specific 'field' from the repeater in a Page-like field? So, on another section, say Projects, I would be able to link a specific Publication to a Project via a dropdown field. You know? Let me know if you think there's a better way of doing this... it might be that if I ever need to cross reference another piece of data (an entry in the CMS) then it needs to be part of a 'page' and then easily selectable via a Page Field. Thanks! R
  8. How can I get the id of a repeater field from another page? I want to do something like if($pages->get(1034)->quotes->id == $i){ echo "Yes"; } Where quotes is the name of the repeater field
  9. It would be great to add limitiations (f.e. output 7 repeats without the possibility to add or to remove a repeat) to the repeater fields (like permanent repeats) This can be used for example for opening hours (output 7 repeats each for one day). The customer has no possibility to delete or add another repeat. The limitations should be placed under the details tab.
  10. Hey I'm stuck with a issue how to filter repeater results depending on content. I have a few Option fields where you can select "yes", "no" or then leave it blank "". I got my loop working and I'm able to skip content that has not been set. Now I just need a filter for the loop. <? foreach($pages->get("/content/")->children as $c): ?> <div> <p> <?php if($c->titles) echo $c->titles; ?> </p> </div> <? endforeach;?> I was able to make a if-statement which checked if($c->Selector=="no"): but as it was in the loop, it kinda bugged out. Never got it working either outside the loop... One really hacky way I thought about was using CSS Classes to set classnames, and that way split what is shown and what is not. This is a really bad way as it still loads all the content for each Selector value. What I'm looking for is eg. a filter that every Selector with value "yes" will be looped, others dismissed. Any ideas how to work on with this?
  11. I have an image and video carousel that I want to use on a page and have it be editable via processwire. The problem is that the code for images and video is completely different. What is the best way to go about making one repeater field where you can pick either a video or image? I thought about having nested repeaters but not sure if that would work. I want it to be possible to order the slides so having them as separate repeaters wouldn't work either. I am a bit stumped. Any help would be great. Images: <div class="rsContent"> <img class="rsImg" src="abc.jpg" alt=""> <div class="infoBlock infoBlockLeftBlack"> <h1>...</h1> <h3>...</h3> <h4>...</h4> <p>....</p> etc etc </div> </div> and for video is this: <div class="rsContent"> <a class="rsImg" href="abc.jpg" data-rsVideo="https://www.youtube.com/"></a> </div> Thanks you
  12. I'm sorry I cannot give examples and have very little clue what's happening. Did I change a flag months ago? Did I experiment and save something wrong in a config somewhere? I don't know, but this is what's happening: Thousands of pages are created over time (months). They appear to be repeater "ready pages". The pages are of status 3073 (statusOn | statusHidden | statusUnpublished). They are children of legit pages, but invisible, yet dragging every query down to the point of timing PHP out. The template is a repeater field w/ 2 fields in it. There is no data in the field_* tables for these pages; there are only pages rows, lots of them! Using version 2.5.3. To clean is up I do: delete pages WHERE templates_id=245 and status=3073 and the noise goes away. However I have no idea how the noise gets introduced over time... ? There were 9,368 pages the last time I did this. Here's the data for this template. Any hint would be appreciated. thanks. === template row: id : 245 name : repeater_boooking_price (sic) fieldgroups_id : 299 flags : 8 cache_time : 0 data : {"noChildren":1,"noParents":1,"slashUrls":1,"noGlobal":1} === fieldgroups_fields rows: fieldgroups_id : 299 fields_id : 344 sort : 0 fieldgroups_id : 299 fields_id : 337 sort : 1 === fields row: id : 345 type : FieldtypeRepeater name : booking_price flags : 0 name : ----- label : ----- data : {"template_id":245,"parent_id":1585,"repeaterReadyItems":3,"repeaterFields":[344,337]} === pages row: id : 1585 parent_id : 1039 templates_id : 2 name : for-field-345 status : 17 sort : 1 name1258 : status1258 : 0
  13. Hi guys, I have literally just installed a new site with processwire. On creating a repeater field I am getting the error: Invalid value sent to Page::setTemplate and as a result can't add any fields to the repeater. I have installed it as normal through modules and have never faced this issue before. Can anyone help please? Thank you, Mel
  14. Hi folks, I am building a 'logo' list of supporters/clients. I have two slides and would like to show different ones on each slide, but work with a single repeater on the page. There is two checkboxes within the repeater when adding a logo ('created_for' and 'helped_create'). I thought this code below would work in returning ONLY those 'repeater rows' which has the 'created_for' checkbox checked, but it's still including the logos that have the 'helped_create' checkbox checked too. I think I may have my foreach loops mixed? Any thoughts? <?php $created_for = $pages->find('wwww_slider.created_for=1'); ?> <div class="each-icon-container"> <?php foreach ($created_for as $created) : ?> <?php foreach ($created->wwww_slider as $icon) : ?> <div class="each-icon"> <?php if ( $icon->link ) : ?><a href="<?php echo $icon->link; ?>"><?php endif; ?><img src="<?php echo $icon->logo_off_state->url; ?>" /><?php if ( $icon->link ) : ?></a><?php endif; ?> </div> <?php endforeach; ?> <?php endforeach; ?> </div> Thanks in advance, R
  15. 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?
  16. This works for me to support page references in Ryan's ImportPagesCSV.module, in function importPageValue: elseif($field->type instanceof FieldtypePage) { $value = trim($value); if(wire("pages")->find("$name=$value")) $page->set($name, $value); } I need to also be able to import repeater fields though.. Anyone know how to do that?
  17. Title says it all... other image types are saving fine, including cropimages in other (non-repeater) contexts. However the cropimage in the repeater field uploads to 100%, then disappears. Please help!
  18. Hi there, Is there is a built-in way to prevent duplicates when it comes to the Repeater field type? The Repeater I have setup contains two fields: one is a select list of other Pages and the second is just a text field. Ideally, I'd love the select list of Pages to work similarly to how the Fields list in Admin works. As you're adding Fields to a Template, the ones you've already added become disabled in the list so they cannot be added again. If that's not possible, then would something like the following be the next best solution as a module? public function init() { $this->addHookAfter("InputfieldRepeater::processInput", $this, "validateNoDups"); } public function validateNoDups($event){ $field = $event->object; if($field->name == "technical_specs"){ $page = $this->modules->ProcessPageEdit->getPage(); $specs = $page->get("$field->name"); $s = array(); foreach($specs as $spec) { if ($spec->technical_spec) { $s[] = $spec->technical_spec->title; } } $dups = $this->get_duplicates($s); if ($dups) { $field->error("You have duplicate technical specs: " . implode(', ', $dups)); } } } Thanks! Lauren
  19. Hi Guys, I have created a slider using Bootstrap and in Bootstrap the slider image that is first in line is required to have the class active. In creating a repeater for my client to add images, I need to add a conditional statement to check if the item is first in the repeated elements and if it indeed is first, assign active as the class. Not sure what is best practice using a selector and the api to see if the the repeated element is first in the repeater list. Any light? Thanks guys!
  20. Hi, Can someone please help me with the scenario below, I am trying to build a Project portfolio sort of a site. I have a homepage which displays three recent items from a Repeater field named my_items (3 RepeaterReady fields are created for the home page and filled with data), example code below: <?php foreach ($page->my_items as $item) { ?> // display item values, for example: <div class="item"> <img src="<?php echo $item->my_image->url; ?>" /> <a href="<?php echo $item->my_link->name; ?>">View</a> </div> <?php }; ?> I have a page called my-items with repeater 'my_items' field for displaying the same as above. The page 'my-items' has children, each of which have 'my_items' Repeater field for displaying data respective to that page using the same code as above. The page/ site hierarchy is like: Home - uses Repeater 'my_items' |- My Items - uses Repeater 'my_items' |- Item 1 - uses Repeater 'my_items' |- Item 2 - uses Repeater 'my_items' |- Item 3 - uses Repeater 'my_items' |- ... |- My Items 2 |- Item 1 - uses Repeater 'my_items' |- Item 2 - uses Repeater 'my_items' |- Item 3 - uses Repeater 'my_items' |- ... and so on. What I am doing as a starter with PW is: - Entering same data for in Repeater for Home for some item, lets call this 'A'. - Entering the same for My Items the data for 'A' - Entering the same for Item 1 the data for 'A' Therefore, I am adding 'A' thrice in three places, violating the DRY principle. What I have tried and failed is: - To get 'A' to display in My Items page fetched from Item 1 and then, - the Home to display 'A' fetched from My Items so that I only enter data for 'A' in Item 1 and not in every page that displays it. Caveats: - The homepage displays 3 recent only from page My Items - Page My Items displays one from each children - Item 1 has multiple Repeater blocks/ pages for displaying data (e.g. My Item #1, My Item #2, My Item #3 .......... My Item #n) Another way I think to explain it would be a photography site with structure as: Home - display 3 recent photo projects |- Projects - displays each child project with the 1st photo and its description |- Nature - Has many photos with description |- Animals - Has many photos with description |- People - Has many photos with description I hope I had explained properly. Any help or suggestion would be highly appreciated.
  21. Hi there! I’m using Apeisa’s ShoppingCart module to do a little shop. I have pages each with a range of products as repeater items. These items have different prices (package deals, individual products and so on). They all render with correct names and prices. So far so good! Now the issue: When I add one or more products to the cart I get the $title of the $page instead of the product name, and the price is set to the price of the first product on the page no matter which product I add to the cart. So I’m doing something wrong. Here is the code I’m using: // Primary content is the repeater fields of "sc_item" $contentThree = ''; //sc_item is my repeater field foreach ($page->sc_item as $product) { $contentThree .= "<span class='sc_item'>" . $product->sc_name . "</span></br>"; $contentThree .= "<span class='sc_price'>" . $modules->get( "ShoppingCart" )->renderPrice( $product->sc_price ) ."</span> excl. BTW (VAT)"; $contentThree .= "<span class='sc_add'>" . $modules->get("ShoppingCart")->renderAddToCart(). "</span>"; } $contentThree .= $modules->get("ShoppingCart")->renderCart(); Can anyone point me in the right direction?
  22. Hello everyone My question is very noobish, but I found no way to accomplish something simple. Also related posts in the forum where to difficult to work with for me … I would like to sort upcoming and past events which are repeaters by their end date field. The output should look something like this: UPCOMING EVENTS Title event 1 26. November to 27. November 2014 Title event 2 29. November 2014 … PAST EVENTS Title event 3 12. November 2014 Title event 4 1. August to 5. August 2014 … My code only returns the last of the created events as many times as there are events . Am I completely on the wrong way? Any hint would be very appreciated … Thanks, tron1000 setlocale(LC_TIME, 'de_DE'); echo "<h1>Events</h1>"; foreach($page->event as $event) { $event_title = $event->event_title; $date_to = $event->getUnformatted('event_date_to'); $today = time(); $date_from_formatted = strftime('%d. %B %Y', $event->getUnformatted('event_date_from')); $date_to_formatted = strftime('%d. %B %Y', $event->getUnformatted('event_date_to')); if ($date_from_formatted == $date_to_formatted) $event_out = "{$event_title}<br>{$date_from_formatted}<br><br>"; else $event_out = "{$event_title}<br>{$date_from_formatted} to {$date_to_formatted}<br><br>"; } echo "UPCOMING<br><br>"; if ($date_to > $today) foreach($page->event as $event) { echo $event_out; } echo "PAST<br><br>"; if ($date_to < $today) foreach($page->event as $event) { echo $event_out; }
  23. Hi Folks, I am trying to setup a scorecard for a page for a golf course listing. Each course has different "Tees" i.e. Mens, Ladies - but also different tee colours like "Blue" or "Black" for championship, "White" for "Mens", "Green" for mens / non compeition and "Red" for ladies. This is fairly common but some courses might use gold, silver bronze as their colours. Each Tee Box has the following data: Distance Par Index Men's boxes for par and index will typically always be Blue / Black and White - green is included for distance, and ladies tend to just have the one tee box. I am trying to get my head around how to setup a field for this / approach it so I have the flexibility to do: Hole Number (fixed 1-8) Tees - Tee Colour - Tee Distance - Tee Par - Tee Index I could probably figure some way to make "Hole" repeatable then the user has to enter repeatable rows under for each "Tee" however it's a bit messy and lot of repetition - it would be far better if there was a way to firstly define the courses "Tees (Colours)" then auto present 18 rows fields for the associated colours Par, Distance and Index. I hope that makes sense and hope someone can guide me on an approach. Thanks in advance.
  24. I have an issue with a repeater field (PW 2.4). The repeater consists of three fields: title (text), body (textarea) and image. The repeater field only gets published when i put some text into the body field, otherwise it remains unpublished. Any ideas on this?
  25. Hello, I'm building a form through the API. In that form I am using a repeater field that is setup with 5 Ready-To-Edit New Repeater items. In the repeater is only one text input field named "servername". Now I'm having trouble accessing the repeater field values when I process the form. I read through the docs at https://processwire.com/api/fieldtypes/repeaters/. But when processing form input post values things seem to be different. I add the field to the form with: $registrationField = $fields->get("reg_servers")->getInputfield($pages->get("/registration")); $registrationField->attr("class","form-control"); $registrationForm->append($registrationField); The field is there in the form and working fine. Now when processing the form, I need to access the values of my repeater. Here's the relevant code: if($input->post->submitregistration) { $registrationForm->processInput($input->post); $servers = $registrationForm->get("reg_servers")->value; var_dump(count($servers)); // this gives int 5, which is fine foreach ($servers as $server) { echo "<pre>"; print_r($server->fields->servername); //servername is my text input field in the repeater echo "</pre>"; } exit(); } In the print_r output I can't find the value of my fields. I also tried var_dump($server->servername) and var_dump($server->servername->value) inside the foreach which gives an empty string. var_dump($server->fields->servername->value) gives null. How can I access my field values?
×
×
  • Create New...