-
Posts
437 -
Joined
-
Last visited
-
Days Won
4
Everything posted by 3fingers
-
I will do that on Monday, in the meantime thanks for your support and kindness :)
-
I'm making progresses! Everything is working fine except for the renderPager, which loose the query string on subsequential pages: $searchEngine = $modules->get('SearchEngine'); $form = $searchEngine->renderForm(); echo $form; $out= ''; if ($q = $sanitizer->selectorValue($input->get->q)) { $results = $pages->find('search_index%=' . $q . ', limit=25'); foreach ($results as $result) { $out.= // my code here, everything is great and populated, even repeater matrix elements whaoo! :) } } $out.= $results->renderPager(); echo $out; On page http://localhost:7880/my_url/root/it/search/?q=my_query everything is ok. As soon as I go to page2 the url is http://localhost:7880/my_url/root/it/search/page2 (the query is gone and nothing more is shown). Btw my "search.php" template has "Allow page numbers" in the backend set to ON. Any clue? ?
-
Thanks @teppo ! You rock! ? I will report back my experience with your module as soon as my client give me the ok with the implementation. Once again, thanks! Edit: I found couple typos in the README inside the "manual approach" section (a double echo and a $searchEngine declaration referenced as $searchengine w/o camel casing), I paste the correction below as hidden: Also, in the "Advanced Use" : the "$query_string" variable declaration...shouldn't be "$q" or I am missing something?
-
You should give this a try: https://processwire.com/talk/topic/5704-wiremailsmtp/?do=findComment&comment=191580 And also this (might be related to your hosting company not allowing 3rd party smtp services, like google, to send mail): https://processwire.com/talk/topic/5704-wiremailsmtp/?do=findComment&comment=162368
- 10 replies
-
- 2
-
- wiremail
- wiremailsmtp
-
(and 5 more)
Tagged with:
-
Please consider contextualize a bit more your situation, post some code. Are you using gmail as a service to send your email? Have you allowed then "unsafe" apps to use their smtp for that? Lot of things to consider.
- 10 replies
-
- wiremail
- wiremailsmtp
-
(and 5 more)
Tagged with:
-
Hi Teppo, I'm close to build my first-time-ever search engine in processwire and wonder if you have made progress into the multilanguage side of your cool module ? Not a big deal anyway, otherwise I will try another approach ? Thanks!
-
5 template file with only 1 different class-css
3fingers replied to franciccio-ITALIANO's topic in Getting Started
It looks like you still need to grasp some concepts and logic of html/css and php in general. Write me a pm, I think a chat between me and you would be ideal for you. I'm trying not to pollute the forum with a bi-lingual discussion between us. -
5 template file with only 1 different class-css
3fingers replied to franciccio-ITALIANO's topic in Getting Started
Ciao franciccio, non è processwire che deve "pescare" la classe nel tuo css, ma sei tu che ( a seconda di una particolare condizione ) puoi dire al sistema di fare un echo di una classe piuttosto che di un'altra. Facciamo finta che tu abbia due categorie di pagine (politica ed ecologia) e al si sotto di esse le pagine corrispondenti, a questo punto puoi semplicemente definire la classe che vuoi sul bottone: // Insert a class conditionally <button class="<?= ($page->parent == 'politica') ? 'some-class' : 'other-class' ?>"></button> Lo stesso principio vale per gli sfondi. ---- It's not pw to pick the classes from the css, instead is you choosing the right class based upon some conditions (if/else, switch statements, etc.). Let's pretend you have to main parent categories (politica ed ecologia), at this point you can easy define which class you need to be applied on the button. -
5 template file with only 1 different class-css
3fingers replied to franciccio-ITALIANO's topic in Getting Started
Ciao Franciccio, where this class lives into your template file? On the body tag? Are you using it to style the whole page differently according to its content? In this case you could add those classes programmatically according to the page you're serving, using just one template file. (btw I'm italian too, write me a pm if you're in trouble and I will send you my skype username there, but first let's try to solve this inside the forum). -
Are you using the honeypot technique as described here?
-
Get array of fields instead of PageArray ?
3fingers replied to CrazyEnimal's topic in API & Templates
What about: // Convert a regular array into a WireArray again $wireManufacturers = new WireData(); $wireManufacturers->setArray($manufacturers); Idea comes from here. -
Here is my final version, I post it here in case somebody needs it for a similar situation. Read the comment in code. // --Added remove method to the query. I did this because, otherwise, when a user make a 2nd edit to the current page (after the initial save) the "in_evidenza" checkbox would then be reset to 0. wire()->addHookAfter('Pages::saveReady(template=articolo)', function($event) { $pages = $event->object; $page = $event->arguments[0]; if($page->in_evidenza == 1) { foreach($pages->findMany("in_evidenza=1")->remove($page) as $new) { $new->setAndSave('in_evidenza',0); } } }); Could any forum moderator mark this thread as solved? Thanks!
-
Your improved version works flawlessly, and yes, $pages->$event->object; is needed (error otherwise). Thanks @jens.martsch!
-
Thanks @psy! Right now my Hook looks like this (I've changed something more from my previous post): /* -- Changed: from Pages:saved to Pages::saveReady. Doing that I can avoid to setAndSave the "in_evidenza" checkbox on the current page. -- Changed: from "find" to "findMany". Even though I actually got few pages to search into, they could grow in the future. I didn't noticed speed improvements, but seems ok. */ wire()->addHookAfter('Pages::saveReady(template=articolo)', function($event) { $pages = $event->object; $page = $event->arguments[0]; $news = $pages->findMany("in_evidenza=1"); $in_evidenza = $page->in_evidenza; if($in_evidenza == 1) { foreach($news as $new) { $new->setAndSave('in_evidenza',0); } } }); I'm still open for suggestions!
-
Hello guys, I've written an Hook that it's working perfectly right now but I'd like to have some suggestion from you for a possible improvement. Background: - In a template "articolo" I've got a checkbox "in_evidenza". - When a user check "in_evidenza" on a page I want my Hook to set the value of all the other "in_evidenza" checkboxes (inside the other "articolo" pages) to 0. Here is my Hook: wire()->addHookAfter('Pages::saved(template=articolo)', function($event) { $pages = $event->object; $page = $event->arguments[0]; $news = $pages->find("in_evidenza=1"); $in_evidenza = $page->in_evidenza; if($in_evidenza == 1) { foreach($news as $new) { $new->setAndSave('in_evidenza',0); } } $page->setAndSave('in_evidenza',1); }); Right now, as I mentioned, it is working but I've noticed that if i remove the condition (see below) the hooks sometimes works and sometimes the "Fatal Error: memory exhausted" error appears. // Stripped the (template=articolo) selector wire()->addHookAfter('Pages::saved', function($event) { ... }); So I'm here to ask if you know a safer and more efficient way to perform my first Hook, even though right now it's working perfectly (I want to avoid some other memory errors in the future). Thanks!
-
Really nice additions to form builder, as an happy customer of Pro Fields I'm going to purchase Form Builder in the next future for a project I'm working on. High five to your new cat! Thanks Ryan, you are a great person.
-
recipe Utility function to recursively search through repeaters
3fingers replied to MoritzLost's topic in Dev Talk
Thanks a lot for this, it might be useful in the future ? Could you please point me where I can learn about the question mark on this line? ?array $allowed_repeater_types = null, I know it should be something about php 7.*, but I cannot find anything due to the fact that the search string "? php" leads, obviously, to wrong results on google ? Thanks! -
How can i get the current language for ajax search
3fingers replied to kkalgidim's topic in Multi-Language Support
Worth a try: if($config->ajax) { $searchresults = $pages->find("has_parent!=2, title.data{$user->language}"); // See below for the forum link about *.data header("Content-type: application/json"); // Set header to JSON echo $searchresults->toJSON(); // Output the results as JSON via the toJSON function } else { ... More on that here -
How can i get the current language for ajax search
3fingers replied to kkalgidim's topic in Multi-Language Support
Does this works? if($config->ajax) { $language = $languages->getLanguage(); $searchresults = $pages->find("has_parent!=2, $language"); header("Content-type: application/json"); // Set header to JSON echo $searchresults->toJSON(); // Output the results as JSON via the toJSON function } else { ... -
Requiring to add the Image below contact form
3fingers replied to Mithlesh's topic in General Support
Hi Mitlesh, this is the clone of a thread you've opened yesterday, asking more or less the same. That being said if you want another image, wherever you want, you just have to output it inside your code, like you've done with the one you've referenced. Don't forget: 1) you have docs at your disposal. 2) it's august and many of us are away for vacation, so if none replies at your first thread be patient and search the forum for an answer.- 1 reply
-
- 4
-
- contact form
- php
-
(and 3 more)
Tagged with:
-
Hi @horst, I'm facing similar problems with subscribing a new user to my list, here is my code: (an hook for the LoginRegister module by ryan) wire()->addHookAfter('LoginRegister::processRegisterForm', function($event) { $form = $event->arguments[0]; foreach($form->getAll() as $f) { $name = $f->attr('name'); if(strpos($name, 'register_') !== 0) continue; if($name == 'register_subscribe_newsletter' && wire('input')->post->register_subscribe_newsletter == 1) { $mc = wire('modules')->get("SubscribeToMailchimp"); $email_dirty = wire('input')->post->register_email; $email = wire('sanitizer')->email($email_dirty); $subscriber = [ 'FNAME' => wire('input')->post->register_nome_iscritto, 'LNAME' => wire('input')->post->register_cognome_iscritto ]; $mc->subscribe($email, $subscriber); } } }); And here is what the mailchimp console said about the request: I've tested everything I can imagine (list_id, api key, etc...) but nothing. I've also tried to edit the line 62 of the module with $response = $http->send($api, json_encode($param), 'POST'); but the error still remain.... Did you solved it somehow? Thanks! EDIT: I've solved changing line 54 of the module from: if($status !== false) { //... } to if($status !== 404) { //... } Basically Mailchimp returns a status of 404 (and not false) when the module tries to insert a new user. This is correct because the user is not there in the list at first.
-
Thanks @Wanze! I found my solution : wire()->addHookAfter('SeoMaestro::renderMetatags', function($event) { $tags = $event->return; $page = $event->wire('page'); foreach($tags as $key => $value) { if($key == 'image' && $key != '') { $matrix_field = $page->matrix->find('type=immagine_singola')->first(); // immagine_singola is my matrix type $matrix_image = $matrix_field->immagine_articolo->url(); // immagine_articolo is the field inside $tags[$key] = $matrix_image; } } }); I have to refactor something, but for now it's ok. Guys, you rock ?
-
Thanks for the suggestions, I'm going to work on those and see if I can come up with something useful. +1 for more options for the placeholders, would be even more flexible.
-
Hi @Wanze, is it possibile to query a ProField Matrix field (an image in this particular case) as a placeholder for the og:image setting? Something like {matrixfield.imagefield} ? Right now the only images I have inside my templates come from a field of type Matrix. Any solution available? ?
-
Hi @daniels, I'm using your module and I have to thank you a lot, it is saving me hours of time. However I'm facing a problem: if I subscribe a user (goes fine), unsuscribe him (goes fine too) and then try to subscribe him again there goes nothing. He stays with the "Unsubscribed" status inside my Audience section of the Dashboard. How could I try to solve this issue? Thanks!