Leaderboard
Popular Content
Showing content with the highest reputation on 11/06/2015 in all areas
-
TemplateEnginePug (formally TemplateEngineJade) This module adds Pug templates to the TemplateEngineFactory. It uses https://github.com/pug-php/pug to render templates. doctype html html(lang='en') head meta(http-equiv='content-type', content='text/html; charset=utf-8') title= $page->title link(rel='stylesheet', type='text/css', href=$config->urls->templates . 'styles/main.css') body include header.pug h1= $page->title if $page->editable() p: a(href=$page->editURL) Edit Project on GitHub: github.com/dreerr/TemplateEnginePug Project in modules directory: modules.processwire.com/modules/template-engine-pug/ For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.5 points
-
If you upload a random txt or html file to your web server, can you access it at the other domain? My guess is yes. If so, it sounds like an honest mistake. Perhaps you are on a dedicated IP and the owner of the other domain made a typo when setting up their DNS record. Or perhaps the web host made an error when setting up their VirtualHost directives in Apache. You should be able to correct the problem by adding this to your .htaccess file somewhere after the "RewriteEngine On" line: RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC] RewriteRule ^ http://www.yourdomain.com/ [L,R=301]4 points
-
Here's the same exact problem and solution for it http://stackoverflow.com/questions/13872892/htaccess-deny-requests-from-unauthorized-domains4 points
-
Helllllo! I am working on a simple module / pet project for a module that inserts custom classes into specific templates for forms that are generated via the api. I use bootstrap a bunch and am always messing with the defaults in processwire, now it should be a simple manner to tweak my settings in the admin area. As this seems to be something that I keep needing I thought that others might as well. Right now the functionality is pretty simple: Select the templates that you want to override the default styling on. Set your new defaults .... Proffit. What I would like is maybe some suggestions for options or functionality that I should try for. I have never really deep dived into modules so this is a bit new to me, but as I am looking for a new development job I would push myself for something cool. https://github.com/MuchDevelopment/FormStyler/tree/master3 points
-
You can use "|" to OR fields, or OR values, but not expressions. Your selector is translating to something you didn't intend. I think the selector you might be attempting is instead this: template=event, enddate>=2015-11-06, enddate|startdate<=2015-11-13 Or you could use OR-groups: template=event, enddate>=2015-11-06, (enddate<=2015-11-13), (startdate<=2015-11-13) Either of the above selectors says: The template must be event. AND The enddate must be greater than or equal to 2015-11-05. AND (The enddate must be less than or equal to 2015-11-13 OR the start date must less than or equal to 2015-11-13).3 points
-
Ok, I have quickly hacked together some enhancements to Wanze's Batcher module. There is now a Create Fields tab where you can enter the details (name, fieldtype, label & description) for as many fields as you want. A couple of things to keep in mind - some field types require some key config options on the Details and Input tab, so in some cases I am not really sure how much time this will really save. Because of that I have currently limited the field types that can be created to simple text based ones (text, email, url, numeric etc), and left out the more complex ones like page, repeaters, datetime etc. Of course there is the potential to add some of these settings to each item in the create field batcher, but we wouldn't want things to get overly complex. Also, I am not really sure of the etiquette here - I have modified Wanze's module and he may not want to see this functionality in his module (which would be totally fair). So what I have done for now is just include a screenshot of what I have created and I'll wait to hear from him to get his thoughts before posting the code.3 points
-
While ryan's code does certainly work you should be aware that this code wouldn't find events, that are longer than the mentioned "5 days from now" but still currently active. Such events could start before today and end after more than 5 days. To catch those as well you'd need another OR option like you can see in this topic: https://processwire.com/talk/topic/10682-help-with-date-range-selector/2 points
-
enddate<=2015-11-13|startdate<=2015-11-13 the OR operator "|" evaluates the first part and follows to the second only if the first is false. In this case the start day is never evaluated because it cannot possibly be true if the first is false. The start has to be earlier then the end. PS: True, I didn't even think that you are using OR between expression. Ryan to the rescue already2 points
-
Module Toolkit does exactly this, and more! https://processwire.com/talk/topic/8410-module-toolkit/ It's still not in a release worthy state - some functionality needs some tweaking - it's on my list, but you know how it goes Still worth checking out though as I think it should handle your needs very well. PS Welcome to PW and the forums!2 points
-
It seems like you are trying to use "delayed output" aproach as you are extending on a standart site-languages profile. You have to put all the html generated in gallery template in a $content variable for it to be rendered in the _main.php. Like this: foreach($page->images as $image) { $thumbnail = $image->size(150,100); $content .= "<a class='gallery' rel='gallery-1' href='{$image->url}' title ='{$thumbnail->description}'><img src='{$thumbnail->url}' style=' padding: 5px;' ></a>"; }2 points
-
I AM ABSOLUTELY APPALLED AND OFFENDED! Your organizational skills are better than mine lol2 points
-
Have you checked the copied site using http://isit.pw/? If you update content on your client's site, is it coming up on the copied site; or is the content "as it was" at the time it was copied? Are you able to access the control panel with your known credentials? Is there a chance that the new domain is "pointing" to your client's site? It depends. If the servers are behind a load balancer or caching server, then many websites would appear to use the same IP. It would all depend on the hosting provider's configuration and DNS configuration of the domains in question.2 points
-
In Martijn's hook, the $oldPage retrieval will return the same exact copy as $page, so it won't be possible to compare them since you'll be comparing the same page instance. What you'd want to do instead is retrieve a fresh copy of the page, then you should have two different instances of the same page to compare: $oldPage = $this->wire('pages')->getById($page->id, array( 'cache' => false, // don't let it write to cache 'getFromCache' => false, // don't let it read from cache )); I think you'll need the dev branch for this, as the 'getFromCache' option is not in PW 2.6.1 if I recall correctly. In 2.6.1 or earlier, I think that the following would work, but is not quite as efficient: $this->wire('pages')->uncache($page); $oldPage = $this->wire('pages')->get($page->id);2 points
-
Just add another option to the selector, where you check for cases, where the start is before the searched date and the end is after the searched date. $selector = ""; // Start date inside $selector .= ", range=("; $selector .= "datefrom>=".$input->whitelist("datefrom"); $selector .= ", datefrom<=".$input->whitelist("dateto"); $selector .= ")"; // End date inside $selector .= ", range=("; $selector .= "dateto>=".$input->whitelist("datefrom"); $selector .= ", dateto<=".$input->whitelist("dateto"); $selector .= ")"; // range overspans searchrange $selector .= ", range=("; $selector .= "dateto>=".$input->whitelist("dateto"); $selector .= ", datefrom<=".$input->whitelist("datefrom"); $selector .= ")";2 points
-
I just published a pre-release of my new password reset module. It will enable identification from any field of your choice, and is fully translatable. Integration is just 2 lines of code, the first is calling the controller, the second is loading a script (no dependencies). You can download the code on GitHub at https://github.com/plauclair/PasswordReset. Also, have a look at the reset process in this video https://vid.me/eEVY. This exemple is not styled, but there should be all you need in there to style it. Comments and feature requests very welcome!1 point
-
TemplateEngineTwig This module adds Twig as engine to the TemplateEngineFactory. Screenshot of the available configuration options: Project on GitHub: https://github.com/wanze/TemplateEngineTwig Project in modules directory: http://modules.processwire.com/modules/template-engine-twig/ Only Twig related things should be discussed in this thread. For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.1 point
-
So this is basically a recreation of a menu tutorial from W3Bits, tweaked to include the Advanced checkbox hack. Demo. Even the Advanced hack itself was tweaked: apparently this bit is causing issues with Safari, so I removed it: @-webkit-keyframes bugfix { from {padding:0;} to {padding:0;} }I found this particular configuration to work quite nicely. A previous menu I tried had a problem with the menu items staying expanded between media query breakpoints, when resizing the browser. Below is the CSS for the menu. You will notice that it is mobile-first: /* Menu from http://w3bits.com/css-responsive-nav-menu/ */ /* Note: the tutorial code is slightly different from the demo code */ .cf:after { /* micro clearfix */ content: ""; display: table; clear: both; } body { -webkit-animation: bugfix infinite 1s; } #mainMenu { margin-bottom: 2em; } #mainMenu ul { margin: 0; padding: 0; } #mainMenu .main-menu { display: none; } #tm:checked + .main-menu { display: block; } #mainMenu input[type="checkbox"], #mainMenu ul span.drop-icon { display: none; } #mainMenu li, #toggle-menu, #mainMenu .sub-menu { border-style: solid; border-color: rgba(0, 0, 0, .05); } #mainMenu li, #toggle-menu { border-width: 0 0 1px; } #mainMenu .sub-menu { background-color: #444; border-width: 1px 1px 0; margin: 0 1em; } #mainMenu .sub-menu li:last-child { border-width: 0; } #mainMenu li, #toggle-menu, #mainMenu a { position: relative; display: block; color: white; text-shadow: 1px 1px 0 rgba(0, 0, 0, .125); } #mainMenu, #toggle-menu { background-color: #09c; } #toggle-menu, #mainMenu a { padding: 1em 1.5em; } #mainMenu a { transition: all .125s ease-in-out; -webkit-transition: all .125s ease-in-out; } #mainMenu a:hover { background-color: white; color: #09c; } #mainMenu .sub-menu { display: none; } #mainMenu input[type="checkbox"]:checked + .sub-menu { display: block; } #mainMenu .sub-menu a:hover { color: #444; } #toggle-menu .drop-icon, #mainMenu li label.drop-icon { position: absolute; right: 0; top: 0; } #mainMenu label.drop-icon, #toggle-menu span.drop-icon { padding: 1em; font-size: 1em; text-align: center; background-color: rgba(0, 0, 0, .125); text-shadow: 0 0 0 transparent; color: rgba(255, 255, 255, .75); } label { cursor: pointer; user-select: none; } @media only screen and (max-width: 64em) and (min-width: 52.01em) { #mainMenu li { width: 33.333%; } #mainMenu .sub-menu li { width: auto; } } @media only screen and (min-width: 52em) { #mainMenu .main-menu { display: block; } #toggle-menu, #mainMenu label.drop-icon { display: none; } #mainMenu ul span.drop-icon { display: inline-block; } #mainMenu li { float: left; border-width: 0 1px 0 0; } #mainMenu .sub-menu li { float: none; } #mainMenu .sub-menu { border-width: 0; margin: 0; position: absolute; top: 100%; left: 0; width: 12em; z-index: 3000; } #mainMenu .sub-menu, #mainMenu input[type="checkbox"]:checked + .sub-menu { display: none; } #mainMenu .sub-menu li { border-width: 0 0 1px; } #mainMenu .sub-menu .sub-menu { top: 0; left: 100%; } #mainMenu li:hover > input[type="checkbox"] + .sub-menu { display: block; } }Below is the markup outputted using mindplay.dk's method. I found it impossible to output with MarkupSimpleNavigation or MenuBuilder. The homepage is added as the first top-level item. Notice the onclicks that make it work on iOS < 6.0. The clearfix class cf for the top ul is important. Otherwise the element will have no height (got bitten by this..). <nav id="mainMenu"> <label for='tm' id='toggle-menu' onclick>Navigation <span class='drop-icon'>▼</span></label> <input id='tm' type='checkbox'> <ul class='main-menu cf'> <?php /** * Recursive traverse and visit every child in a sub-tree of Pages. * * @param Page $parent root Page from which to traverse * @param callable $enter function to call upon visiting a child Page * @param callable|null $exit function to call after visiting a child Page (and all of it's children) * * From mindplay.dk */ echo '<li><a href="' . $pages->get(1)->url . '">Home</a></li>'; function visit(Page $parent, $enter, $exit=null) { foreach ($parent->children() as $child) { call_user_func($enter, $child); if ($child->numChildren > 0) { visit($child, $enter, $exit); } if ($exit) { call_user_func($exit, $child); } } } visit( $pages->get(1) , function(Page $page) { echo '<li><a href="' . $page->url . '">' . $page->title; if ($page->numChildren > 0) { echo '<span class="drop-icon">▼</span> <label title="Toggle Drop-down" class="drop-icon" for="' . $page->name . '" onclick>▼</label> </a> <input type="checkbox" id="' . $page->name . '"><ul class="sub-menu">'; } else { echo '</a>'; } } , function(Page $page) { if ($page->numChildren > 0) { echo '</ul>'; } echo '</li>'; } ); ?> </ul> </nav>Edit: fixed the end part, thanks er314.1 point
-
Hi, I've recently started on a team using Processwire, so Im quite new to it but I've had plenty of experience with Symfony2. We have an agency licence for the FormBuilder module and we want to use some sort of CI to deploy. When you first install FormBuilder module, it creates some new tables and requires some set up via a GUI including adding a licence key. We have looked into containing our licence key in a config file, then using some JSON files to sync to the database. This doesn't give us a lot of control and requires a fair bit of custom migrations. Is there a way to deploy a ProcessWire site including the FormBuilder module without going through the GUI setup every time? If not, Are there any migration modules for ProcessWire? If not, are there any recommended third party migration tools that are frequently used with ProcessWire? Many thanks!1 point
-
Hi everybody and thanks again for a great product! It happened to me to develop a website with pages containig a FieldtypeFile input. Backend users can upload zip archives there, and that archives are auto-extracted immediately after upload (of course I checked the 'unpack zip files' in Input section of my FieldtypeFile input). But the original zip archive is auto-deleted after that, and it is not present in both backend and $page->files array. However I would prefer to keep both the original zip file and all files extracted from it. This may be very useful if we want to give users the possibility to download all files associated with a certian page as a single zip archive. The quick analysis led me to /wire/core/WireUpload.php:saveUploadZip($zipFile). This function deals with uploaded zip archives. I modified it, and now all my zip uploads are not deleted after zip auto-extraction. I did it in a quick and dirty way but it could be done much better. E.g. a special config option "Keep uploaded archives after unzip" could be introduced. Can do it if the community will have some interest. My WireUpload file is attached below. WireUpload.php1 point
-
Thanks Ryan. I used your snippet to redirect all incoming traffic from potentially misleading domains, which works. Might be possible that this is an error, however, I contacted the domain-owner who is not responding, which is strange. I was thinking that the whole domain might have been kidnapped and the owner does not know about it. In any case, it is the responsibility of the domain registrar to investigate this further. Thanks to everyone for the comments. Again, ProcessWire stands out when it comes to community support.1 point
-
@Bernhard Which geocoding service are you using? You should certainly make sure you or others do not braking any usage limitations that you accepted.1 point
-
link removed due to restriction of google maps api: Terms of Use Restrictions The Google Maps Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.1 point
-
Exactly the way I posted above. How else would your browser get your requests to the right server if there wasn't a way to get the ip address behind a domain.1 point
-
@kongondo Lots of tools on the web - http://get-site-ip.com/ for example.1 point
-
It seems your contact.php is unfamiliar with PW, so it does not know about $sanitizer. You should put your php code in a template file,or include it via one of the ways (template, init etc.). Or bootstrap PW in contact.php, https://processwire.com/api/include/1 point
-
If page-publish permission is installed, it is required in order to edit already-published pages. I suppose we could override that for Language pages if the user has lang-edit permission, but not sure we should, will have to think about that one more. However, if you want to provide that behavior for your site, you could do so with a hook in your /site/ready.php file: wire()->addHookAfter('Page::editable', function($e) { if($e->object->template == 'language' && $e->user->hasPermission('lang-edit')) $e->return = true; }); I agree, I have committed a slight modification that enable this (now on dev). These changes are minor enough and restricted to one permission (lang-edit) that it doesn't affect anything else, so it's fine.1 point
-
Thanks a lot, this menu system is really performing well. I think there's a small mistake at the end of the template code ; it is auto-fixed by most browsers, but not by all. The very last block should be : function(Page $page) { if ($page->numChildren > 0) { echo '</ul>'; } echo '</li>'; }1 point
-
@Neo, Mod note: I changed the title of your topic. Reading it quickly one would think there was an 'illegal copy of ProcessWire'.1 point
-
Maybe not as convinient, but if you are comfortable in editing json, you can export a text field with built-in PW field export feature, paste the generated code to text editor, duplicate it as many times as you want, edit nearly all the field's properties and import it back into your site.1 point
-
Use both of these in the command line. If both return the same IP you can be really sure. nslookup mydomain.com nslookup copydomain.com1 point
-
It wasn't so hard in the end. I decided not to store the rank in the database, but just constructing it from the user points. I solved the problem of users with the same rank position in this way // I get the players pages and sort them by points $players = $users->find("sort=-user_points, sort=name"); // I explode the players into a scores array $scores = $players->explode("user_points"); // Using array_unique to remove duplicated scores $unique_scores = array_unique($scores); // With array_unique previous key are preserved so i need to create a new array with new keys $reindexed_scores = array_values($unique_scores); // I cycle through players foreach($players as $player) { // I get the key of the user pointe in the array $position = array_search($player->user_points, $reindexed_scores); echo $position; echo " - "; echo $player; echo " - "; echo $player->user_points; } Hope this could help someone else with the same need.1 point
-
I've come back to this topic myself about 3 years after having a similar need in a different thread. This code, from Tom's activity log module and altered slightly, gets both an old and new version of the page when hooking before saveReady: $clone = clone($page); $this->pages->uncache($clone); $old = $this->pages->get($clone->id); // Now just echo both the fields you are interested in: echo $old->field_of_interest . " becomes " . $page->field_of_interest; exit; On save, that should give you access to the old and new versions of the page where you want to compare just one or a few fields and you know which ones you're interested in already. Seems to simple now when you see the use of clone()1 point
-
I had the presumption that Pages::saveReady hold the values from the to be saved page (runtime) and not the value out of the database.1 point
-
I had this kind of issue with cached navigation (one for desktop, one for mobile = mmenu), and wanted to make sure the database cache is removed as soon i save one of the pages displayed in the navigation. I came up with a module that hooks in to page save. It removes the necessary cache items asfollow: - when pages with template settings_socialmedia or settings_textblocks are saved it removes the main.footer cache entry - when pages with template list_agenda or item_agenda are saved it removes the block.agenda cache entry - when any of the pages in $navigationPages are saved it removes both the man.navbar and main.mmenu cache entries <?php /** * ProcessWire Save Actions * * Actions to be run on page save * * @ 2015 Raymond Geerts * * ProcessWire 2.x * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ class SaveActions extends WireData implements Module { /** * Return information about this module (required) * */ public static function getModuleInfo() { return array( 'title' => 'Save Actions', 'summary' => 'Actions to be run on page save', 'version' => 1, 'autoload' => "template=admin", 'singular' => true, 'author' => 'Raymond Geerts', 'icon' => 'floppy-o' ); } public function init() { $this->pages->addHookAfter('save', $this, 'actionsAfterSave'); } public function actionsAfterSave($event) { $page = $event->arguments[0]; if ($page->template == 'settings_socialmedia' || $page->template == 'settings_textblocks' ) { $this->cache->delete("main.footer"); $this->message("Cleaned WireCache for front-end footer HTML"); } elseif ($page->template == 'list_agenda' || $page->template == 'item_agenda' ) { $this->cache->delete("block.agenda"); $this->message("Cleaned WireCache for front-end agenda block HTML"); } else { $homepage = $this->pages->get('/'); $navigationPages = $homepage->and($homepage->children); foreach($homepage->and($homepage->children) as $item) { if ($item->template->altFilename == "clickthrough" && $item->hasChildren() ) { $navigationPages->append($item->children); } } if ($navigationPages->has($page)) { $this->cache->delete("main.navbar"); $this->cache->delete("main.mmenu"); $this->message("Cleaned WireCache for front-end navbar HTML"); } } } } It saved some page-loading time when caching navigations. Because they are displayed on every page, its a smart thing to do. A trick to make the current page (and parents) have a selected / active class i did the following: in the head of the _main.php <script> var globalJS = <?php $globalJS = array(); $globalJS['parents'] = $page->parents()->remove($homepage)->append($page)->each('id'); echo json_encode($globalJS, JSON_FORCE_OBJECT); ?> </script> in the navigation i put the page ID in each <li> item like this: echo "<li id='navbar-pageID-{$item->id} role='presentation'>"; (and in mmenu as follow:) echo "<li id='mmenu-pageID-{$item->id}'>"; In my main.js file i have the following: (function() { // set navigation menu items active $.each(globalJS.parents, function(key, value){ $('#navbar-pageID-'+value).addClass('active'); $('#mmenu-pageID-'+value).addClass('current'); }); }());1 point
-
that call would go right before your other settings; also make sure that your $items returns some pages1 point
-
Hey I've been wondering if any of you who are currently using this in production or testing have any feedback? I want to do a proper release soon, and I'd love your input! Cheers!1 point
-
I found how to fix the problem.... disable AutoJoin field on the PageReference field..... Not sure if this is documented somewhere...that setting AutoJoin will limit your options when you have more then 170 references....1 point