Jump to content

Search the Community

Showing results for tags 'Profields Table'.

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

  1. I'm having and always have a hard time building PaginatedArrays, I never know where to put the "limit=24" selector so please enlighten me. Here's what I'm doing… $categories = $page->protable('start=0, limit=999999'); // this I need in order to retrieve the pages's "categories" and I don't know how to make use of $rows instead for that purpose because of this confusing limit-API $rows = $page->protable; // put ("limit=20") here? $custom = buildSelector($input, $rows); // this function returns an array of selectors depending on the user input $items = new PaginatedArray; // or here? // or here? $items->find("limit=20") // or like this? $items("limit=20") // or like this? $items = $items("limit=20") // or like this? $items = $items->find("limit=20") foreach ($rows as $r) : if ($custom->get('selector')->matches($r)) : $items->add($r); endif; endforeach; // or at this point? and then if ($items) { // or maybe somewhere here? echo '<span class="grey">'.$items->getPaginationString(array( 'label' => 'entries', 'zeroLabel' => '0 entries', // 3.0.127+ only 'usePageNum' => false, 'count' => count($items), 'start' => $items->getStart(), 'limit' => count($items), 'total' => $items->getTotal() )); and then of course… $pager = $modules->get("MarkupPagerNav"); echo '<div class="uk-flex uk-flex-center">'.$pager->render($items, $options).'</div>'; I'm out of ideas and confused cause it doesn't make sense to me either way. ____ The buildSelector function above returns and array… $selected = new Selectors("$letter, $searchterm, $category"); $custom = new Wirearray; $custom->set('selector', $selected); $built->set('sort', $sort); return $custom; and each of the new selectors are basically strings ("category=whatever") Also, you cannot put the "sort=title" or whatever as a selector for the Selectors function (see above). Why, I know not. I don't know if that is the proper way but selecting kind of works now as opposed to many other ways I tried. Selectors always require a lot of trial and error, it seems to have a very sensitive API, always depends on double quotes, single quotes and how you concatenate. Thanks for help!
  2. so I have a Profields Table on a sibling's page, trying to access it from its sibling's page (DUH!) which is $page now, cause that's where I am right now. I do $toc = $page->siblings("template=tableofcontents")->tableofcontents_table; $toc->render(); or $toc = $page->siblings("template=tableofcontents"); $toc = $toc->tableofcontents_table; $toc->render(); but it just won't work because Call to a member function render() on null The table clearly is there and clearly is a sibling and its template is as stated and the table also. Please help me quick, about to throw the computer out the window, thank you.
  3. textformatters=TextformatterEntities in my field settings cause problems when moving data around (exporting, importing). I can't get rid of the entities in my code and so I have troubles filtering and selecting the content (I tried $sanitizer->unentities, actually need to apply that twice for it to look good but still does not filter/select properly). I figured It must be possible to change the format in the field directly and once and for all. What other options does "textformatters" allow? Because deleting it altogether doesn't work at all. thanks
  4. I have a profield table and one of its fields is called category. I want to use the values of this field and created a unique array which I use for the options-filter. $rows = $pages->get('path/to/parent/page')->protable; $categories = new WireArray; foreach ($rows as $r) : if ($r->category != '') : $categories->add($r->category); endif; endforeach; $categories = $categories->unique(); So I loop through the $categories array and output an option field for each. This kinda works but not with the pagination. On the second page it would only show the "options" (categories) of those entries that the unfiltered array would show on a second page. Where's the problem?
  5. Inside the ProFields Table I have one column of type "select" for which I entered several options to choose from. How can I return these options? I mean loop through them to build my markup.
  6. I've created a simple sports league fixture generator in a template called 'League'. Teams are added as page references then a fixture list is created as a ProFields table by hooking page save to add new rows to the table. The bit I need help with is that I'm trying to check a fixture doesn't already exist before adding it to the table (e.g. if a new team is added to the league). I'm trying to do this with a PW selector to filter the fixtures table and check whether Team A vs Team B already exists in the table. Then on the next line checking no fixture was found by using count(). However as soon as I add the selector the script no longer adds any rows to the table. If I take it out, it all works fine (albeit with duplicate fixtures each time the page is saved). I've also tested the selector in a page template and it filters as expected. It's late here (UK)... I'm probably doing something stupid! Any ideas? <?php //Hook page save to generate league fixture lists $wire->addHookAfter("Pages::saved(template=league)", function ($event) { //Get which page has been saved $page = $event->arguments(0); $noFixturesAdded = 0; //For each team in league cycle through and add home fixtures foreach ($page->teams_in_league as $teamA) { foreach ($page->teams_in_league as $teamB) { //Check if fixture already exists $existingFixtures = $page->fixtures("team_a=$teamA,team_b=$teamB"); //Check team A is not the same as team B as you can't play yourself //Then add row to fixture table if ($teamB != $teamA && $existingFixtures->count() < 1 ) { $fixture = $page->fixtures->makeBlankItem(); $fixture->team_a = $teamA->id; $fixture->team_b = $teamB->id; $page->fixtures->add($fixture); $noFixturesAdded ++; } } } //Save updates to table $page->save('fixtures'); $message = "League saved. $noFixturesAdded new fixtures were added"; $this->message($message); });
  7. OK, after three days of banging my head against this, I turn to the forums. I am attempting to apply what would seem to be a rather straightforward filter to a set of results, but am tripping over... something (suspect it's because I continue to have difficulty wrapping my brain around the operation of the ProFields Table field; also, a bit shaky on PageArrays in general). I have a links page that includes a "title" field, a "categories" field and a "urls" ProFields Table. The urls Table has rows/fields for "poiurl" (the actual full url), "urltext" (the link as I want it to appear), "desc" (an optional description field), and "place" (a dropdown select populated by another page). I can get the appropriate links page (filtered by a previously defined "$pcat" category), grab all the urls from the Table, and display them. However, I cannot figure out how to limit those results by a particular field—in this case, "place," as I want to return only those links that match the current page's "place." $place=$page->place; $links = $pages->get("template=links, categories=$pcat"); echo "<h4>$links->title</h4> <ul>"; foreach ($links->urls as $u) { if ($u->desc) echo "<li><a href='$u->poiurl'>$u->urltext</a> ($u->desc)</li>"; else echo "<li><a href='$u->poiurl'>$u->urltext</a></li>"; } echo "</ul>"; So, how do I get it to show only the $u results wherein $u->place=$place? Thanks!
×
×
  • Create New...