Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/28/2019 in all areas

  1. A module created in response to the topic here: Page List Select Multiple Quickly Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page. The screencast says it all: https://github.com/Toutouwai/PageListSelectMultipleQuickly https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    4 points
  2. Your function isn't a method on a class, but you pass $this as the second argument, so the system looks for a method "apiFunction" on $this, which doesn't exist. If you pass null instead as the second argument, it will look for a function instead, it should work then: <?php namespace ProcessWire; wire()->addHookAfter('ProcessPageEdit::processInput', null, 'apiFunction'); function apiFunction($event) { die("testing"); }
    3 points
  3. Fieldset (open) (a field) and the Minimal Fieldset module is what I use for things like this.
    3 points
  4. Because the current test part only does the connection part, (ping the server and login), within the modules settings screen. It was written for PW 2.4 (and is backward compatible until now). I think this would be a good addition, maybe besides the current connection test.
    3 points
  5. You can add some debug code into a template file and call a page with it: $to = array('me@example.com'); $subject = 'Wiremail-SMTP Test ' . date('H:i:s') . ' äöü ÄÖÜ ß'; $mail = wireMail(); if($mail->className != 'WireMailSmtp') { echo "<p>Couldn't get the right WireMail-Module (WireMailSmtp). found: {$mail->className}</p>"; } else { $mail->from = '--INSERT YOUR SENDER ADDRESS HERE --'; // <--- !!!! $mail->to($to); $mail->subject($subject); $mail->sendSingle(true); $mail->body("Titel\n\ntext text TEXT text text\n"); $mail->bodyHTML("<h1>Titel</h1><p>text text <strong>TEXT</strong> text text</p>"); $dump = $mail->debugSend(1); } So, in short, instead of using $mail->send(), use $mail->debugSend(1) to get output on a frontend testpage. The output is PRE formatted and contains the areas: SETTINGS, RESULT, ERRORS and a complete debuglog of the server connection, like this one:
    2 points
  6. @gerritvanaaken, I created a module in response to your topic:
    2 points
  7. I never submitted the newest iteration of my own business site which already is 3 years online, promoting my webdesign/UI/UX/Frontend stuff. "Just" a Onepager, content managed by PW, usage of D3 for the circles and a completely handwritten gallery at the top. But as always, way more hours went into this as expected ? https://siebennull.com
    1 point
  8. This version on the dev branch contains 26 commits (relative to 3.0.142) and is focused primarily in resolving reported issues, and we managed to cover 18 of them in this version. Thanks for the reports and help in our GitHub issues repo. This version represents about 2 weeks of work, and ProcessWire Weekly #284 has good coverage of those that occurred last week. More details about this week's updates can be also be found in the dev branch commit log. There are also some other minor additions and improvements in 3.0.143 as well. My favorite are the improvements to our logs system. It now collapses identical log entries that occur near each other. That means a single recurring log entry (like an error message) won't repeat indefinitely in the log and take up a lot of space. Now it just adds a counter to one log entry and updates the timestamp, rather than duplicating the entire log entry... Much more efficient. When you view a log in Setup > Logs, it identifies these collapsed log entries for you. In addition, the output in the "errors" and "exceptions" logs now have improved readability, isolating error messages and filenames from stack traces. Lastly, the ajax navigation in Setup > Logs now shows logs in newest-to-oldest (modification date) rather than alphabetical, which I find a lot more useful. The log at the top of the list is always the one most recently updated. For core updates in coming weeks, I'm primarily focused on preparing the current dev branch to merge to the master branch, as it's been awhile since the last merge and the master branch is itching for a new version. Most of you reading this already run on the dev branch, but there are many out there that also stick to the master branch, and with all the new stuff on the dev branch, I'd like to get our master up-to-date with this as well. Thanks for reading, have a great weekend!
    1 point
  9. There is now also: $languages->findNonDefault()
    1 point
  10. I came across this post because I had this redirect problem in a production environment. I could reproduce this in Firefox. The problem also occurs in IE. I have a template that can only be viewed by users with a specific role. Based on the template settings, an unregistered user or a user who does not have the required role will be redirected to a different URL (301). This is done by ProcessPageView::execute(). If the user tried to access the page before logging in and therefore has been redirected once, the redirect will also be performed when the user is logged in later because the browser has cached the redirect. Possible solutions: Add a unique GET parameter (such as a timestamp) to the URL in the link. Trigger the redirect via API in the template file: $session->redirect('/targeturl/', false); // 302 Paste this hook into your init.php wire()->addHookBefore('Session::redirect', function($e) { $url = $e->arguments[0]; if ($url == '/login/') $e->arguments(1, false); // change to 302 if target is /login/ });
    1 point
  11. I have found a solution and thought I would share it for the benefit of others. It may not be the most efficient or elegant solution but it is working. After some trial and error the solutions suggested in topic 7659, especially by formulate, began to make sense. In the tagging.php template file is the following code: $fullList = $pages->find("$searchTxt=$thisTag"); // this select all pages where page field "Tags" contains a page with title of our tag $tagList = $pages->find("$searchTxt=$thisTag, limit=10"); // this selects the same as above but limits the rsults for pagination $session->taggedPages=(string)$fullList; // save the result of the first search for use in the portfolio template In the portfiolio.php template file the following gets the prev / next pages from the tag search: $fullList=$pages->find("id=" .$session->taggedPages); $next = $page->next($fullList); $prev = $page->prev($fullList); This means that going to the prev / next page is not limited to those paginated on the tagging page. I hope that makes sense and helps someone else.
    1 point
  12. Thank you @ceberlin for the link. I just looked into the article and will take a look at the tools they provide and how they work - hopefully this week. Those can easily be set in the texts you already show in the banner. That's how I do it most of the time.
    1 point
  13. Really great, thank you @Robin S! Shouldn't the field work like this by default? Or is there any drawback with your approach?
    1 point
  14. Thank you @horst! I will test that. Why does not the module propose this directly in the "test" part?
    1 point
  15. Insane! Great, thank you. I submitted a pull request on github, because in my installation the created label was empty.
    1 point
  16. Hi @adrian, Within an admin action we have the option to return true or false depending on if the action succeeded or failed (and I assume success or failure is up to the action author depending on what the overall objective of the action is). If an action returns true then a database restore link is shown. But it seems that if the action returns false then the link to restore the database is not shown. I'm not sure if no backup is made or it's just the restore link that's missing - maybe the former because when I manually visited the /restore/ URL segment and clicked the Restore button then the restore didn't work. Is it possible to get a backup and a link to restore it when an action returns false? Also, maybe the background colour of the failure message could be a pale red because it's hard to see links against the dark red (there's actually a link to the logs in the failure message above). BTW, the module readme doesn't make it entirely clear that an action should return false on the fail state, as only the failureMessage is mentioned:
    1 point
  17. @dragan Thank you for your answer ! I'm waiting the return of SendInBlue. I asked if on their side everything works with these parameters. I will keep you informed. @Adrian I would like it a lot! For the moment I am not yet advanced enough in Processwire to make this. But I will come ... and so I could contribute to the modules too ?
    1 point
  18. Attached files are updated. Keep in mind that home.php and one search.php are in views/ folder. Hi @All. I am making real estate website with map leaflet module. Please keep in mind that I do SEO and SEM and I am NOT an expert in PHP, so if you find anything that could be better or pit-a-pat, please, please fix and comment. Many tricks learned throw @OLSA coding so thank You my great friend. Explanation: I am using template/view folder for logic = separate code and design. Calls for my fields are included in files attached to the post. Hope you'll get the idea. what I have done All of this is preliminary code which will be speeded up but it is working. Not finished but must have: search button on the home if ajax is not working. _main.php file has: include('views/' . $page->template->name . '.php'); but it doesnt have any influence on this code. Just saying if I update this. So, here are parts views/home.php <?php $izdvojene = wire('pages')->find('template=property, state=featured|new, sort=-date, limit=6'); ?> <div id="sadrzaj"> <div id="rezultati"> <?php foreach($izdvojene as $item) : ?> <div class="trecina nekretnina" data-link="<?= $item->url ?>"> <div class="slika"> <img src="<?= $item->images->eq(0)->size(346,220)->url; ?>" alt="<?= $item->images->eq(0)->description ?>" /> <div class="stanje"> <?php $state = $item->state; if ($state->has("name=sold") == 1) { ?><div class="prodato"><?= $state->sold->title ?></div><?php } else { if ($state->has("name=featured") == 1) : ?><div class="izdvojeno"><?= $state->featured->title ?></div><?php endif; if ($state->has("name=new") == 1) : ?><div class="novo"><?= $state->new->title ?></div><?php endif; // if ($state->has("name=hot") == 1) : // endif; if ($state->has("name=gorgeus") == 1) : ?><div class="prelijepo"><?= $state->gorgeus->title ?></div><?php endif; }; ?> </div> <div class="lokacija"><i class="fa fa-map-marker"></i><?php $json = json_decode($item->map->raw); if (isset($json->address->village)) : echo $json->address->village; else : echo $json->address->county; endif; echo ", "; echo $json->address->country; ?> </div> <div class="displeji"><?= $item->images->count(); ?><i class="fa fa-picture-o"></i></div> </div> <h2 class="naslov"><a href="<?= $item->url ?>"><?= $item->title; ?></a></h2> <p class="cijena"><?php if($item->price) : ?><?php echo number_format($item->price,2,",",".");?> &euro;<?php else : ?><?php echo __('Call for price');?><?php endif; ?></p> <p class="uvod"><?= wordLimiter(ripTags($item->body), 120); ?> <?php echo __('Read More');?></p> <p class="sadrzaj"> <?php if($item->surface) : ?><i class="fa fa-th"></i><?= $item->surface ?><?php endif; ?> m<sup>2</sup> <?php if($item->bedrooms) : ?><i class="fa fa-bed"></i><?= $item->bedrooms ?><?php endif; ?> <?php if($item->bathrooms) : ?><i class="fa fa-bath"></i><?= $item->bathrooms ?><?php endif; ?> </p> </div> <?php endforeach; ?> </div> </div> main-search.php which is called by ajax: <?php namespace ProcessWire; ?> <div id="rezultati"> <?php foreach($items as $item) : ?> <div class="trecina nekretnina" data-link="<?= $item->url ?>"> <div class="slika"> <img src="<?= $item->images->eq(0)->size(346,220)->url; ?>" alt="<?= $item->images->eq(0)->description ?>" /> <div class="stanje"> <?php $state = $item->state; if ($state->has("name=sold") == 1) { ?><div class="prodato"><?= $state->sold->title ?></div><?php } else { if ($state->has("name=featured") == 1) : ?><div class="izdvojeno"><?= $state->featured->title ?></div><?php endif; if ($state->has("name=new") == 1) : ?><div class="novo"><?= $state->new->title ?></div><?php endif; // if ($state->has("name=hot") == 1) : // endif; if ($state->has("name=gorgeus") == 1) : ?><div class="prelijepo"><?= $state->gorgeus->title ?></div><?php endif; }; ?> </div> <div class="lokacija"><i class="fa fa-map-marker"></i><?php $json = json_decode($item->map->raw); if (isset($json->address->village)) : echo $json->address->village; else : echo $json->address->county; endif; echo ", "; echo $json->address->country; ?> </div> <div class="displeji"><?= $item->images->count(); ?><i class="fa fa-picture-o"></i></div> </div> <h2 class="naslov"><a href="<?= $item->url ?>"><?= $item->title; ?></a></h2> <p class="cijena"><?php if($item->price) : ?><?php echo number_format($item->price,2,",",".");?> €<?php else : ?><?php echo __('Call for price');?><?php endif; ?></p> <p class="uvod"><?= wordLimiter(ripTags($item->body), 120); ?> <?php echo __('Read More');?></p> <p class="sadrzaj"> <?php if($item->surface) : ?><i class="fa fa-th"></i><?= $item->surface ?><?php endif; ?> m<sup>2</sup> <?php if($item->bedrooms) : ?><i class="fa fa-bed"></i><?= $item->bedrooms ?><?php endif; ?> <?php if($item->bathrooms) : ?><i class="fa fa-bath"></i><?= $item->bathrooms ?><?php endif; ?> </p> </div> <?php endforeach; ?> </div> main.js // Ajax search and scrolling to the form function goToByScroll() { $('html,body').animate({ scrollTop: $("#glavna-pretraga").offset().top-200 }, 'slow'); } function ajaxLoaderClass(){ var container = document.getElementById( "sadrzaj" ); container.classList.toggle("loading"); } function ajaxSearch(){ goToByScroll; ajaxLoaderClass(); $.ajax({ type: "GET", url: 'search\/', data: $('#glavna-pretraga').serialize(), success: function(data){ goToByScroll(); $("#sadrzaj").empty().append(data); ajaxLoaderClass(); } }); } search.php <?php namespace ProcessWire; // other params $property_type = $sanitizer->text($input->get->property_type); $bedrooms_min = $sanitizer->int($input->get->bedrooms_min); $bedrooms_max = $sanitizer->int($input->get->bedrooms_max); $price_min = $sanitizer->int($input->get->price_min); $price_max = $sanitizer->int($input->get->price_max); $sq_min = $sanitizer->int($input->get->sq_min); $sq_max = $sanitizer->int($input->get->sq_max); $pid = $sanitizer->text($input->get->pid); $selector = array(); if($property_type){ $input->whitelist('property_type', $property_type); $property_type = $sanitizer->selectorValue($property_type); $selector[]= "parent=$property_type"; } if($bedrooms_min){ $input->whitelist('bedrooms_min', $bedrooms_min); $sq_min = $sanitizer->selectorValue($bedrooms_min); $selector[]= "bedrooms>=$bedrooms_min"; } if($bedrooms_max){ $input->whitelist('bedrooms_max', $bedrooms_max); $rooms = $sanitizer->selectorValue($bedrooms_max); $selector[]= "bedrooms<=$bedrooms_max"; } if($price_min){ $input->whitelist('price_min', $price_min); $price_min = $sanitizer->selectorValue($price_min); $selector[] = "price>=$price_min"; } if($price_max){ $input->whitelist('price_max', $price_max); $price_max = $sanitizer->selectorValue($price_max); $selector[] = "price<=$price_max"; } if($sq_min){ $input->whitelist('sq_min', $sq_min); $sq_min = $sanitizer->selectorValue($sq_min); $selector[]= "surface>=$sq_min"; } if($sq_max){ $input->whitelist('sq_max', $sq_max); $rooms = $sanitizer->selectorValue($sq_max); $selector[]= "surface<=$sq_max"; } if( $pid ){ $selector = array(); // reset selector $input->whitelist('pid', $pid); $pid = $sanitizer->selectorValue($pid); $selector[] = "pid=$pid"; } // search inside property items $selector[] = "template=property"; // search processing if( $config->ajax ){ // Ajax call $query = implode(',', $selector); $items = $pages->find( $query ); $items_count = $items->count; include('./main-search.php');?> <?php exit(0); } else { // is not Ajax call $selector[] = "sort=price"; $selector[] = "limit=10"; $query = implode(',', $selector); $items = $pages->find( $query ); $pagination = $items->renderPager(array( 'nextItemLabel' => "<span aria-hidden='true'>»</span>", 'previousItemLabel' => "<span aria-hidden='true'>«</span>", 'listMarkup' => "<ul class='pagination pagination-lg'>{out}</ul>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}' class='btn btn-raised ripple-effect btn-default'>{out}</a>", 'currentItemClass' => "active" )); // did we find any matches? if( $items->count ){ $message = __("Showing results"); } } ?> Complete files attached with function.php were some functions are. All this files are in root folder (except js) of template. home.php main-search.php search.php main.js _func.php search.php
    1 point
  19. @Chris B - I also wonder if you'd be better off creating a module that works with SendInBlue's API rather than using SMTP. I would use WireMailGun as a starting point.
    1 point
  20. @Chris B Did you activate SMTP in your sendinblue account? https://help.sendinblue.com/hc/en-us/articles/115000188150-Troubleshooting-issues-with-the-SMTP
    1 point
  21. I have no experience with the blog module(s), but if a hook method attached to ProcessPageView::pageNotFound doesn't get executed at all for /blog/ URLs, this likely means one of two things: either there's no 404 exception when the user visits those URLs (i.e. the template of the page at /blog/ has URL segments enabled, but it isn't throwing 404 exception when a non-existing URL segment is accessed), or the module itself has some hook that prevents this from working. The first option seems more likely to me, but again I don't have any experience with this module, so can't say for sure. This could also be by design, so maybe @kongondo could step in and see if he has an idea about what's going on here? ?
    1 point
  22. Password is stored as a hash in the database. You cannot read it out. To set a new superuser (admin) password, put the following code in a template, or in your ready.php $users->get($config->superUserPageID)->setAndSave('pass', 'mynewpassword'); Don't forget to remove the code later.
    1 point
  23. @adrian Page identifiers were never intended to be used as part of a destination. These identifiers use the full, absolute URL of the page being identified. Perhaps destination selectors could come in handy here? Haven't ever tried it this way before, but I imagine redirecting subscribe/{all} to [[1495]]{all} (or [[1495]]/{all}} if trailing slashes are turned off) would work. Anything inside the square braces is passed to pages->get and replaced with page->url, which is why I believe this will work.
    1 point
  24. Thanks @psy yeah I know about those, it was more an editing workflow thing. Client has 50 + images in a gallery, flagged they were being added to the end not the start. I didnt realise they were using the filesystem select and not just drag dropping onto the field. Having said this, it's interesting that those two workflows for adding images function differently.
    1 point
  25. Thank you! The module is this one by @David Karich https://modules.processwire.com/modules/page-hit-counter/
    1 point
  26. Just a little update because of new API additions, so now you could just do foreach ($pag as $p) { foreach ($languages->find('name!=default') as $lang) { $p->setAndSave("status$lang", 1); } } Thanks @szabesz for mentioning I'm adding this here for completeness
    1 point
×
×
  • Create New...