guy

Members
  • Content count

    47
  • Joined

  • Last visited

Community Reputation

10 Good

About guy

  • Rank
    Distinguished Member

Profile Information

  • Gender
    Male
  • Location
    London, UK

Contact Methods

  • Skype
    guycampbell

Recent Profile Visitors

1,996 profile views
  1. @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...
  2. 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; }
  3. 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...
  4. 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.
  5. 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?
  6. no worries, thanks for letting me know
  7. 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
  8. Awesome pal, that's sorted it.
  9. 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.
  10. 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.
  11. 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.
  12. @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.
  13. 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.
  14. 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...
  15. 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?