Jump to content

bernhard

Members
  • Posts

    6,648
  • Joined

  • Last visited

  • Days Won

    365

Everything posted by bernhard

  1. i would suggest doing the following: create a new template file for your page that holds the map data with exactly the code from the google example (javascript + html): https://developers.google.com/maps/documentation/javascript/examples/map-simple?hl=de change nothing but your api-key. when you view this page you should see the same map as on the google docs page. replace the fixed values for lat/lng/zoom by those saved in your processwire site. see my example above ($page->map->lat...) view your page, it should show the map at the position that you specified in your backend change your style by adding the styles options (see code below) view your page, you should see the new style if everything works, try to implement your map in your original template file var map; function initMap() { map = new google.maps.Map(document.getElementById('map'), { center: {lat: -34.397, lng: 150.644}, zoom: 8, // add comma here styles: [ { "stylers": [ { "hue": "#c1d72e" } ] } ] }); }
  2. just don't use the modules render() method and write the code on your own. you should know how to do that as you say you already did it without the module you have all the necessary field data in these variables: echo $page->map->address; // outputs the address you entered echo $page->map->lat; // outputs the latitude echo $page->map->lng; // outputs the longitude echo $page->map->zoom; // outputs the zoom level you can also just copy the generated markup of your render method and then adjust the necessary (parts of your) scripts.
  3. this module uses mpdf for pdf generation. maybe the docs help you? https://mpdf.github.io/fonts-languages/fonts-in-mpdf-6-x.html
  4. yes, it is: https://www.google.com/search?q=change google map colours should be very easy using their readymade styles: https://snazzymaps.com/
  5. thank you for your explanations @Nurguly Ashyrov ! this sounds great
  6. thank you for the quick response! i got that now hmmm... so you define your query on the client side? how can you make sure that people do not modify your queries in a way that you do not want? i read of your server-side restrictions regarding templates, but wouldn't it still be possible to modify the queries to some extend (like changing number of records to show, fields and so on). i'm thinking of someone maybe stealing content or creating his own json exports of my site's content...
  7. hi @Nurguly Ashyrov this looks very interesting! could you please provide a simple example how one would use graphql and/or your module with simple ajax requests? i guess this could be great to return data for https://datatables.net/ ?
  8. you could also put everything in one file to have all translations aggregated in one page in the admin custom code: return wireRenderFile('fieldmarkup', array('field' => 'calendarbox')); fieldmarkup.php <?php switch ($field) { case 'calendarbox': $out = '<div>...</div>'; $out .= '<p>...</p>'; echo $out; break; } i guess for easy fields that would be better than having a file for each field...
  9. i guess you could use wireRenderFile, then it should show up in the backend.
  10. today i came up with this solution. it finds the page related to a pagetable item, but it should also work for repeaters, i guess? for repeaters there is also the getForPage() method, wouldn't it be possible for you to work with this? my code: // find the related event page to the current coupon item $current = $pages->findOne('template=event, couponcodes.id=' . $page->id); // return all tickets of this event so that the user // can choose for wich tickets the coupon is valid return $current->tickets; it finds the page of type "event" that has the current item ($page->id) as part of its pagetable called "couponcodes" drawback is that this only works after saving. but thats necessary since the item wouldn't exist before saving... maybe i'm getting you wrong. but maybe it helps someone
  11. hi adrian, nice that you take up my idea. i may have the code somewhere but i don't think it would be helpful. i did a manual search&replace in the wire folder that writes all calls to a file. i think you'll have a much better approach in some minutes looking forward to your solution. what i mentioned when playing with it was, that it gets quite messy very quickly. there are lots of hookable methods and on every pagesave or edit there are lots of recorded hooks. it would be necessary to build some UI around that. or additional informations, like a dump of the event object or the like. I'm not sure what the best solution would be for this. do you understand what i'm talking about?
  12. hi jmartsch, no, i didn't release it, but it is still on gitlab: https://gitlab.com/baumrock/Alfred/tree/master as i remember nothing changed since then... hope that helps.
  13. hi guys, has anybody tried this module on a PW3 installation? are there better solutions out in the meantime? thank you for your help
  14. i would not see this as a problem. but i also don't want to discuss this further - uikit is just a personal preferation of mine. ryan will have to weigh all pros and cons and i'm sure he will take a great decision
  15. no, don't have enough time to follow the forum atm. i just saw some nice previews of uikit3 and was supposing that uikit 3 is as solid and awesome as uikit 2 was whatever framework it will be... I'm with you that any kind of framework will make it easier to collaborate and/or to get the context of how everything works in the admin more quickly.
  16. uikit 3 is now available as beta: http://yootheme.com/blog/2017/01/09/uikit-3-beta-released would be a perfect timing for a new admin *dreaming
  17. always depends what you want to do. only changing the field label on different templates would perfectly be fine without a hook. adding date+time would not be possible without a hook i just wanted to give a simple example what could be the next step
  18. kongondo beat me it may seem complicated in the beginning, but once you get the concept it's really easy and straightforward. you just have to look a bit into the code to know what is going on behind the scenes. take my code example, it's easy: // attach a hook whenever a page edit form is built // this happens in the class "ProcessPageEdit" in method "buildform" // see github how this method looks like: https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module#L588-L595 $this->addHookAfter('ProcessPageEdit::buildForm', function($event) { // $event is the hookevent object; it holds all necessary data to execute all kinds of actions // https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module#L591 // here you see that the method gets 1 parameter and this parameter is the form, so if you want to get this form just do this: $form = $event->arguments(0); // to get the field of your form just do the following // see https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldForm.module // or https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ $field = $form->get('yourfieldname'); // now we want to do something based on the page that is edited // that is a bit different than in template context because we are VIEWING an admin page, whereas we are EDITING a different page // we want to know the template of the EDITED page, so let's get it... // $event->object is the class where the hook is attached. in our case "ProcessPageEdit" // to get the edited page this class has an own method: https://github.com/processwire/processwire/blob/master/wire/modules/Process/ProcessPageEdit/ProcessPageEdit.module#L2009-L2019 $page = $event->object->getPage(); if($page->template == 'template_a') $field->label = "this is field label on template a, it is " . date("d.m.Y H:i:s"); elseif($page->template == 'template_b') $field->label = "this is field label on template b, it is " . date("d.m.Y H:i:s"); else $field->label = "other template, it is " . date("d.m.Y H:i:s"); });
  19. ...and that is just the tip of the iceberg just an example: put this inside your /site/ready.php $this->addHookAfter('ProcessPageEdit::buildForm', function($event) { $form = $event->arguments(0); $field = $form->get('yourfieldname'); $page = $event->object->getPage(); if($page->template == 'template_a') $field->label = "this is field label on template a, it is " . date("d.m.Y H:i:s"); elseif($page->template == 'template_b') $field->label = "this is field label on template b, it is " . date("d.m.Y H:i:s"); else $field->label = "other template, it is " . date("d.m.Y H:i:s"); }); have fun with processwire
  20. nice idea
  21. thank you tpr for the new update also thank you for the css fix. didn't think about that! what do you think of adding often used widths as a clickable shortcut to the form? clicking it could also save + close the modal shortcuts could be 20 25 33 34 40 50 60 75 80 100
  22. wow, i totally missed that! thank you! ok, i see..
  23. @LostKobrakai did you see adrians link to the blog post? https://processwire.com/blog/posts/processwire-core-and-profields-updates-2.5.22/#has_parent-selectors-now-support-multi-value anyhow, i don't really understand your selector. i've never seen syntax like branch=(has_parent=123) i would have expected (has_parent=123), (has_parent=321) do you have more info on that?
  24. thank you adrian, that is a good reason why it is working @tpr no, exactly like pasted above created>12345 i guess if there is no obvious reason i would have to investigate further. but as i solved my problem in a different way i guess i will not have time for that at the moment
  25. that is interesting because it works as expected and this does not seem to be the reason, because on another site it works also with has_parent=1|2 i solved it by adding an if statement ala $lastBooking = $pages->findOne(...); if($lastBooking->id AND date('Y', $lastBooking->created) == date('Y')) return $lastBooking->renr + 1; else return 1; but i would still be interested in the reason for the wrong result on my selector and why the docs say has_parent=1|2|3 does not work while it seems to work well in this case... i hope someone knows the reason
×
×
  • Create New...