Jump to content

bernhard

Members
  • Posts

    6,629
  • Joined

  • Last visited

  • Days Won

    358

Everything posted by bernhard

  1. hm... now this is weird thanks for clarifying - yes, i have more than 3 pages with non-empty answers. see the screenshot - does anybody has an idea what could be going on?! the field's name is "answers" (see line 2 of console). maybe this is related to my multilang setup? shouldn't that be irrelevant? thanks for your help!
  2. Sorry for being unclear! I would have expected the second to also return five pages but it only returns 3. Thanks for the link szabez, that's a very similar problem but in my case it should also work with the answers.count>0
  3. thanks for the topic kongondo i'm still missing proper code completion / intellisense support so i would be happy to get some tips in this regard! thanks
  4. hi! very strange... i have several feedback-pages that store feedback values in repeaters. i want to show the last 5 feedbacks to my users and did a selector like this: foreach(pages("has_parent=$project, template=feedback, sort=-modified, limit=5") as $p) { d($p->answers->count()); } this works as expected, but we added some feedback-pages and they show up in this list. so i wanted to exclude them by only showing items that have at least one answer in the answers repeater: foreach(pages("has_parent=$project, template=feedback, answers.count>0, sort=-modified, limit=5") as $p) { d($p->answers->count()); } the results are: // first code example 7 0 4 0 7 // second example 7 4 7 any other ideas how i can only show modified pages and NOT newly created ones? thanks
  5. are you talking about any kind of automated testing? or manual testing for hand picked use cases?
  6. i think i would create a single blog-entry template with a repeater holding one ckeditor body-field. 1 repeater entry = single page blogpost more repeater entries = blogpost with multiple pages based on url-segments you could show the corresponding repeater item. without url-segment it would show the first. all other content would always be the same (like a comment section, for example would show up on all pages, like here: http://processwire.com/docs/tutorials/hello-worlds/ )
  7. this looks great, thanks for sharing! i hope we can get the drag image support into processwire too. that's one of the few things that always needs some explanation for my clients...
  8. hi macrura! nice to see the progress. i hope nobody gets me wrong but i still think that going with native pw modules (fields) could have some real benefits. i try to explain what i mean and how i came to that opinion... my first impression when i saw your screenshot was, "very nice". i then asked myself how easy that could be built with a process module and InputfieldMarkup... The dashboard example would be quite easy, consisting of only 3 fields with some markup. but still it would need some coding, of course - and that might be a little more work and a little more time needed than your quick ckeditor solution. but still i'm confessed that working with native pw fields is much cleaner than hacking around with hanna codes and several nested tags inside a ckeditor field. that feels like i get thrown back to my old joomla days where we had only this one huge content field and had to do all the magic with messing around with tags and replacements and so on i hope you get what i'm trying to say. btw: i was thinking if i'm messing up your thread with my post, but as it is a preview thread i think discussion should be welcome now my idea that could combine both worlds: first i thought, "why not using some InputfieldMarkup for the content instead of the whole Process?". you are creating a process page that renders one field of a selected documentation page. i thought, what if we had some fields on that page where we can select the content that gets rendered. then i thought we already have this kind of fields: InputfieldRuntimemarkup. So we would need a quick and easy way to arrange those fields! We already have it: The template editor. I'm using ProcessPageEdit all around my CRM application and it works well for presenting data. It has a clean interface and all you need for arranging your content (fieldsets, tabs, toggles etc - i already mentioned that in my post above). So what if we showed the ProcessPageEdit of the documentations page directly to the user? Admins could modify content quickly and easily and for users we could set the visibility to "locked". this would result in something like that: ckeditor fields would get rendered as HTML, image fields would get rendered as gallery and we could do whatever we want with RuntimeMarkup fields. We would have all the built-in pw magic, we would have a consistant styling (for all admin themes, not only for the one your stylesheets are optimized) and many other benefits. what do you think?
  9. that's exactly what i mean nothing will work better than process modules but i get your point. and for simple documentation and text it's for sure easier to type some text into a textarea than writing it into modules. but as soon as it gets to some more complex content i would strongly recommend going with process modules. it's easier than one might think! but we are getting offtopic. @Macrura thanks for sharing this! its a very welcome and much needed addition
  10. that's exactly what process modules do there's no need to write a processmodule that renders custom php if a processmodule itself already renders custom php. the key is to use pw's built in inputfields, especially InputfieldMarkup. then you have a consistent UI and all the features that the pw admin offers by default (toggling fields, setting widths, fieldsets, ajax loading etc).
  11. ah, thanks, you are right ok, so now i get 15seconds. if you really need the count-labels it seems you would need to implement some caching...
  12. you have 175 labels showing the tree count: i tried a loop with 200 iterations on my test-install with the SLOW selector from my above example and got all the counts within 500ms: so i think it should be no problem to get the site to returning results plus all the filter count-labels under 500ms. but as i said in my pm: that can only be a wild guess as we don't know any details about your setup.
  13. i think you need to do some more debugging! i just played around with a local test-setup and got this results with 10.000 pages: creation of pages: //foreach($pages->find('parent=8181') as $p) $pages->delete($p); $i=0; $tmp = range('A', 'Z'); while($i<10000) { $p = new Page(); $p->template = 'filtertest'; $p->parent = 8181; $p->title = "test$i"; $p->a = $tmp[array_rand($tmp)]; $p->b = $tmp[array_rand($tmp)]; $p->c = $tmp[array_rand($tmp)]; $p->save(); $i++; } dump (results): d($pages->find('template=filtertest, a=a, b=b')->each('title')); array (13) 14.48ms, 0.09 MB d($pages->find('template=filtertest, a|b|c=a|b|c')->each('title')); array (3084) 1110.54ms, 6.54 MB d($pages->find('template=filtertest, a|b|c%=a|b|c')->each('title')); array (3084) 1339.68ms, 6.54 MB your filter function looks totally weird to me. you have ID values as filter but then you use the slow %= selector. why? see my first example using " = " as selector should give you an instant result! also i don't understand why you are using the OR operator ( | ) for searching different fields. is the information spread over multiple fields?? shouldn't every filter-value be stored in a separate field? PS: my template "filtertest" has fields A, B and C holding letters from A-Z PPS: are you sure the selector is slowing the site down? maybe it is the way you count your number of results in the filter sidebar?
  14. @szabesz i disagree about that suggestion. i think it could open more room for bugs and overcomplicate things than it is useful... things are already a little "buggy" when having multiple non-fullwidth fields with showif-dependencies. @ryan it would have been nice to get some feedback about the problems with the forum that occured over the last days:
  15. One very easy and effective solution is to use honeypots. Ryan also uses this technique for Formbuilder and has (like me) very good results. Just remember to turn off the autofill option for the input to prevent the browser from filling your hidden field and marking it as spam.
  16. if you tell us why you did this we might suggest another solution for example you could create a page with a file field. then you would have an easy to use file uploader with all the other pw features like access control and so on and you could access the file via it's url ( /site/assets/files/1234/your-file.txt ). that might or might not be a better solution depending on your usecase...
  17. i also switched from sublime and overall like vscode a lot. only thing missing is a proper intellisense/code completion so i would be very interested in seeing how that works for you thanks!
  18. thanks @abdus , i think i have to give phpstorm (a second) try. i also needed 2 attempts for processwire, so maybe that's a good sign
  19. could you please provide some insights on how you are using it? i'm also using vscode because of a recommendation here in the forum by @fbg13 and like it so far, but i would love to see how others do
  20. what is the built in debugging? again my recommendation: use tracy you'll get nice info like this: https://processwire.com/blog/posts/introducing-tracy-debugger/#bardump you could just do a bd(ukBlogPosts($posts)) and see what this function returns and why count(ukBlog...) returns 1. you could also see the docs to this function in the code that says that it returns a string: https://github.com/ryancramerdesign/regular/blob/master/site-regular/templates/_uikit.php#L720 ... so count() correctly returns 1 ---------- but back to your initial question: i think it would be much easier to just use the API and forget about the uikit functions that are shipped with the profile! in your case it would be as easy as this: <ul> <?php foreach($pages->get('/categories')->children as $cat) { echo '<li class...>' . $cat->title . ' (' . $cat->numChilrden(true) . ')</li>'; } ?> </ul>
  21. robin, you are right. but his wordpress example is also a simplified "sitemap" only showing all pages on the site (if i understand this weird wordpress code correctly ) the equivalent in PW would be something like this: foreach($pages->find('has_parent=1, has_parent!=2') as $p) { echo "<h1>{$p->title}</h1>"; echo $p->body; }; edit: this would mess up the sort, but i think the wordpress example is also not a proper real-life example so it should be a valid comparison...
  22. great to hear that you are working on that, indeed very needed! how do you plan to send the emails? imho it would be nice to be able to easily integrate services like https://www.sparkpost.com or https://sendy.co/ . i'm not sure but i think for large amounts of emails it is better to use some kind of substitution based sending method (https://developers.sparkpost.com/api/substitutions-reference.html ). good luck for this module and have fun
  23. Those kind of errors can easily be debugged with Tracy. Just install it and then you can do a bd($yourvar) and see what your variable is internally. In your case it would be null, so your get() is wrong somehow. On mobile, so I hope this already helps
  24. maybe a nice showcase of what can be done with processwire with VERY little code
  25. https://www.baumrock.com/portfolio/event-voting-tool-social-impact-award/ Another nice little Showcase of what can quickly be done with Processwire I sponsored this voting tool for the Austrian Social Impact Award ceremony (https://socialimpactaward.net/) helping them to pick the winner of the audience voting. The site is based on the default UIKIT theme (obviously) and i basically just placed the logo + changed the colors. The site structure is also very simple, having only one parent to store all teams, one parent to store all votes and one page to show the results (to the admins): The Projects-Template stores some informations of the project and the vote-count: All the votings are single pages as well having only one checkbox, ensuring that every code can only vote once (every visitor got one code at the entrance): Votes are created via Tracy Console as easy as that: The hook that creates the passwords is also simple: /** * create unique code for voting */ $wire->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); if($page->template != 'vote') return; if(!$page->title) { $rand = ''; while(!$rand OR pages("title=$rand")->count() > 0) $rand = randomPassword(); $page->title = $page->name = $rand; } }); And finally the check if the vote for this code is already done (inside the vote-template). the whole vote-template is as simple as that (thanks to the awesomeness of markup regions and functionsapi): <?php namespace ProcessWire; // handle votes (url segments) if($id = $sanitizer->int($input->urlSegment1)) { // if voting is locked redirect to thankyou message if($page->votingdone) $session->redirect($page->url); // else set voting $team = pages($id); if($team->id) { // increase voting for this team $team->setAndSave('votes', $team->votes+1); // lock this votings page $page->setAndSave('votingdone', 1); } } ?> <?php // if voting is done show thank you and lock page if($page->votingdone): ?> <region id="main"> <div class="uk-card uk-card-primary uk-card-body uk-width-1-1 uk-margin-small-top uk-text-center uk-border-rounded"> <h3 class="uk-card-title">Danke für Ihre Teilnahme!</h3> </div> </region> <?php return; endif; ?> <region id="main"> <div class="uk-text-center uk-margin-top"><?= $page->parent->body ?></div> <?php foreach(pages('template=team, sort=random') as $team): ?> <div class="uk-card uk-card-default uk-card-body uk-width-1-1 uk-margin-small-top uk-border-rounded"> <h3 class="uk-card-title uk-text-center"><?= $team->title ?></h3> <ul uk-accordion="collapsible: true"> <li> <p class="uk-accordion-title uk-text-center"><span uk-icon="icon: chevron-down"></span> Beschreibung anzeigen</p> <div class="uk-accordion-content"> <?= $team->body ?> </div> </li> </ul> <a href="<?= $team->id ?>" class="uk-button uk-button-large uk-button-primary uk-width-1-1 uk-border-rounded">Für dieses Projekt abstimmen</a> </div> <?php endforeach; ?> </region> I'm still impressed by ProcessWire and how much can be achieved with how little effort
      • 23
      • Like
×
×
  • Create New...