Search the Community
Showing results for tags 'limit'.
-
Hi, have a site where I set up a news category, then under that I have different regions where editors in those regions can add news stories. I'm trying to figure out how to allow each editor to only add/edit stories in their region, and not allow editors from other regions to edit them. example: News (template:news-category) Washington County (template:news-region) My First News Story for Washington County by Editor 1 (template:news-article) Jefferson County (template:news-region) A News Story by the jefferson county editor (template:news-article) Taylor County (template:news-region) A news story by a Taylor county editor (template:news-article) I really don't want to create 3 different news-region templates along with 3 different news-article variations, and 3 different types of Editor roles. Is there a way / module that will let me say, "jane which is an editor can only add and edit to Washington County" and "bill which is an editor can only add or edit to Taylor County", etc? Also, it would be nice to allow the "home office" editor to add/delete/modify contents created by the other editors, a "Super Editor" if you will. Thanks mucho!
-
Hello Community ? Has anyone ever tried having multiple elements on one page that get their info with $pages->find('selector, limit=n') and tried using pagination on one of these elements without effecting the other? I have a slider on a page where I display content with pagination. But when I go to page two, the slider content also goes to page two, which I don't want it to do ? Any tips are greatly appreciated! Thanks! -Peter
-
Hello guys. I am super happy to be passing to the final cleanup of my first custom build theme and to start applying the SEO optimization modules/code. I noticed something strange this morning and can't find out where exactly is my issue. Hopefully it is a quick fix or silly miss on my side. So here is the issue: I am generating a list of all my recipes in the db using the following query: <?php if($page->numChildren) { //Build a selector and limit page results to 10 $recipe_results = $page->children("limit=4"); //Assign results of the array to $listing foreach($recipe_results as $index => $listing) { //Limit the text content to 160 chars using the function in function.php $text = $sanitizer->textarea(truncate("$listing->recipe_intro_text", 160)); ?> Then follows the boring part of html insert of the variables, clases etc. The listing works fine. So as far as there would be more than the planned results per page, I implemented the page rendering using the following code: <!-- Pagination --> <?php echo $recipe_results->renderPager(array( //Show font awesome right hand icon for next page 'nextItemLabel' => __("<i class='fa fa-hand-o-right'></i>"), //Show font awesome left hand icon for previous page 'previousItemLabel' => __("<i class='fa fa-hand-o-left'></i>"), //Define the active class of current page 'currentItemClass' => "current", //Define the block markup code 'listMarkup' => "<ul class='page-nav'>{out}</ul>", //Define the item markup code and applying currentItemClass 'itemMarkup' => "<li class='{class}'>{out}</li>", //Generating the link appearance of all buttons 'linkMarkup' => "<a href='{url}'>{out}</a>", )); ?> <!-- Pagination --> And again, everything worked perfectly after I allowed page numbers. So then I implemented a few similar queries in the sidebar of my website, listing content from other page parents/children. Here is one example: <?php $favorite_books = $pages->find("template=books-inner, sort=-random, limit=3"); foreach($favorite_books as $b) { if (count($b->book_images)) { $thumb = $b->book_images->first->size(70,60)->url; $desc = $b->book_images->first->description; } else { $thumb = $settings->small_thumb->url; $desc = "NoThumb"; } ?> <li> <div class="thumb"> <a href="<?php echo $b->url?>"> <img src="<?php echo $thumb?>" alt="<?php echo $desc?>"/> </a> </div> <div class="detail"> <a href="<?php echo $b->url?>"><?php echo $b->title?></a> </div> </li> <?php } ?> It was all working fine, until I started browsing page 2, 3, etc. It appears for some reason, that the pageRendering is applied not only to $recipe_results, but also to all requests from the widgets. So on page 1, I get the proper number of recipes and proper number of results in the widgets (books in this example). If I browse to page two, I still see the proper recipes number and everything else, but the widgets show only 1 result (as far as I have imported 4 test posts only). On page 3, it shows notihing in the widgets, but recipes are OK again. As far as to render pages I am using $recipe_results and the pageRender is called for that variable, I am not sure why it is also applied to $favorite_books and other widgets. Any suggestions or ideas what is going on? I tried to change every variable on the page thinking that I might be having a call to the same one, but it is obvious in the example that they do not match...
-
Is it somehow possible to limit the number of pages one can select with the page reference field? I have a case where I need to have exactly three, not more, not less. Is this doable with a hook? Or would you suggest another approach? (three single pageref fields and make each mandatory)
-
Hello together, I have a problem with the image field and in my case it seems that there is a limit of how much images can be in such field. The following case: I have around 20 pages. Each has a usual image field, where I can upload an unlimited number of images (array). Most of the pages got 50-200 images but one page got 411 images (I know, it’s much ) Now, when I change the order of one image (let’s say I drag & Drop the first image after the third) or delete one image by clicking on the trashcan, everything runs fine. BUT when I click SAVE the image won’t be deleted or moved to it’s new place. You can change anything else on the page - I have a text field there - and save it, no problem. Interestingly I can add (upload) new images but I’m not able to delete or move them. - The file size of the images are between 200kb and 1.7MB, RGB, JPGs. - When I duplicate the page and try to delete/move I got the same problem. - I also created a whole new page and got the same problem - Also tried a different server (virtual and online): same problem - ProcessWire 3.0.62 So, is there a limited to the images field? Any clues except limiting the image files to max. +-200 images? Thanks so much in advance and have a great weekend. Thomas
-
I'm sure the answer is fairly simple but I was wondering if there's an easy way to define the number of lines for a textfield in a template. I know you can set size limits for images fairly easily using $image->size(100, 100); but wondered if there was the equivalent for text?
-
I have about 50 pages which are just containers for their child pages. What's the most efficient way to exclude these parent pages from Searches? I'm using Ryan's code here I guess I have a few options but is number 2 here the best way or is there anything I haven't considered which would be better? 1. Mark as 'Hidden: Exclude from lists and searches" Isn't an option because it hides from lists which I use. 2. Tell the selector to ignore a particular template(s) Sounds like a good approach 3. Create my own checkbox called "Search Ignore" and add it into a selector Could work but it seems like a ton of work to manually edit all the pages I want to ignore Cheers
-
Hi folks, My maximum file size upload tops at 50Kb, no matter what the browser or OS. My PHP settings are: enabled extensions: imagick, imap , json, mailparse, mbstring , pdo , pdo_mysql and pdo_sqlite options: allow_url_fopen On display_errors Off error_reporting E_ALL file_uploads On include_path .:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php log_errors On mail.force_extra_parameters no value max_execution_time 180 max_input_time 180 max_input_vars 1000 memory_limit 256M open_basedir no value post_max_size 128M session.save_path /tmp short_open_tag On upload_max_filesize 256M These settings here changed based on some tips of other topics on this forum. On the field, there is no min/max image dimensions. Thanks!
-
I am using the below to go several levels deep, but when using a select of "limit" or "sort" I am getting strange results. For example, if limit=2 I get five results. If limit=3 I get six results. I am sure I have messed up something. Maybe there is a better way? $cats = $pages->get("/mypage/")->children; // get children of the parent foreach ($cats as $cat) { $menu .= "<div>"; $menu .= "<h2 class='titlebg'>$cat->title</h2>"; if($cat->children) { // if they have children $menu .= "<ul>"; foreach($cat->children as $subchild) { foreach ($subchild->children("limit=2, sort=-date, sort=title") as $child) { $menu .= "<li><a href='{$child->url}'>$child->title</a></li>"; } } $menu .= "</ul>"; } $menu .= "<span><a href='{$cat->url}'>See More</a></span>"; $menu .= "</div>";
-
Hi, I have a PageTable field where one template type should only be used once per PageTable as otherwise it will break the lazy-loading pagination on the front-end. Is there a way to limit the number of times a template is used? I think I basically need to create a module that... Checks children of specific template for 'date_listing' template If one child is using the template, disable this template from being available for new pages under that parent Disable the button on the PageTable field for creating a new page with 'date_listing' template (1) is pretty straightforward but (2) and (3) have me puzzled - is it possible to disable template use dynamically?
-
Hi, I have some pagination on my page, which is pretty bog standard. $allChildren = $page->find('template=blog-article, limit=10, sort=-article_date'); The limit is set to 10 as I want to show them 10 articles at a time. The articles are displayed side by side, so there is 5 rows of 2 article. I am using infinite scroll plugin (which doesn't really matter). However the first article is a featured article and displays full width, so this leaves me with an odd article at the end. - - - (1) - - - - (2) - (3) - - (4) - (5) - - (6) - (7) - - (8) - (9) - - (10) So really I need the first page to show 11 and then on other pages for it to be 10. - - Page 1 - - - - - (1) - - - - (2) - (3) - - (4) - (5) - - (6) - (7) - - (8) - (9) - - (10) (11) - - - Page 2 - - - (12) (13) - - (14) (15) - - (16) (17) - - (18) (19) - - (20) (21) - - - Page 3 - - - (22) (23) - - (24) (25) - - (26) (27) - - (28) (29) - - (30) (31) - Is this possible? Any pointers would be much appreciated! Thanks, Craig
-
Hi. I wonder if is there possibility to limit page children to specific template. I know that it can be done in template settings. But I think it could be good option to do it in page settings. Lets say we have templates like news, gallery, author, tag, movie, song itc. We have also pages with the same names. If we want page 'Video' to accept children only with template 'video' we need to create template like 'videos-container' and set it to accept only children with template 'video'. And so on with other pages and teplates. It ends with many 'empty' templates which role is only limitation child templates in specific pages. If we could limit children templates in page settings it would be enough to have one template like 'common-container'. PS: sorry for my bad english.
-
Hi, Run into a bit of an issue with pagination on a site I am working on. I am sure the answer is really simple, but struggling to figure out what's going wrong. I have a bunch of articles, but I only want the ones where the date is less than the current date. I then want to limit the array so that I can paginate it. <?php $allNews = $page->children("template=news"); $oldNews = new PageArray(); foreach($allNews as $article) : if(strtotime($article->date) <= strtotime('now')): $oldNews->import($article); endif; endforeach; $oldNews = $oldNews->find('limit=2, sort=date'); echo $oldNews->renderPager(); foreach ($oldNews as $article) : ... endforeach; ?> The limit is being applied, however I don't see any pagination and navigation to the different pages returns the same first two articles. Any help would be much appreciated. Thanks, Craig
- 6 replies
-
- pagination
- pageArray
-
(and 1 more)
Tagged with:
-
I used a repeater field on my site to handle arrest reports. (It's much easier for the user than say adding a new entry for each person arrested as you would a new page). Basically, my client creates a new entry with the arrest report section then starts adding repeater "records" and data which include: name dob offense mugshot ... repeat the above for each offender This is a small county newspaper and we rarely have over 100 arrests listed per report. I noticed when about 60 repeaters are added after that I get a server timeout when trying to edit the page. I bumped up max_execution_time to 90 seconds and I get a 500 error. When I set max_execution_time to 60 seconds it loads -- but that is really pushing it. It was my belief that the Repeater field type could handle lots of repeaters, with the exception of getting into say a thousand or more, but 60-70? This may take care of it for this project, but, I'm thinking about future projects. I noticed that ProFields has a Table field type and watched the video, however, I didn't see any option of adding an image field in there. Is that possible? This would allow for fast entry of data with the addition of an image for each record. Any other suggestions are appreciated. thanks.
-
Hi, I'm working on implementing a poll system with a variable number of choices that a user can vote form (via a submission form). Currently, each poll question is stored as a page with each choice being a child of the Poll page (as seen below). Additionally, each choice has a "votes" field which tracks the number of votes a particular choice gets. --Poll ----Choice 1 ----Choice 2 ----Choice 3 However, I'm unsure how to limit the number of times a user can vote on a particular poll. Ideally, I would like to allow a user to vote once a day (every 24 hours), so I'm assuming I would have to do this by logging the user's IP address each time a vote is cast. I'm assuming that this would need to be done automatically by the voting function and I would need to track this by adding a "Vote Tracker" child page or something similiar and adding child votes to it each time that would include an IP address and the date/time it was cast, however this seems a bit cumbersome, especially as I would need to make sure there was a "Vote Tracker" child for each Poll, sort of as seen below: --Poll ----Choice 1 ----Choice 2 ----Choice 3 ----Vote Tracker ------Vote1 (contains IP address) ------Vote2 ------Vote3 ------...etc I guess I'm just curious if there is a better way to do this, or if there is any way to attach an array to each poll that could store the same information. Thanks!
- 2 replies
-
- poll
- ip address
-
(and 2 more)
Tagged with:
-
Hello. I'm developing website for restaurant network, and I use repeater field for menu (meals). Page has repeater field, named "menu". It has 2 fields - title (multilingual - 3 languages) and price. 150 repeater entries are created and save normally. Starting from 151 when I fill new repeater row and click save, PW shows success message but 151st row isn't saved. How can I fix this problem? Or can you suggest any alternative method for storing such data? Using page for each row is very hard for editing. Thank you in advance! I forgot to notice one thing, when I use debug tools I see that the data from 151st is passed in POST array.
-
Is there a way to limit the repeater entry on the admin? for example, user can only enter a max of 10 entries
-
Hi everybody, I have got a (hopefully) pretty simple question but I can't find a "clean" solution for it and hope you can help me. I'm using a form to let the user specify different variables (Get Request) and show them the according pages. It's more or less similar to the Skyscraper Demo page. Now I'd like to add three links to set the limit of my query. So if the user clicks on e.g. 10 -> only 10 pages should be listed (leaving the other variables the same). I'd like to generate links with the current URL but change the limit variable. Is there a function to get the current URL with all the get parameters and let me change/add one of them? Or do you have any other suggestions how I could add this functionality? Thanks for your help!
-
Am trying to list 3 other events (siblings) at the bottom of an event page. My problem is I can only seem to limit before I remove the $page part meaning I end up with only 2 other events at the bottom of the page. Have tried the following but doesn't seem to work: $page->siblings->remove($page); $events = $page->siblings("limit=3"); I've tried various things but perhaps someone more knowledgeable could point me in the right direction? Thanks