-
Posts
812 -
Joined
-
Last visited
Everything posted by a-ok
-
Hi folks, I have some tags setup, using the Page field options, which is really flexible and works great. However, I am curious to know if it's possible to view multiple tags at any one time? Is this possible? For example, I know to create a tag page (for example, www.domain.com/tags/events), you do the following: <?php $tags = $pages->find('parent=/projects/, tags=' . $page . ', sort=sort'); ?> Is it possible for a query to exist so you can view multiple tags? www.domain.com/tags/events&films&outdoor Any thoughts? Good, bad? Cheers! R
-
Allow Page Numbers isn't 404'ing when content doesn't exist...
a-ok replied to a-ok's topic in General Support
Thanks, this makes lots of sense now. Really appreciated and can understand why it's important that it is left as flexible as possible.- 15 replies
-
- pagination
- page numbers
-
(and 1 more)
Tagged with:
-
Allow Page Numbers isn't 404'ing when content doesn't exist...
a-ok replied to a-ok's topic in General Support
I've had to do: <?php $fourohfour = $config->urls->root . 'http404/'; ?> <?php if (!$journals->count() && $input->pageNum != 1) $session->redirect($fourohfour); ?> Which in my console shows: XHR finished loading: GET "http://localhost/Freelance/5th-studio/journal/page3" GET http://localhost/Freelance/5th-studio/http404/ 404 (Page Not Found) So, this fixes things for me, but the issue still lies... why would it retrieve /page8/ when nothing exists on it? Surely the 'Allow Page Numbers' shouldn't work infinitely and eventually when it returns blank auto 404s? And why doesn't 'throw new Wire404Exception()' actually throw a 404 page but rather include it in the template rather than a full refresh like a normal 404 page should do?- 15 replies
-
- pagination
- page numbers
-
(and 1 more)
Tagged with:
-
Allow Page Numbers isn't 404'ing when content doesn't exist...
a-ok replied to a-ok's topic in General Support
So what exactly does 'throw new Wire404Exception()' do?- 15 replies
-
- pagination
- page numbers
-
(and 1 more)
Tagged with:
-
Allow Page Numbers isn't 404'ing when content doesn't exist...
a-ok replied to a-ok's topic in General Support
To reiterate my point above... if I go to the following URL... https://processwire.com/docs/tutorials/how-to-use-url-segments/page99 it works, even though it shouldn't, but if I go to https://processwire.com/docs/tutorials/how-to-use-url-segments/dfdsfs it 404s. If I set up my code, like you suggested, and use throw new Wire404Exception()... it doesn't treat it like the second URL, it just shows my 404 template but keeps the same URL /page99- 15 replies
-
- pagination
- page numbers
-
(and 1 more)
Tagged with:
-
Allow Page Numbers isn't 404'ing when content doesn't exist...
a-ok replied to a-ok's topic in General Support
Hi @LostKobrakai, many thanks for this. This is the sort of solution I was after... however this doesn't seem to throw a 404 even when I am on /page7/ where only /page3/ was the last page that had any content. <?php $journals = $pages->find('parent=/journal/, sort=-journal_date, limit=1'); ?> <?php if (!$journals->count() && $input->pageNum != 1) throw new Wire404Exception(); ?> I've actually worked out that it is bringing in my 404 template, but keeping the URL as /journal/page7/, for example, so infinitescroll is thinking this is just another page and not actually a 404...- 15 replies
-
- pagination
- page numbers
-
(and 1 more)
Tagged with:
-
Allow Page Numbers isn't 404'ing when content doesn't exist...
a-ok replied to a-ok's topic in General Support
Thanks for the replies but I think you're missing the point. The issue is not to do with infinite scroll, but rather Processwire and how it doesn't run a 404 page when there is no more content on Allow Page Numbers...- 15 replies
-
- pagination
- page numbers
-
(and 1 more)
Tagged with:
-
Hi folks, I've set up some infinitescroll on manual trigger on a Journal section of my site, all fine and set up, but there's a slight issue that the 'Allow Page Numbers' isn't returning a 404 even when there isn't more 'pages'. So, the infinitescroll never fails... or stops. For example, I have a /journal/page1 which is fine, and has posts, and a /journal/page2 but then, technically, /journal/page3 shouldn't exist as all the last post is on page2, but even if I put /journal/page99 it still returns a page, rather than a 404. Looking at the tutorials, this is even the same for the tutorial: https://processwire.com/docs/tutorials/how-to-use-url-segments/page99 I know I need to build a throw new Wire404Exception(); into my template, but I am unsure how to manage this? Any thoughts? Thanks! R
- 15 replies
-
- pagination
- page numbers
-
(and 1 more)
Tagged with:
-
Amazing... thanks! I didn't think you meant 'repeater_' but by enabling the View System Templates it makes sense now A great solution, thoughts!
-
Thanks, LostKobrakai but it still doesn't seem to work; are you sure it's template=repeater_name? template=practice_publication, include=hidden
-
Return rows of a repeater if a select field matches...
a-ok replied to a-ok's topic in General Support
Thanks for your reply, diogo. This seemed to have worked for my top query, but it has also affected my bottom query to return the same thing? <?php $guides = $pages->get('/practice/publications/'); // Sector Guides ?> <div class="container-fluid"> <div class="row"> <div class="col-xs-12 col-sm-12"> <h2 class="publications-type-subtitle">Sector Guides</h2> </div> </div> <div class="row"> <div class="publication-container guide"> <?php foreach ($guides->practice_publication->filter('practice_publication_type=2') as $guide) : ?> <div class="each-publication guide"> <?php if (count($guide->practice_publication_image)) : ?> <?php $resized = $guide->practice_publication_image->width(400); ?> <div class="image-container"> <a href="<?php echo $guide->practice_publication_download->url; ?>"> <img class="lazy loading" src="<?php echo $config->urls->templates; ?>img/1x1.gif" data-original="<?php echo $resized->url; ?>" data-medium="<?php echo $resized->url; ?>" /> </a> </div> <div class="text-container"> <p><?php echo $guide->practice_publication_title; ?></p> </div> <?php endif; ?> </div> <?php endforeach; ?> </div> </div> </div> <?php $articles = $pages->get('/practice/publications/'); // Articles ?> <div class="container-fluid"> <div class="row"> <div class="col-xs-12 col-sm-12"> <h2 class="publications-type-subtitle">Articles</h2> </div> </div> <div class="row"> <div class="publication-container article"> <?php foreach ($articles->practice_publication as $article) : ?> <div class="each-publication article"> <?php if (count($article->practice_publication_image)) : ?> <?php $resized = $article->practice_publication_image->width(400); ?> <div class="image-container"> <a href="<?php echo $article->practice_publication_download->url; ?>"> <img class="lazy loading" src="<?php echo $config->urls->templates; ?>img/1x1.gif" data-original="<?php echo $resized->url; ?>" data-medium="<?php echo $resized->url; ?>" /> </a> </div> <div class="text-container"> <p><?php echo $article->practice_publication_title; ?><?php if ($article->practice_publication_date) : ?> <?php echo $article->practice_publication_date; ?><?php endif; ?></p> </div> <?php endif; ?> </div> <?php endforeach; ?> </div> </div> </div> -
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
-
Thanks for this LostKobrakai. So if I replaced the following, in the 'Custom selector to find selectable pages' parent=/login/repeaters/for-field-144/for-page-1033/ for template=practice_publication it not longer works... should it? Or have I got the wrong end of the stick...
-
Thanks, guys. This all works great! And I can choose the label to be the title field within the repeater... ALL GOOD!
-
Ah right, yes thanks this makes sense. In the 'Custom selector to find selectable pages' field, for a PageField, I have put: parent=/home/repeaters/for-field-112/ but it returns nothing... is this the actual path to admin repeaters?
-
Thanks for the reply! Are you sure they are? So, for example, how could I use the 'Custom selector to find selectable pages' to grab a repeater? You see what I mean?
-
Also, see attached. Is there a way to do the following but have each 'entry' within the year selectable via a Page field or similar? Or would each 'exhibition' need to be a page? It's only text so seems a little weird to do it this way.
-
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
-
Checking array for a value (might be more PHP question than PW... sorry)
a-ok replied to a-ok's topic in General Support
It's not directly related to parents, it's related to a pageArray, and @diogo said: So regardless I assumed parents would also work? -
Checking array for a value (might be more PHP question than PW... sorry)
a-ok replied to a-ok's topic in General Support
@diogo, I would just like to say, however, that this doesn't work: <?php if ($page->parents->has(1025)) : ?> -
That's really great, Wanze. I didn't think about getItemKey so that has helped me loads. Really appreciate the time here.
-
Hi Wanze, thanks for your reply. Unfortunately sort doesn't work. Do you know how'd find the position of the current page inside the children() array? Is this in the documentation somewhere?
-
Hi folks, I am trying to create a counter for items within a section... so say you have a Projects section, on each 'project detail', I'd have a counter and it would say this is page 1/25, for example. I have the total count, but I'm not sure how to echo out which position/number the current page you are viewing is. <?php echo $page->eq() ?> / <?php echo $page->parent->children()->count(); ?> Any thoughts? Thanks!
-
Hi folks, I have been using PW for a while; and on every build it seems to perform really well and always have the ability to do what I need. Thanks everyone! I have a site coming up that I want to be involved in but it has some features that I feel PW won't be able to handle... Here's the list... Time banking system, interactive map, complex search criteria, calendar/events, login/registration states with payment (subscription?) and profile, front end profile views, internal messaging systems with approval levels and news Most of these I know I can handle, but the ones I am unsure of are time banking system, login/registration states with payment (subscription) and profile, front end profile views and internal messaging systems with approval levels. Has anyone ever had any experience with the above? Do you think any of this is possible on PW? I know I am asking a lot of questions but any help would be appreciated. I think most things are self-explanatory but the time-banking system, I'm assuming at this stage, is essentially a bit of a messaging platform where you post requests, record hours and have a statement of those hours. The best example I could find seems to be from the 90s, but to be fair it seems robust (http://hourworld.org/_TimeAndTalents.htm) Any help or advice would be really appreciated. Cheers, R
- 4 replies
-
- features
- processwire
-
(and 3 more)
Tagged with:
-
Okay so based on a response to another query I had previously about exploding arrays, I did the following, which seemed to have worked: <?php $featured = explode('|', $pages->get('template=home')->home_featured_items); ?> Then within the loop <?php foreach ($projects as $project) : ?> I did <?php if (in_array($project->id,$featured)) : ?> featured<?php endif; ?> And it works. Any thoughts on this?