Jump to content

guy

Members
  • Posts

    61
  • Joined

  • Last visited

Everything posted by guy

  1. @gs-df thank you so much for the recommendation - just plugged it in and it does exactly what I need. @Robin S thank you as well for your work on this module.
  2. I'm looking to change the visibility of child fields within a repeater based on the value of a field on the owner page (the page on which that repeater appears). To illustrate: Owner (Page) - type (select field) ---- type_one (option) ---- type_two (option) - things (repeater field) ---- thing_one (child field) ---- thing_two (child field) With the above set up, when you select type > type_one then within the repeater the visibility of things > thing_two would be set to hidden. I don't mind how I go about doing this - at present I've tried the following hook within ready.php: $wire->addHookAfter('ProcessPageEdit::buildFormContent', function (HookEvent $event) { $page = $event->object->getPage(); $form = $event->return; $thingsField = $form->getChildByName('things'); ... // but past this point I haven't been able to select $thingsField child input fields }); The above gets me access to an InputfieldRepeater as $thingsField but I'm not sure how to then drill down into its child input fields. If I could get access to child input fields I'd then assume I can set showIf to a nonsense value to hide the field, i.e. $childInputField->showIf = 'true=false'; Any help with the above would be much appreciated.
  3. Is there a recommended way to detect when a page is saved via the API vs the admin site within a save hook? Such as: $this->pages->addHookAfter('savedPageOrField', $this, 'someMethod'); within someMethod I'm currently doing the following: $saveBtn = $input->post('submit_save'); if (!$saveBtn) return; // only reach the below when passed a submit_save POST param ... The above seems to work but I wasn't sure if this was a reliable way, or if something more fit for purpose exists?
  4. just updated to v1.1.4 with the bug fix
  5. @ngrmm thanks for letting me know about that config issue. Will get that sorted in a min. On the SendGrid front I'm not too sure. SendGrid should show sent and received stats for all messages, therefore if you're not even seeing that (and the message is delivered) then something else is probably not quite right.
  6. @ngrmm I'm not exactly sure but I have just rolled an update to 1.1.3. I've tested this version and I can see sent and open stats within my admin console: https://app.sendgrid.com/email_activity let me know if this helps.
  7. @teppo thanks pal Yeah I noticed as soon as this was uploaded. Just tweaking it now but as you say no need for the hook as allows it to play better with other WireMail modules.
  8. Github: https://github.com/theGC/WireMailSendGrid What it does: Extend WireMail to bypass PHP mail and send mail via SendGrids Web API. What you need: A SendGrid account, use this to generate an API Key with Full Mail Send permissions. Once installed, the API Key is popped into the modules config and you should be good to go. Use Cases: It simplifies the process of sending email from servers by removing the need to configure sendmail or other email routing applications on the server. Instead it relies solely on PHP and offloads the sending to SendGrid which can be heavily configured via its UI to ensure better delivery rates for your domain.
  9. @kongondo thanks for looking into it, but I was after an API method which could be called from outside of the page, thus $input would not have the right context for the page you are interested in. More like $pages->get('/foo/bar'); when bar is a segment. Only really needed to know if the segment was valid. @LostKobrakai If you are testing for multiple segments then you'd usually enter them as separate strings within the $segments array. However if you've configured segment paths on your template you could add "some/subsegment" as a single string rather than breaking it apart. Really it needs expanding for this use case as that wasn't what we required from it. Regex tests and more complex lookups are somewhat out of scope. For our use case it worked nicely but that was multiple strings that are not segment paths. Might be interesting to play with the ProcessPageView method though...
  10. Haven't found an API method to support this but have a simple enough workaround if you have the $page at the root of the segments. /** * is the URL Segment valid for the page * @param {Page} $rootPage * @param {Array} $segments * @return {boolean} * */ function validSegments($rootPage, $segments = []) { if (!count($segments) || !$rootPage || !$rootPage->id || !$rootPage->template->urlSegments || (is_numeric($config->maxUrlSegments) && count($segments) > $config->maxUrlSegments)) return false; if ($rootPage->template->urlSegments === 1) { return true; } else if (is_array($rootPage->template->urlSegments)) { foreach ($segments as $segment) { if (array_search($segment, $rootPage->template->urlSegments) === false) { return false; } } return true; } return false; }
  11. Hey, Is there an API method to detect if a URL will match a URL Segment? i.e. If a template serving /foo/ allows segments, and you request /foo/bar/ Just need a boolean to indicate a hit or not. $segmentPage = $pages->get('/foo/bar/'); // returns nullPage At present I can't think of anything short of requesting the page and checking it's http status code: $responseHeaders = wireHttp->head('/foo/bar/'); Both slow and doesn't seem very reliable as the templates output could be manipulating this...
  12. Hey All, Our company is looking to take on PW devs for a variety of client projects. We're London based and ideally would like to work with devs that can come into the office. The projects are pretty wide in scope, so right now we're just looking for viable candidates to ping us a cover note with details on projects you've undertaken, how you utilised PW within them, highlight anything particularly brilliant you did.... If you can direct message me, I'll ping you my email and we can go from there.
  13. Is it possible to search on multiplier fields using a selector? i.e. $q = 'a search query'; $searchResults = $pages->find("textarea_multiplier%=$q"); This produces a fatal error: Error: Exception: Operator '%=' is not implemented in FieldtypeMultiplier Can this be done without looping over the contents of the multiplier?
  14. no worries, thanks for letting me know
  15. Is there a method to add markup to a single input field when building a form? At present I'd customise the forms markup: $form = $modules->get("InputfieldForm"); $form->setMarkup([ 'item_content' => "{out}<span class='custom-span'></span>", .... ]); Which works but adds the custom span to every inputFieldWrapper. Adjusting setMarkup on an individual field, i.e. $field = $modules->get("InputfieldText"); $field->setMarkup([ 'item_content' => "{out}<span class='different-span'></span>" ]); Calls the same method, setting $markup within inputFieldWrapper.php and adjusting the output of every inputFieldWrapper Therefore I was hoping for a way of appending to the inputfield or wrapper without it being global
  16. Awesome pal, that's sorted it.
  17. When using mysql v5.6 with the switch: --sql-mode=ALLOW_INVALID_DATES blank start and end dates get set to 2015 years ago, the dev branch solved this but unfortunately didn't fix the sql error.
  18. I'm getting an error with mysql version: 5.6.24 the error occurs when you don't populate either the start or end dates for a new jumplink. Elsewhere it has been caused by mysql v5.6 being a lot stricter with datetime fields. Where previous versions have just ignored certain data, v5.6 now raises an error. Starting mysql with the switch: --sql-mode=ALLOW_INVALID_DATES removes the issue.
  19. To add to the above: We experienced this issue with an established site when moving from http to https. Login requests either threw this error or simply returned you back to the login screen after silently failing. Following trying all the suggestions posted by Nico - apart from /site/assets/ chmod 777 - as he mentions wouldn't ever recommend that for production environments To remove the issue we installed the 'Session Handler Database' module and this fixed it.
  20. @chriswthomson - you've likely deleted the checkbox field this module sets up on install. To get past this error add a new field with a name of: sitemap_ignore then try running the uninstall again.
  21. Thanks Ryan, that's all useful. I actually signed up for ProCache a couple of weeks back, and am just testing it on the dev site so hopefully when that's live it'll sort it. For the mean time we administer the server and it's a dedicated box so we'll have a look at the config.
  22. Hey all, Since launching a site about a week ago we've been getting an error within the pw logs. It occurs about once a day and I was wondering if anyone could shed some light on what it is: 2013-10-07 14:19:00 ? http://www.google.com/?/ Error: Exception: DB connect error 1045 - Access denied for user 'abc'@'localhost' (using password: YES) (in /var/www/html/wire/core/ProcessWire.php line 96) 2013-10-08 08:05:05 ? http://www.baidu.com/?/ Error: Exception: DB connect error 1045 - Access denied for user 'abc'@'localhost' (using password: YES) (in /var/www/html/wire/core/ProcessWire.php line 96) 2013-10-09 08:41:06 ? http://www.google.com.tw/?/ Error: Exception: DB connect error 1045 - Access denied for user 'abc'@'localhost' (using password: YES) (in /var/www/html/wire/core/ProcessWire.php line 96) I assume their SE spiders trying to index the site but can't see why they'd be throwing an error like this...
  23. We're getting the phone number from a text input: $field = $modules->get("InputfieldText"); once submitted we're processing the form: $form->processInput($input->post); Sanitising the inputs, and then whitelisting the values using: $input->whitelist() along with returning a JSON version using wireEncodeJSON() The whitelisted version is outputting correctly with the 0, the wireEncodeJSON version drops it. I assume it's because it is passing it from the input as an integer whereas in your test it's a string. Might this be the case?
  24. Hi, We're pushing a few fields to JSON and were looking to use wireEncodeJSON to remove empty values. Just found an issue with the treatment of numbers. As they are interpreted as integers the prepending 0 is stripped. i.e. 0800 1234 becomes: 800 1234 we've moved over to using json_encode for now which is fine, just wanted to see if this was a neccessary behaviour.
  25. Hey Ryan, Thank you, having access to v0.2.0 has fixed the problem.
×
×
  • Create New...