All Activity

This stream auto-updates     

  1. Past hour
  2. ok thanks - will look into that!
  3. Hello, I want to make a from that allows a site visitor to add a sighting. They should enter location (name of the page), a acountry (from select), a subspecie (from select), a remark (text). Also but not implementend a location with leaflet module and a image. Not sure how to do that yet. This is what I have. I already creates a new page on refresh and also only takes the correct template. pagename and other fields are not passed. Please help me to correct this. <h4>Add a sighting</h4> <form method="post"> Location <input type="text" name="name"><br> Country <select name="country"> <?php foreach($pages->get(1022)->children as $country) { echo '<option value="' . $country->id . '>' . $country->title . '</option>'; } ?> </select> Subspecie <select name="subspecie"> <?php foreach($pages->get(1027)->children as $subspecie) { echo '<option value="' . $subspecie->id . '>' . $subspecie->title . '</option>'; } ?> </select> Remark <input type="text" name="body"> E-mail: <input type="text" name="email"><br> <input type="submit"> </form> <?php $p = new Page(); $p->setOutputFormatting(false); $p->parent = $sanitizer->selectorField($_POST['country']); $p->template = 'population'; // example template $p->title = $sanitizer->pageName($_POST['name']); $p->name = $sanitizer->pageName($_POST['name']); $p->body = $sanitizer->text($_POST['body']); $p->save(); echo "page ID {$p->id} created!<br>"; ?>
  4. +1 when it works. Sometimes it doesn't. Other times I have to wait for seconds for the scroll to top to begin. Sometimes I also get in the console:
  5. Hi, In the $page documentation we can read: Would the following then retrieve the full children array and only then pick the desired page: $p->children()->eq($i) My concern is using the above in conjunction with "while", like below: while( $i++ < $limit){ $child = $parent->children()->eq($i); ... Thanks!
  6. Ah right this is part of the hook, sorry, to sort the output (when returning all events). So if I was to go down the route of having a hidden field... that was populated by the latest date that hasn't passed so I could sort by that value then if I had three sets of dates.. on save it would set the hidden field's value to the date that hasn't passed yet but obviously once that date has passed it would need to update it to the next date that hasn't passed (or don't if it doesn't exist). You see it sets the sort date as the second date (as that hasn't passed yet) but when it has it should update the sort date field to the next date but alas this only happens on page save, right? So it wouldn't know to auto update it. $pages->find("template=events-detail, events_detail_dates_sort_date>=today, sort=events_detail_dates_sort_date, sort=name"); function myHook(HookEvent $event) { $page = $event->arguments(0); if ($page->template->name == 'events-detail') { // What's On detail $today = strtotime("now"); $dateRepeater = $page->events_detail_dates; foreach ($dateRepeater as $row) { $row->of(false); if ($row->events_detail_dates_start_date >= $today) { $page->set("events_detail_dates_sort_date", $row->events_detail_dates_start_date); $page->save("events_detail_dates_sort_date"); break; } } } } wire()->addHookAfter('Pages::saveReady', null, 'myHook');
  7. Today
  8. Oh right, that's because you can't use spaces around field/operator/value in selector strings. I was just composing that in the browser. If you change to... if($article->template->name == 'events-detail') { if(count($article->events_detail_dates->find("events_detail_dates_start_date>=$today"))) include './inc/events-item.inc'; } //... ...it should work. Not sure why it would need to auto update apart from when the page is saved. It only needs to update if you are making a change to the page by adding or removing a date. In terms of old dates you exclude those in the $pages->find() selector that gets your results: events_detail_dates_sort_date>=$today
  9. If you are using Page Reference fields there is some limited support for this. See this post:
  10. If you want to add a CSS file so that it is linked at the bottom of the list of admin styles and scripts you can use a hook like this: $wire->addHookAfter('AdminTheme::getExtraMarkup', function(HookEvent $event) { $parts = $event->return; $parts['head'] .= '<link rel="stylesheet" href="/path/to/custom.css">'; $event->return = $parts; });
  11. Update - this now works on UiKit theme, but the method of nullifying the default uikit is somewhat ugly - it basically has to replace the font-awesome css file that is hardcode added to the theme with a blank dummy, and then has to add a copy of the original back at the top of the styles; this is because the FAPro5 styles need to come after the core version in order that the new styles and font are applied.
  12. I made a quick (shabby non-centred) demo of something I've been working on, worked out OBS studio just enough to record this. There's no sound but you get the idea. There's also no sidebar, I thought I'd get the theming sorted first then work out how to incorporate that, I was actually thinking a sidebar with 'favourite' links would be pretty cool, which I guess could be a (process?) module. I'll add that to the bucket list. There was a lot of tracing variables about but I'm pretty happy with the outcome. The different colours are controlled with a single line in my custom theme less file and you see the mouse professionally disappear of screen whilst I recompile. Give us a shout if you want to try it, learning how to use github properly is also on the bucket list
  13. one thing that i would find difficult from the perspective of UI, is that if you click on an image, you lose all context of where you are at, scrolled down – the page scrolls to the top, and even if you close the larger image at the top, it doesn't put you back where you were – this results in an insane amount of vertical scrolling if you wanted to peruse the portfolio items. You may need to either add prev/next navigation to the opened image, or find some other way of presenting the detail of the images when clicked.
  14. The module is now up on Github in case anyone wants to test it or give it a try. Some additional features were added, like the ability to use SimpleMDE for field descriptions (on the field edit screen). There are probably still some things in this module that could be improved overall, but fundamentally it works well and is in heavy use on one site. This module is being used instead of the Admin Help module now in most cases, because typically the info that editors need to access is always about a specific field, so general instructions on the page editor (like in the help tab or lightbox) do not help as much as here, where targeted/contextual info about how to interact with a specific field is a click away.
  15. This is what I ended up with for the hook... $wire->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); if ($page->template->name == 'events-detail') { // What's On detail $today = strtotime("now"); $dateRepeater = $page->events_detail_dates; foreach ($dateRepeater as $row) { $row->of(false); if ($row->events_detail_dates_start_date >= $today) { $page->set("events_detail_dates_sort_date", $row->events_detail_dates_start_date); $page->save("events_detail_dates_sort_date"); break; } } } }); EDIT: Only issue is that it won't auto update... only when the page is saved whereas obviously it would need to update when the date has passed so maybe it needs to check it every day? Is that mad? Or like you said "automatic sort to the repeater items so that the most distant date is always first". I was thinking of using lazyCron (although the $event arguments only return the seconds...) function myHook(HookEvent $event) { $page = $event->arguments(0); if ($page->template->name == 'events-detail') { // What's On detail $page->message("TEST!"); $today = strtotime("now"); $dateRepeater = $page->events_detail_dates; foreach ($dateRepeater as $row) { $row->of(false); if ($row->events_detail_dates_start_date >= $today) { $page->set("events_detail_dates_sort_date", $row->events_detail_dates_start_date); $page->save("events_detail_dates_sort_date"); break; } } } } wire()->addHook('LazyCron::every30Seconds', null, 'myHook'); wire()->addHookAfter('Pages::saveReady', null, 'myHook');
  16. Thanks for this, Robin. I wasn't actually aware you could loop through the repeater using find... some some reason. You were dead right re mixing HTML/PHP. Not sure why I wasn't doing that. I used your example but it spat out an error Exception: Unknown Selector operator: '' -- was your selector value properly escaped? field='events_detail_dates_start_date', value='>= 1511108093', selector: 'events_detail_dates_start_date >= 1511108093' (in /Users/rich/Sites/Sites/ofp/wire/core/Selectors.php line 378) but I've ran with this for now... foreach ($articles as $article) { if ($article->template->name == 'events-detail') { foreach ($article->events_detail_dates as $date) { // Loop through the dates if ($date->events_detail_dates_start_date >= $today) include('./inc/events-item.inc'); break; } } else { include('./inc/pick-item.inc'); } if ($count == $random) { include("./inc/cta.inc"); } $count++; } I like this idea a lot. I think what I would try to do is write a saveReady hook that grabs the date that's not been passed yet, add it to a hidden field, and sort by that. That would work for both one date and 2+ dates, right? As long as I can do my check that would work.. and be fairly robust.
  17. http://www.karenthomasphotography.com/ modules: AIOM+, ProcessPageDelete, TextformatterVideoEmbed. js: isotope, imagesloaded, fitvids, scrollTo, and Jquery with custom AJAX magic.
  18. Needed this, thanks! Seems so obvious afterwards.
  19. In the backend or frontend? Maybe that's what you're looking for: https://processwire.com/api/selectors/inputfield-dependencies/ Similar discussion:
  20. Hi, is there any module which can perform relational drop down, for example I've one drop down which is containing all countries if i select "UAE" the next drop down value will be change on the basis of selected counties and second dropdown will show all cities belongs to "UAE" Thank you.
  21. Thanks @netcarver, that works. I got it working with a switch statement. Not neat but it works. This solution is much neater.
  22. @adrian with your help its working perfectly, i tested it. thanks
  23. thanks @Robin S @kongondo , you both are correct. i will create a page when user is created. Thanks will post the update.
  24. glad you like it and thanks for the compliment yeah... it's not as easy to find in the beginning (and often i'm still searching a lot around the code). but most of the necessary informations are not too hard to find if you look at the code. Inputfields for example have a baseclass here: https://github.com/processwire/processwire/blob/master/wire/core/Inputfield.php Also see somas tutorial about forms (i updated my initial post with the link: https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ ) I'll see what i can do...
  25. Site profiles: yes. Making Processwire out of the box by stuffing the core: no way.
  26. Thanks for this great tutorial! I am impressed by your PW admin UI manipulation skill all time. This tutorial could definitely get someone's hands dirty. Yes it is really quite hard imo because the related information is not easy to find. They do exist but always sit inside various post replies. It just looks like a missing piece to beginners. I long for a more in-depth version of this tutorial, or a complete guide precisely, that shows how to accurately use wiretab, pw-modal, panel, buttons etc. and layout all of them properly. I discovered a bit from reading through the core files and modules by trial and error but I believe I still have a long long way to go. I believe many people, like me a while ago, stuck in the layout phase and then give up their modules development.
  27. Yesterday
  28. @webhoes Can you try changing to the following and see if that sorts it out... // from this... $marker_options['markerColour'] = $page->subspecie->population_color_name; // to this... $marker_options['markerColor'] = $page->subspecie->population_color_name;
  1. Load more activity