-
Posts
1,306 -
Joined
-
Last visited
-
Days Won
13
Everything posted by Juergen
-
Ok I have figured it out - the code works but the Json Array made problems (json_encode doesnt work correctly in this case). So here is the complete code as inspiration for all who want to use UIKit Ajax search function in processwire. <?php if ($config->ajax) { require_once('inc/func.inc'); require_once('_strings.php'); include('paginator/Paginator.php'); include('paginator/PagesPaginator.php'); $numberofitems = 3;//How many items should be displayed $search_array = array(); $q = $sanitizer->text($_REQUEST['search']); // did $q have anything in it? if ($q) { $input->whitelist('q', $q); $q = $sanitizer->selectorValue($q); $templateselector = "template!='profile', template!='activation', template!='privacy-policy-item', template!='serviceitem', template!='single-event', template!=productpricelistitem', template!='partner'"; if ($user->isLoggedin()) $templateselector .= ", has_parent!=2"; $paginator = new PagesPaginator(); $searchresults = $paginator(array( "headline|title~=$q, $templateselector", "introtext~=$q, $templateselector", "body~=$q, $templateselector", "summary~=$q, $templateselector", "firmennameslogan|firmenwortlaut|street|postalcode|place|region|country|geschaeftsfuehrung|vertretung|registergericht|inhaltverantwortung|fachgruppe|subgroup|geldinstitut|ecgbehoerde~=$q, $templateselector", "position~=$q, $templateselector", "privacytable.title|privacytable.body~=$q, $templateselector", "partnertable.title~=$q, $templateselector", "downloadrepeater.downloadfiledesc|downloadrepeater.downloadfieldtitle~=$q, $templateselector" ), $input->pageNum, $numberofitems);//show only 3 items $resultjson = ""; foreach ($searchresults as $key => $result) { $title = $result->title; $summary = $result->summary; $link = $result->url; if($key == $numberofitems - 1){//last item $resultjson .= '{"title":"'.$title.'", "url":"'.$link.'", "text":"'.$summary.'"}'; } else { $resultjson .= '{"title":"'.$title.'", "url":"'.$link.'", "text":"'.$summary.'"},'; } } } header('Content-Type: application/json'); echo '{ "results": ['; echo $resultjson; echo ']}'; } else { //put here the standard search code for non Ajax }
-
Hello @ all, I have tried to implement an Ajax search from UIKit into processwire, but I cannot get it to work. Has someone implemented it and can give me a hint. My problem is the target page (page for the search results) which should output the search results in a Json format. I know how to create the Json format with a foreach loop but I dont know how to find all matching pages. I am able to get the search term with this code snippet: $q = $sanitizer->text($_REQUEST['search']) After this I have added the code for the search page recommended by Ryan, but this wont work. Here is the complete code: <?php if ($config->ajax) { require_once('inc/func.inc'); require_once('_strings.php'); include('paginator/Paginator.php'); include('paginator/PagesPaginator.php'); $search_array = array(); //$q = $sanitizer->text($input->post->q); $q = $sanitizer->text($_REQUEST['search']); // did $q have anything in it? if ($q) { $input->whitelist('q', $q); $q = $sanitizer->selectorValue($q); $templateselector = "template!='profile', template!='activation', template!='privacy-policy-item', template!='serviceitem', template!='single-event', template!=productpricelistitem', template!='partner'"; if ($user->isLoggedin()) $templateselector .= ", has_parent!=2"; $paginator = new PagesPaginator(); $results = $paginator(array( "headline|title~=$q, $templateselector", "introtext~=$q, $templateselector", "body~=$q, $templateselector", "summary~=$q, $templateselector", "firmennameslogan|firmenwortlaut|street|postalcode|place|region|country|geschaeftsfuehrung|vertretung|registergericht|inhaltverantwortung|fachgruppe|subgroup|geldinstitut|ecgbehoerde~=$q, $templateselector", "position~=$q, $templateselector", "privacytable.title|privacytable.body~=$q, $templateselector", "partnertable.title~=$q, $templateselector", "downloadrepeater.downloadfiledesc|downloadrepeater.downloadfieldtitle~=$q, $templateselector" ), $input->pageNum, 25); foreach ($results as $result) { $title = $result->title; $summary = $result->summary; $link = $result->url; $search_array[] = array( 'title' => $title, 'summary' => $summary, 'url' => $link // ID is the url segment ); } } header('Content-Type: application/json'); $searchresults_json = json_encode($search_array, true); echo '{ "results": ['; echo $searchresults_json; echo ']}'; } Maybe the input variable ($input) doesnt work in this case. Best regards
-
Thanks @adrian for this module. It would be great if it supports multilanguage depending on the browser language. F.e. if the browser fits one of the installed languages then show the message in this language, otherwise show the default language.
-
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
Just to clearify: It only happens if I use $mail->bodyHTML If I use $mail->body everything is ok. -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
Of course, just a typing mistake -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
@jmartsch yes I use the latest dev 3.0.36 where Ryan has included Bitpoets code changes. -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
Strange! In my case it is the opposite: Subject is o.k. but body contains the letters numbers and equalsigns. -
What should be the output? Maybe like this: <dl> <dt>Begriff</dt> <dd> Stickwort 1<br /> Stichwort 2 </dd> </dl> or <dl> <dt>Begriff</dt> <dd> Stickwort 1 Stichwort 2 </dd> </dl> You can manipulate the output with a textformatter (hooking into the render function).
-
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
The problem is that I have not this option the overview list. Maybe I must add some settings to outlook -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
I mean that the email is HTML not only the message . Yes, but this is disabled in the mail - I have tried it. After searching the web I found the info, that this function is only possible if the email is HTML. -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
It is office outlook , but unfortunately I am not able to view the sourcecode (its maybe not a HTML, but I have sent it as HTML-Mail). Show source code is disabled in this case. At the emails which were sent with PHPMailer I can view the the source. -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
Email code: $mailhtmlbody .= '<html><body><p><b>' . _t('Subject', 'Form') . ':</b> ' . $subjectcontactform . '</p><p><b>' . _t('Appointment for following events', 'Events') . ':</b></p><ul>' . $eventlisting . '</ul><p><b>' . ($furtherpersoncount + 1) . ' ' . $furtherpersonpost . '</b></p><ul><li>' . $firstname . ' ' . $lastname . ' (' . _t('Person who has registered for this event', 'Events') . ')</li>' . $allpersons . '</ul>' . $message . '<p><b>' . $senderinfo . '</b><br />' . $gendername . ' ' . $firstname . ' ' . $lastname . '</p><p><b>' . _t('Contact information', 'Form') . '</b><br />' . $user->fields->get('email')->$label . ': ' . $rfemail . '<br />' . _t('Phone/Mobile', 'Form') . ': ' . $phone . '<br /><br />IP: ' . $userip . '<br />' . _t('Date/time', 'Generic') . ': ' . $sendingtime . '</p></body></html>'; $mail = new wireMail(); $mail->to($pages->get("template=imprint")->mail)->from($rfemail); // all calls can be chained $mail->subject($subjectcontactform); $mail->bodyHTML($mailhtmlbody); $mail->send(); The email will be sent from my standard provider, where I host all my websites. -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
-
Hello @Soma, only to mention: your slider field doesnt work in repeater items (tested with PW 3.0.35) but outside a repeater it works well!! Best regards
-
Repeater items and Pagefield label setting not working
Juergen replied to Juergen's topic in General Support
Thanks @LostKobrakai but I have edited the first entry, it works now as expected. Maybe it will grab the first value of the repeater and this is in my case the title. -
Hello @ all, I want to change the label of a repeater item to the title value of the selected pagefield. My pagefield is called "eventpricevariation". I have tried {eventpricevariation}, {eventpricevariation->title}, {eventpricevariation->value} but I cannot get it to work. Could someone told me the right syntax if it is possible? Best regards I dont know why but the syntax {eventpricevariation} works now - everything is ok
-
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
Here is what I get after the changings from BitPoet: As you can see the subject line at the top works well, but in the body area the German special characters will be replaced by letters and equal signs (for example "ü" will be replaced by "=C3=BC". Also the content type, the charset and the content-transfer-encoding information will be displayed in the content area. Best regards -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
Hello adrian, I will test it tomorrow and post the result here. Best regards -
Wiremail problem with charset and german umlauts
Juergen replied to Juergen's topic in General Support
Thanks @BitPoet changing core files is not what I want. I will send my emails with PHPmailer again. It works really well without problems. -
Hello @ all, today I have tried the PW wiremail function to send emails. Til now I have used phpmailer for all my emails without problems. Wiremail works and is sending emails but I have problems with German special characters (ü,ä,ö,...) and in the email body appears the content type and charset information. The code that I use to send the mail: $mail = new wireMail(); $mail->to($pages->get("template=imprint")->mail)->from($rfemail); // all calls can be chained $mail->subject($subjectcontactform); $mail->bodyHTML($mailhtmlbody); $mail->send(); This is the default code from Ryan for sending emails. Does someone has an idea what the cause could be for this behavior? Best regards
-
How can I specify default value for certain input field?
Juergen replied to PawelGIX's topic in General Support
If you need a default (pre-filled) value for a field you can also use a hook to populate this field before the page is rendered. -
Hello @ all, I have included 2 pagetable fields in a template. The first is for the child pages (events), the other one should render pages from another parent page (prices). As you can see "eventpriceitem" template is selected as the template for the pagetable field. Below I have choosen the page "Event prices" as parent. The pagetable field renders also children items too. All the items with the blank value are children (events) of the page and not part of the price page. I dont know why the page table field renders also items which are not part of the parent (Event prices), because I have choosen this page as parent. Is it possible that 2 pagetable fields are not allowed?