Jump to content

opalepatrick

Members
  • Posts

    233
  • Joined

  • Last visited

Everything posted by opalepatrick

  1. I wonder if someone could give me an idea how to use the attachment aspect to WireMailSmtp? I am doing a simple form that allows the upload of pdf's only. I am unsure how to access the file size, type, etc. so that I can sanitize things a bit. Thanks in advance.
  2. Thanks LostKobrakai, that did it. I did not realise that I needed to set the French home url with a /fr and that automatically fed through to the subsidiary pages. Because the demo is based on a home page, there is no indication/clue to that. Thanks once again.
  3. No I did not LostKobrakai. Do you mean some relevant fields that I want to translate there as well for instance? Or am I missing the point?
  4. Sérgio, that is a good idea because I am beating my head against a brick wall here.
  5. OK, picking this up again after moving house. Apart from the home page, all the default urls in settings for each page look like /home/contact/ and the French has just /contact/ - This is the pw generated url above the input boxes. The user inputs are both the same as /contact - Is this correct?
  6. No it doesn't I am afraid, tpr. I am using v2.5.3 -- would that make a difference?
  7. Baffled then. As that is exactly the way it is, LostKobrakai. I haven't any language related code in my template, tpr, although I did have <html lang="en"> which I removed but no difference.
  8. Still struggling with this. I have followed the video on code internationalisation step by step and cannot see that I have missed anything. The admin area seems to recognise the fields from the template as I added some translation for them after choosing the particular file. Other than the __("word") code is there anything else that needs to be on a page? Maybe doctype/header or something? This is typical code: <label class="inline"><?=__("Your Name")?></label>
  9. Sérgio, On the settings for the page concerned /home/contact-2/ is default but French is /contact-2/ - Is this the problem? I have checked the settings for the page and the home page, Sérgio, and they are fine in the sense that they have the option for a French url if needed. I have also checked using Firefox, marcus, set to prefer French content and it still does not show anything in French.
  10. I am doing a simple translate English to French for a contact form using the code internationalisation syntax. Your Name, Your Email, Your Comments. I have used: __("Your Email") for instance. Then I added French to languages under set-up>languages and added the template. The fields show up in English. I add some translations. Change the profile to French, view page, everything is still in English. Bear in mind this is the first time I have done this, what am I missing?
  11. As soon as I posted I realised that I was checking the foreach for last() images and there are some items being pulled in that don't have an image and this caused the error.
  12. Following up on this. I was so focussed on getting a result on multiple word search as above that I did not realise I was getting an error on single words: Call to a member function last() on a non-object I have checked and there is a dump that appears to be exactly the same format as the multi word search. The line above is the last piece of code before this call. $intersect = array_reduce($results, function($carry, $item){ if(is_null($carry)) return $item; return array_intersect($carry, $item); }); $search_result = $pages->get("id=" . implode("|", $intersect)); foreach($search_results as $m) { if($m->images->last()){ $img = $m->images->last()->width(300); } } As I say, this works for more than one word but not for one.
  13. Thanks to you both for your replies. Just working on LostKobrakai's one first. Could you explain the logic particularly around the function with array_reduce as I am only getting a single result regardless of search? I would expect many id's in this case. edit: Actually, the one result is because of this line $search_result = $pages->get("id=" . implode("|", $intersect)); And it worked perfectly with $pages->find ! Thank you once again LostKobrakai and everyone who helped.
  14. Honestly Macrura and everyone else, I am just banging my head against a brick wall due to my lack of knowledge. So say my search is 'green vinyl', I have: $selector = ''; $parts = explode(' ', $search); $p = new PageArray(); $fs = array('hue.title','pattern.title','pattern_type.title','usage.title','title','collection.keywords'); if(count($parts)) { foreach ($parts as $pt) { foreach ($fs as $f) { $selector = ", collection.title!=Clearance, " . $f . "~=" . $pt; // echo $selector . "<br />"; $ps = wire("pages")->find("template=fabric" . $selector); // echo "Page ids are: " . $ps . "<br />"; $p->import($ps); } } } I get every page id if any word is available in any field. What I actually need is to get both words from a concatenation of content from all of the specified fields. I need to narrow the results so that for instance, I only get results when both 'green' and 'vinyl' appear in any field but not necessarily the same field. 'green' maybe from hue.title and 'vinyl' from collection.keywords? As mentioned previously the concat fieldtype would let me specify things like hue.title for page fieldtypes (single) but is not available at runtime. Cache fieldtype does not allow page fieldtypes. I am just getting tangled in my head and going down rabbit holes. Any help or questions to help me explain more clearly would be appreciated. I do find it hard to believe that I cannot query all fields on a page even if they are page fieldtypes (single).
  15. Not Autojoin afaik. I still have the same problem with this query. Any help would be appreciated. I am sure that it seems I am meandering on, but I am just trying to show what I am doing. If I appear to be missing the point or off the beaten track, then please say.
  16. Hmmm... might be to do with Autojoin? https://processwire.com/talk/topic/10496-autojoin-in-complex-setups-page-field-with-multiple-pages/
  17. I thought at the time that the cache field might not be picking up content that came from a Page fieldtype (like hue.title) that allows PageArray? edit: Actually running that query for just the word yellow, I don't get the pages with the word yellow only in hue.title
  18. Thanks once again LostKobrakai. That is another thing that I tried but it produced zero results for the above. combo is a cache field. $selector .= ", combo~=" . $sanitizer->selectorValue(implode(' ', $parts)); I know there should be 3 results for this one
  19. Sorry LostKobrai. I edited my reply to make more sense. You were too fast for me. As you can see I am happy enough not using OR in the selector string as I would prefer for the search to narrow. It is the fields being searched that are my problem. Essentially I need to search ALL the contents of the page for BOTH words.
  20. Thanks for the reply gebeer. That was my first thought, but that widens the search so that we get ANY field with myfabric OR yellow in it. What I would like is myfabric AND yellow in a concatenation of all the fields content. I tried a concat field but that doesn't work on runtime.
  21. In this thread https://processwire.com/talk/topic/11754-search-not-working-as-intended/ there is a really nice solution for dealing with 3 letter words in search. However I am having a problem with selectors. $selector .= ", title|body|collection.title|hue.title|pattern.title|pattern_type.title|usage.title~=" . $sanitizer->selectorValue(implode(' ', $parts)); The problem is that if I have, for example, a search that is looking for myfabric (in title or title.collection) yellow (in hue.title) I get zero results. If I do either separately then I get results. So the search is myfabric yellow. It seems to me as if the query is saying IF EITHER OF THESE WORDS are in EITHER title OR title.collection OR hue.title then show results but not if they are in separate fields. I need it to be IF EITHER WORD is in any field. If both words are in one field then I get results as well. Baffled or dense. Any help appreciated.
  22. Sorry about this I should have started a new thread.
  23. I want to link to an external site via mysite.com/demo - the problem with the 301 redirect solutions I have seen is that they go to the new url. I would like the url to remaIn mysite.com/demo. It was suggested that I drop a .htaccess file with some proxy settings into /demo, but I can't see how I would do that with Processwire. Any ideas? PS. I know that I can do this with a subdomain and changing the A record, but I have an existing ssl cert that needs to be used on the main domain.
  24. Sorted this with the help of LostKobrokai on another thread by looping through foreach($page->children("has_parent!=2,id!=2|7|27,status<".Page::statusTrash.",include=hidden") as $p){ $quote = $pages->get(1034)->quotes->eq($i); // loop through $quote to get repeater fields and print here echo $p->render(); } And getting the required fields from the repeater
×
×
  • Create New...