-
Posts
812 -
Joined
-
Last visited
Everything posted by a-ok
-
Unfortunately I did try this but it returns nothing. `linkMarkup` is also used for the numbers too (not just prev/next).
-
Is there a way to return the next page in the pagination (as a link) only instead of rendering out the full pagination? <?php echo $results->renderPager(array( 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='MarkupPagerNav'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'><span>{out}</span></a>" ));
-
Thanks, folks! Has anyone else had this 'issue', or is it generally common practice to have numbers first, rather than last? I wonder if it would be possible to suggest an PW API avaliable for an option like this?
-
Is it possible, when sorting pages by 'name' to place any numerical 'names' to the bottom, rather than at the top (first)?
-
This is nuts. I had no idea you could do this. Thank you!
-
What's the best way to sort two PageArrays by two separate keys using PW? I'm unsure if this is possible rather than using just PHP (but was curious to know if PW had such a way). I have a page, 'Designers', and I have three fields for the children pages... title, firstname and lastname. If the designer is a person then they fill out all three fields, but if they are a collective/group then they just fill out the title. My plan would be to then create two queries... one returning only the designers with full names (first and last) and then the other returning collective/groups only. $designers_person = $pages->find("parent=/designers/, designers_lastname!='', sort=designers_lastname"); $designers_group = $pages->find("parent=/designers/, designers_lastname='', sort=title"); What I then need to do is combine these two queries and sort them so there is an alphabetical order, for example... Anni Albers (person) Kate Blee (person) Tord Boontje (person) Commune (collective) Javier Mariscal (person) Studioilse (collective) Any thoughts?
-
I don't think I've ever set it from the page... always from the template... and it's always worked prior to v3. I have tried to remove the setting on the template and set it via the page but even after setting to back to none... it still says it's set per template.
-
They stick
-
I'm not getting any of this... I can move no problem. Am I missing something?
-
Weird... it seems to be doing just that. Anyway, will make sure there's a differentiation just in case.
-
Thanks! How does it know to remove the $bottom results from the $top results? Is that part of import? It's done it for me... so just checking.
-
I also think this idea of if the event start date exists, then make this the published date... $pages->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments('page'); if ($page->article_tags->has("id=1339") && $page->article_event_start_date) { // Event and has blank start date $page->article_published = $page->article_event_start_date; } });
-
Thanks for your help. I really thought I could sort by multiple fields (if that field is blank then it simply skips over it and sorts by the first field). Just to continue with this in a different light... Do you think it's possible to remove pages from the find selector then prepend them to the bottom of the output? For example, most events use the start_event_date field, but ones that don't, instead of showing the date, show either 'Regular' or 'TBC'. Regular is shown if the user selects the checkbox 'article_event_regular' is ticked. TBC is shown if no start or end date is entered. I'm wondering how I could remove these from the selector, but then append to bottom of the result. $articles = $pages->find("parent=/articles/, article_tags=$page, sort=-article_published, end=(article_event_start_date=''), end=(article_event_start_date>=today)");
-
I'm using PW 3.0.30 and there appears to be a bug. If the parent template for some children pages has the 'Sort settings for children' configured to a custom date field (or perhaps any field) I can still manually move/drag and drop the children articles on the Tree. I'm pretty sure this isn't correct and also that this isn't how it worked before v3? Thanks!
-
Thanks, LostKobrakai. I understand. I just thought it would sort it all by published date first, then the ones that have an event date, sort them into the first sort. You know? Can you elaborate on "end=(end_date=''), end=(end_date>=today)" what is 'end'?
-
I have quite a lot of pages, all with a published date field and an event date field. The published date field 'article_published' is a required field but the event date field 'article_event_start_date' isn't so sometimes it won't be used. What I am trying to do is sort the order of pages by published date first, then by the event date, which should mean that if a page has a published date of 08/09/16 and another page has an event date field of 07/09/16 then it would show before the page without an event date. I thought the below would work but it seems to be ignoring the second sort selector. I even tried it without the group and same result. Is this possible? <?php $articles = $pages->find("parent=/articles/, article_tags=$page, sort=-article_published, (sort=article_event_start_date)"); ?> Also, just curious. I also have the date field 'article_event_end_date' but that is also optional. Is there a way to return all pages but exclude those which event end date has passed? I thought 'article_event_end_date>=today' but that isn't returning those pages that don't have the field filled out (whereas it should).
-
This works... why wouldn't simply has(1339) work? <?php if ($article->article_tags->has("id=1339")) : ?>is-event<?php endif; ?>
-
This totally works, Robin. This is great. It looks like the type is just ordered 1, 2, 3 etc based on the position (much like the Options field) so I guess that kind of makes sense but would be good to be able to call the name ('text', for example) rather than the integer. Thanks for the help here. Really appreciated as always.
-
Great, thanks Robin. If anyone could shed any light on the matter (adding specific rows via the api for a RepeaterMatrix) that would be appreciated.
-
I know, via the docs, that we can update a repeater field; but what about a RepeaterMatrix? $building = $page->buildings->getNew(); // I guess here would be a good place to tell it what 'type' to use? $building->title = 'One Atlantic Center'; $building->feet_high = 880; $building->num_floors = 50; $building->year_built = 1997; $building->save(); $page->buildings->add($building); $page->save();
-
I have a standard ckeditor textarea 'article_text' on all pages that use the 'article-detail' template. I am now needing to create a RepeaterMatrix field with one of the types being a ckeditor textarea 'article_content_text'. I now need to find a way to batch move the content of 'article_text' to a RepeaterMatrix row 'article_content_text' on each page. Any ideas with using the API if this is possible? I have over 200 articles so don't fancy manually doing it.
-
This is great, thanks BitPoet. I'm unsure why I didn't think to slice it... so slicing it would effectively create a new instance of the PageArray?
-
Apologies if this has been answered before. I have a simple PageField set up, and on the front-end I'm wanting to split the pages selected into two variables; primary and secondary. I thought this would work but doesn't? $primary_tags = $article->article_tags->not("id=1336|1337|1338|1339|1327|1326|1328"); $secondary_tags = $article->article_tags->not("id=1042|1043|1044|1340|1341"); This is within the loop so $primary_tags should be returning all the pages selected via the PageField EXCEPT the ones listed, and the same goes for $secondary_tags. Any thoughts? Am I missing something?
-
Thanks everyone!