Jump to content

Barry

Members
  • Posts

    72
  • Joined

  • Last visited

Everything posted by Barry

  1. I'm trying to sort an array of found locations by the count reviews that have said location filled in in the page field. I have the following: $locations = $pages->find("template=location, location_images!='', sort=count[template=review, location=$should_name_of_location_with_images]"); I know the nested selector isn't right. But what I'm trying to illustrate what i'm trying to achieve, which is to find locations which have at least 1 image and sort them by the count of pages with template "review" and have the location that has at least 1 image filled in in the location page field set in review.
  2. Sorry, I wasn't clear, I meant, when you select a different brand than was already saved and add a new model at the same time, the hook won't work because it's attempting to create a new page (model) under the old brand and not the newly selected brand. In other words, changing both brand and model at the same time breaks the hook.
  3. Is there a way to set the newly created page directly as the selected value within this hook? Or does a new hook need to be created after the process?
  4. Thanks! got it partially working. Doesn't check the field value but the saved page value which isn't handy if you change brand field or the brand field is empty. But I think I can fix this 🙂
  5. I have 2 page reference fields; brand and model. The brand field has an assigned template and parent so I'm able to create new pages from within the page with this field. The model field is dependant om the value of brand with the following: parent=page.brand But I can't figure out how to assign a dynamic parent the model field so that I can add pages (models) under the correct brand. whats the best way to go about this?
  6. I think I'm going to get an obvious duh answer here. I have a "number of guests" text field. It's a text field because most of the time the value of this field is an int value but in some cases it's "100 guests" or "120-200" I have the following code where $g_guests is just a GET variable. $query = 'template="party", '; if(isset($g_guests)){ foreach($g_guests as $g_guest){ switch ($g_guest) { case 50: $query .= 'guests=(party_guests>=1, party_guests<51), '; break; case 100: $query .= 'guests=(party_guests>=51, party_guests<101), '; break; case 150: $query .= 'guests=(party_guests>=101, party_guests<151), '; break; case 200: $query .= 'guests=(party_guests>=151, party_guests<201), '; break; case 201: $query .= 'guests=(party_guests>=201),'; break; } } } $parties = $pages->find($query); When I query between 1 and 51, I get pages back with all kinds of values een above 51. When I query more than 201, the results I get back changes and I see a few parties with 500 guests, but also 90, 80, etc My guess is I'm comparing apples and oranges as in, strings with ints. Is there some way to fix this without having to create a new int fields?
  7. How might one structure a selector if one wanted to find pages that had a date within a specific month but regardless of year?
  8. No, being logged in or not makes no difference. These two lines of code run at the same time. It just seems like a nested selector won't work unless the page is viewed in a browser. I've managed to get it working with the following: $contact = $pages->get("salesforce_id^=$sfid"); $location = $pages->get("template='pageLocation', contact=$contact");
  9. sorry, my original post may not be clear: $contact = $pages->get("salesforce_id^=$sfid"); $location = $pages->get("template='pageLocation', contact=[salesforce_id^='$sfid']"); the top line $contact returns a processwire ID whether the URL is called by salesforce or by my browser. $location does not return anything when salesforce calls it but returns a processwire ID when I call the URL in my browser.
  10. Okay, so my code doesn't seem to like the following when not being loaded in the browser: contact=[salesforce_id^=$sfid]
  11. I have a page with a template that is purely intended for carrying out php tasks. This page/url is called when certain objects in SalesForce are saved. The URL is called with a few GET variables. To make sure that the URL with the GET variables is called, I write them to a log, and this works fine, except the php and ProcessWire code I've written doesn't execute. Only once I visit the exact same URL that was written to the log in my browser, then the php and ProcessWire code executes perfectly, no errors. I can't see any reason for this, and I'm not sure what to search for in order to sort this out. Can anyone give any ideas?
  12. Is anyone using this module in combination with SendGrid? I had the module working til a few weeks ago and now I get a time out error that I can't connect to mail.sendgrid.net. Not sure what the exact settings need to be as Sendgrid isn't too clear on this as far as I can find.
  13. I edited this code a little and it worked perfectly! Thanks <?php namespace ProcessWire; $empties = $pages->findMany("template=record, textField=''"); $fulls = $pages->findMany("template=record, textField!=''"); $uniques = new PageArray(); $fieldValues = []; foreach ($fulls as $record) { if (in_array($record->textField, $fieldValues)) continue; $uniques->add($record); } $uniqueOrEmpty = $empties->import($uniques);
  14. I'm trying to write a value to a textarea via de API. I'm making use of the Multivalue Textformatter module which works great for when the field has multiple rows added via admin. But now I'm trying to add multiple lines to the textarea via the API and I cannot for the life of me figure, or find out how to do this. I'm adding "&#13;&#10;" to the end of of each new line. When I apply this value to a textarea in the template, this works fine, but when I $line = "this is a line"; $p->textarea = $line."&#13;&#10;" I just get "this is a line &#13;&#10;". This is the case with the "/n" and "<br>" as well. Turning on tinyMC doesn't help either as the output in the template is still the same. Turning on the HTML Encoder doesn't help either.
  15. yes, or, sorry, in Dutch or is of empty OR unique
  16. I'm trying to figure out how to create a selector that will find pages where a certain text field is either empty of unique. I have about 3500 records where the majority of have a specific field which is simply empty, there some records however that will have a certain value filled in this same field and some of these values are the same. I want to only select the first page which is found with this value and exclude the rest of these pages with the same value. Any ideas?
  17. Turns out it was simpler that I thought, but I had to recreate the project folder and define the web hook again and it began pulling the data.
  18. I'm attempting to deploy my site via GIT from bitbucket through Runcloud. I've managed to connect the repo via a webhook and I'm able to pull whenever I commit from local, but I keep getting a "Targetted directory /home/runcloud/webapps/domainname is not a GIT directory inside Web Application thedjcompany" I've always deployed via a GUI but we've moved servers and I'm very experienced with GIT, nor do I have any experience with Runcloud, so I'm hoping someone here has some info and can point me in the right direction? I'm guessing that I have to initiate the GIT folder within the webapp folder itself but I wouldn't know the command line to get that started. Any info/advise would be very appreciated
  19. I had that installed and it showed that Processwire was redirecting my page first tot a page with a get variable ?it= or something or other and then it would redirect to the homepage.
  20. I should mention that I have ProCache installed but not activated at the moment though it was on at some point to test the site. But since the site needed some thorough development, so save time clearing the cache, I simply cleared it and turned it off. I did notice some extra rules in the htaccess because of this. Could that have been the cause?
  21. But I was using standard ProcessWire htaccess, so it should have all been working at ProcessWire intended
  22. I placed the following rules at the very top of the htaccess RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.thedjcompany\.nl [NC] RewriteRule ^(.*)$ http://thedjcompany.nl/$1 [L,R=301] RewriteCond %{ENV:HTTPS} !on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] also removing the RewriteEngine On which was lower down in the htaccess and now it all works
  23. I'm trying to direct all pages from their www and http versions to their non www https versions but I'm experiencing some really strange redirecting behaviour instead. When I uncomment the http to https lines in the htaccess, I get a too many redirects error on my site I thought that Processwire by default redirected from www to non www? When I apply the following line after the Processwire directives RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] The redirecting seems to work fine but for some reason many of the pages redirect to the homepage. I don't know if its a factor but I have jumplinks and multi-language installed and running. I've removed all custom rules from the htaccess just so that people see the pages they click on from search engines, but I'm hoping this can be resolves quick. Ideas?
×
×
  • Create New...