Leaderboard
Popular Content
Showing content with the highest reputation on 05/20/2016 in all areas
-
ProcessWire 3.0.19 lets you work with thousands of pages at once, with a new $pages->findMany() API method! https://processwire.com/blog/posts/find-and-iterate-many-pages-at-once/13 points
-
Our agency website is not exactly new, because we relaunched it late 2014. At this time we have build it with the CMS Contao and Bootstrap as framework. Although I always liked our website, I was never quiet happy with it. Contao is a great CMS, but knowing ProcessWire it felt tedious managing content. Also it limited me as a developer. So the past months I have rebuild our website with ProcessWire and switched the framework to UIkit, because it made a good first impression on me and I wanted to learn it. Now I am happy with our website, because it is cleaner, faster, easier to manage and more optimized for search engines. www.designconcepts.de Modules used: ProFields ProCache Map Marker Pages2JSON Markup Sitemap XML Tracy Debugger Email Obfuscation Regards, Andreas11 points
-
WireCache is a really nice way to quickly cache data to the database, but when working with json data there are some quirks. Imagine the following examples: $data = $cache->get('my-key', WireCache::expireHourly); if(!$data){ $data = […] $cache->save('my-key', $data, WireCache::expireHourly); } // API response $response = json_decode($data); $image = $response->data[0]->image; // or $html = "<div data-json='$data'></div>"; Both should work from the quick look. Both will fail as soon as the cache kicks in. This is because the implementation of WireCache tries to be smart and does automatically decode data, which is detected to be json. But it doesn't just decode it like in my example, but rather uses json_decode()'s second parameter to decode the json as associative array(s) instead of stdobject(s). If you prefer the object syntay to traverse your json data or you really want to store raw json, then I've got two hooks for you, which do prevent the automatic json detection of WireCache, so you can work with the stringified json as you need to. Just replace the get() and save() calls in the example with getRaw() and saveRaw(). $wire->addHook('WireCache::saveRaw', function(HookEvent $event){ $args = $event->arguments(); $args[1] = '::RAW::' . $args[1]; return $event->return = call_user_func_array([$event->object, 'save'], $args); }); $wire->addHook('WireCache::getRaw', function(HookEvent $event){ $args = $event->arguments(); return $event->return = str_replace('::RAW::', '', call_user_func_array([$event->object, 'get'], $args)); });9 points
-
Ryan, big thanks for putting this into core! This is all magic by sforsman. For us use cases are things like looping and sending newsletters, big exports etc. Really a big difference in performance, memory usage and code simplicity when working with more than 10 000 pages.9 points
-
I wrote an article about ProcessWire for the German print magazine t3n (total circulation around 38k). Translated title is: "Flexible like frameworks: why the CMS ProcessWire is a real alternative to WordPress". The article will eventually also be available online (here), but for now you can only see the title and the teaser there. It’s an overview article that talks about content management (fields, pages, templates), the API, multi-lingual content and front-end editing in ProcessWire.9 points
-
Website builders have their place and serve a purpose. They can be a quick fix and allow more people to have a presence on the web. I believe there is no need to fear them or worry that products like ProcessWire will be replaced by them. We could spend all day debating the merits of these products or just continue as we do making ProcessWire a better platform. I've been doing this since 1977 and have seen many things come and go. I honestly believe the webwork market will still continue to function long after these products have matured and 10 other new web building technologies have come along. This market changes everyday in ways that no one can adequately predict. I believe that change is always good, improving what needs to be improved and getting rid of what no longer works. Have a blessed Friday9 points
-
We're recently completed a sizable project for Qatar Racing (www.qatarracingltd.com). This was a bespoke build pulling in a JSON feed of horses from a 3rd party. This feed was then incorporated into a members area where members could comment and reply on horses, effectively a full messaging app. Qatar Racing (www.qatarracingltd.com)8 points
-
I can see those tools putting the Mom and Pop Wordpress "developers" out of business, but as far as I know they have a very long way to go before they can build a complex interactive data driven website.6 points
-
Is my 100th post I wanted to do something special. I edited a video, hope you like it Just for fun Edited: Now with subtitles4 points
-
Hi everyone I´m creating an AdminTheme based on Semantic UI framework. Here is the beta version. I 'm fixing bugs. Github here Changelog: 0.0.1 --- Fixed background color / image.4 points
-
That makes such a huge difference - I have a query (that I was obviously caching) which was taking around 4-5 minutes, that now happens in 45seconds! Obviously I still need to optimize some other components, but this is a huge improvement - thanks to everyone involved in this!4 points
-
Another really cool (at least I think so ) panel. Template Path allows you to temporarily change the template file of the page. By default, it adds "-dev" suffix to the filename, eg. home-dev.php, but you can change this on-the-fly to whatever suffix you want, allowing you to easily test different versions. Like the selector panel, you can make the change "Once", or "Sticky" for the session. Sticking with the "alert" approach to icon colors, if the template icon is green, then it is loading the default template file. If it is red, then it is loading your temporary template file. Hopefully you'll all find this very useful when debugging live sites - no excuses now to ever make changes to a live file without testing first Please let me know if you have any suggestions for enhancing this feature - we all work differently, so there might be some cool approach that I could support that I haven't yet thought of.4 points
-
4 points
-
3 points
-
Hi Adrian, Many thanks for that. I've just had word from the client that the new version of your module has their application up and running again. Outstanding response time!3 points
-
I think the mentioned change it not part of the discussed module, but really a change of a core module. So that's not the problem. @ottogal: You can try to use the AdminCustomFiles module (https://processwire.com/talk/topic/7588-admin-custom-files/) and just place a CSS file that overwrites this rule as you mentioned in your post already. This should work if I'm not overlooking smth.3 points
-
That the css way. You can also use php to achieve this: $i = 1; foreach($page->repeater_field as $repeater) { $i++; // 2, 3, 4, 5, etc $odd = $i % 2 == 0; if ($odd) { echo "<div class='item-$i item-odd'>"; // Use .item-1, .item-2, etc to style /* OR */ echo "<div class='item-$i item-odd' style='background:{$repeater->color_field}'>"; // Or use a the color field by soma to select color in repeater echo $repeater->text; // Left echo $repeater->image; // Right echo "</div>"; } else { echo "<div class='item-$i item-even'>"; echo $repeater->image; // Left echo $repeater->text; // Right echo "</div>"; } } This could be written less verbose, but I think it gets the point accross.3 points
-
Hi Steve - sorry you had to waste a couple of hours troubleshooting that, but thanks for the detailed analysis of the problem and the solution. The latest version should take care of it - please let me know if there are any continued problems. Thanks again!3 points
-
Some of the people who are using this are not in a position to afford "proper" webdevs, which is fair. They have a different business and "a website" is just one of their marketing channels. So what these builders are competing with is Facebook, Instagram etc. (even wordpress.com) – and once these people have a proper and thriving business and their budget and needs increase – we will be gladly helping them. Right? Or to put it differently: what smartphone cameras are capable of these days is amazing. The cost of DSLR is ridiculously low. Still, people hire photographers. Who sees their business model threatened by these generators should probably rethink it.2 points
-
Check what is $i (use TracyDebugger). Does: $pagesWithImages = wire('pages')->find($fieldname.">0, sort=title"); make a difference (removed .count)? You can also use: $imagedata = $p->getUnformated($fieldname); then you don't need is_array check.2 points
-
$wire and ProcessWire/wire() return the exact same object, but $wire is only available in template/bootstrap context. Depending on where you're trying to use wire() it might get compiled and should work as before.2 points
-
I've exactly the point to make as adrian. The whole frontend design part might get easier, but only for the simple content (some images, some text). Anythings remotely related to a larger set of data will probably not be handled by those sites anytime soon.2 points
-
MenuBuilder menu's are created from a JSON string that has info about each menu item: title, page_id, parent_id, etc...Easiest way to achieve this is to grab that JSON string, convert it into an array and use whatever recursive method tickles your fancy . Now that I think about it, I'll create a method in MB that just returns the JSON string or its array depending on the arguments you supply. That way you can have your cake and eat it too...like this guy did...2 points
-
2 points
-
Does that fulfill your needs: http://modules.processwire.com/modules/media-library/ Or if you need more functionality: https://processwireshop.pw/plugins/media-manager/2 points
-
2 points
-
Wanze, thanks for your reply and help. It works now. I think I mixed up global file template and the inheritance of the template engine. Thanks for the tutorial (and link) as well. Haven't seen it unfortunately. Somewhere about the last sentence made it clear BTW … it works with PW 3 (just smarty has some Notices, but twig works well so far)2 points
-
This worked for me: I'm doing a "addHookBefore" inside the ProcessPageAdd::executeTemplate Method. public function init() { if(!$this->user->isSuperuser() && $this->user->hasRole("XXXXXXXX")) $this->addHookBefore('ProcessPageAdd::executeTemplate', $this, 'redirectParent'); } Inside the redirectParent Hook Method public function redirectParent(HookEvent $event){ //Get ID from URL $templateID = (int) $this->input->get->template_id; //Check if it's a Newsletter if($templateID == 66){ //Get the Parent Page specified by the choose_sender_2016 Pagefield in the user & newsletter Template $parent = $this->pages->get("template=newsletter-clinic, choose_sender_2016={$this->user->choose_sender_2016}"); //Check if a Parent was found if($parent->id){ //Skip the Parent Selection with a redirect $url = "./?parent_id=" . $parent->id; if($this->wire('input')->get('modal')) $url .= "&modal=1"; $this->wire('session')->redirect($url); } } }2 points
-
@Sephiroth Heads up! If you look for something to design (I mean on specification level), what about a simple newsletter module? This is something I occassionally need and as I know there is no "boxed" solution for it. What I have in mind: - integrate with other modules, eg. WireMailGun (to handle statistics) - newsletter blocks with the ability to include other pages (I use PageTable or Matrix Repeater for this) - newsletter subscription/unsubscription - send preview - css inliner (eg. Emogrifier) I have these functionalities working but at a very low hand-made level. Anyway, just and idea that may get you electrified2 points
-
Welcome to ProcessWire and the forums... Here's a start: https://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/2 points
-
There's a data integrity check available under "Action" tab when editing a field.2 points
-
http://sachinchoolur.github.io/lightGallery/demos/videos.html2 points
-
I´m breaking blad Glad to be here again. I will make another video soon, maybe it's more serious or a joke...I don´t know.2 points
-
This module is deprecated in favor of RockMigrations. It'll continue to work and I might fix some smaller incompatibilities if they're reported, but no major development will happen on this anymore. There where various threads about a how to reasonably handle multiple dev/staging and live environments with ProcessWire and at best handle it as automatically as possible. A git based workflow makes it easy to handle files, but the pain point of migrating db changes has even lead to multiple requests of not handling template/field storage in the db at all. I've gone ahead and used for my own projects the concept of database migrations, which most frameworks are using to handle database changes – but the ProcessWire flavored way. ___ ___ ___ ___ ___ ___ ___ /\__\ /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ /::L_L_ _\:\ \ /::\ \ /::\ \ /::\ \ \:\ \ /::\ \ /:/L:\__\ /\/::\__\ /:/\:\__\ /::\:\__\ /::\:\__\ /::\__\ /::\:\__\ \/_/:/ / \::/\/__/ \:\:\/__/ \;:::/ / \/\::/ / /:/\/__/ \:\:\/ / /:/ / \:\__\ \::/ / |:\/__/ /:/ / \/__/ \:\/ / \/__/ \/__/ \/__/ \|__| \/__/ \/__/ Beta This module does help you managing migration files, where any database changes can be stored in php files using just the simple ProcessWire api at your disposal. It's not as nice as using the admin UI, but certainly better than trying to migrate changes manually and possibly weeks after adding the changes. Also there's always the option to create helper modules, which can export changes made in the admin UI to something usable in those migration files. For example I'm using an internal process module, which does let me export changes to template access rules as json strings, which I then use in my migrations to actually apply the changes. Now on to the meat – How to use the module: Read the following guide on creating own migrations Maybe use the CLI tool to speed up your workflow (and possibly automate stuff) It is generally recommended, but not enforced, that migrations are run/rolled back in order. When doing migrations or rollbacks, without specifying a migration, this module will stick to the order. Creating Migrations Your migrations will probably hold lot's of code, which does delete data. By now this module does not have any security measurements to prevent that. Be sure to test your migrations locally and possibly keep a database backup before running them. There are currently four types of migrations: default (Migration) Default migrations are the most free form migrations. There's just a description and two functions – update() and downgrade(). What you're doing in those functions is totally up to you, but it's recommended to try the best to keep changes as reversible as possible. Meaning that running update() and downgrade() once should have as less effect on the installation as possible. The ProcessWire API is available exactly like in modules using the $this->pages, $this->config, … syntax. FieldMigration TemplateMigration ModuleMigration All of those are there to make your life easier. They all have different but similar functions – which you can find in migrations created by this module – which ease the creation and removal of fields, templates or modules. All the boilerplate is handled by the base classes these migrations do extend, so you don't even need to think about update() and downgrade(). You can rather just describe the item you want to handle and the creation / removal process is taken care of. These are by now not highly tested, so please again be sure to test migrations before running them on important content. Command-Line Interface The module does include a cli interface, which does allow the migrations to be run automatically by CI or deployment scripts or just by you if you like cli's. The cli script is located in the bin directory inside the module's folder. It does however require a composer package to work, which you can simply add by running composer require league/climate in your site directory (or the root directory for pw 3.0). Make sure to require composers autoload.php in your config.php for 2.x installations. The CLI does have a quite handy help page, which you get by running php migrate -h so I'm just adding the important bits of that here: > php migrate -h […] Usage: migrate [-h, --help] [-i info, --info info] [-m migrate, --migrate migrate] [-n new, --new new] [-nf newField, --newField newField] [-nm newModule, --newModule newModule] [-nt newTemplate, --newTemplate newTemplate] [-r rollback, --rollback rollback] Optional Arguments: -m migrate, --migrate migrate Run a specific migration or all new* ones if none given. * From latest migrated to newest. -r rollback, --rollback rollback Undo a specific migration or the latest one if none given. -n new, --new new Bootstrap a new migrations file. Optionally you can already supply a description. -nt newTemplate, --newTemplate newTemplate Bootstrap a new template migrations file. Optionally you can already supply a description. -nm newModule, --newModule newModule Bootstrap a new module migrations file. Optionally you can already supply a description. -nf newField, --newField newField Bootstrap a new field migrations file. Optionally you can already supply a description. -i info, --info info Get detailed info about a migration. -h, --help Show all commands of the cli tool. Link the migrations cli update save to ProcessWire's root: https://processwire.com/talk/topic/13045-migrations/?p=118329 Helper Functions There are already a handful of helper function included in the Migration base class, which tackle things I found to need way to much boilerplate for kinda simple changes, but you can also add own custom helper functions via hooks. /** * This does use @diogo's while loop technique to loop over all pages * without getting memory exhaustion. */ $this->eachPageUncache("template=toBeHidden", function($p){ $p->setAndSave('status', Page::statusHidden); }); /** * $template, $field, $reference = null, $after = true * The below function reads like this: * In the template … add the field … relative to the field … in the position after/before */ $this->insertIntoTemplate('basic-page', 'images', 'body', false); /** * Edit field settings in context of a template */ $this->editInTemplateContext('basic-page', 'title', function($f, $template){ $f->label = 'Headline'; }); And a simple example of adding a custom helper as a hook. // in ready.php $wire->addHook('Migration::renameHome', function(HookEvent $event){ $name = $event->arguments(0); wire('pages')->get('/')->setAndSave('title', $name); }); // in the migration $this->renameHome('Root'); Snippets Still not sure how all this works in practice? Or you want to share a maybe more complex migration? Just head over to the Snippets Repo at Github. https://github.com/LostKobrakai/MigrationSnippets There are also less specific examples in the modules repository: https://github.com/LostKobrakai/Migrations/tree/master/migrations Appendix As long as the module is in Beta the helper functions in the Migration.php might be object to change/removal, so be aware of that. Download http://mods.pw/Bm https://github.com/LostKobrakai/Migrations1 point
-
The UI of the two panels should match as much as possible, otherwise I'm quite happy with anything that works with the fewest clicks possible, and provides ways to easily see in which states the settings are Oh, and many thanks for the new panel! Now I just need to train my memory not to forget about all the goodies your wonderful module offers1 point
-
1 point
-
That's not necessarily what I meant. Your solution should work too, but I think you don't need to do this extra copying. $items = $pages->find("template=product, title|body|options.title*=$freetext); E.g. if the user searched red, you can search within the fields of the product itself (e.g. title and body), aswell as in the fields of pages from the pageselector (e.g. options.title). This should be what you are looking for or did I miss something? What I meant regarding usage of 3rd party search is mainly regarding typos, result preview text and similar things that are offered e.g. when searching with google and co.1 point
-
@suntrop Thanks! If you are using the inheritance feature of Twig, you shouldn't use a global template file, I think that might solve the problem. At the moment, twig always receives the "app.html" template. But what it needs is to receive the "home.tpl" template file. Twig then sees that this template is inheriting from "app.html" and does its magic Edit: Maybe this helps https://github.com/wanze/TemplateEngineSmarty#best-practices It's Smarty, but the template inheritance stuff seems to work the same way in various engines @szabesz Cool, nice tutorial! Thanks for sharing the link Cheers1 point
-
I would if I was sure that this modue is causing problem, but as I wrote - "I don't know why", and @Pavle is facing the same problem with different module. I have installed this module on different instance of PW 3 and all seems to work fine (althrough it's an upgrade from 2.7).1 point
-
Seems good, so this newsletter module, if you can explain how it works and all, i can gain some perspective into it. Thanks that won't be bad though because i remember doing all newsletter by hand too1 point
-
1 point
-
Hi Adrian, I think there's a problem when using your module with any other code or modules that use fgets() or file() - such as Horst's WireQueueTextfile module (and possibly others.) I've just spent a couple of hours tracking this down over IRC with a client. The init() routine of your module sets PHPs auto_detect_line_endings flag to true - which can have un-intended consequences on other code run after your module initialises. In my client's case, they are using WireQueue with the textfile storage and it was throwing up errors, with your module installed, while unserialising a line pulled from the queue file using fgets() at the end of the getItem() method that pulls an item from the Wire Queue. Commenting out the following in TableCsvImportExport.module; ini_set('auto_detect_line_endings', true); fixed things for us. I understand the attraction of making the exported/imported files cross-platform compatible, but I think your module has other options open rather than changing the PHP setting during the init() routine. Perhaps, at the start of the import routine, you could read the initial state of that flag, then ini_set() it to true while you do the import and finally restore it to the initial setting on exit from your routine? Thanks for your great modules and for considering this request!1 point
-
1 point
-
@diogo: this is a really nice one. Many thanks for sharing!1 point
-
Disclosure and probably explanation: t3n started as "Typo3 News", https://web.archive.org/web/20051217050007/http://www.t3n.de/1 point
-
Just wanted to use this medium to say i am extremely happy and impressed with the community, I have been away from Processwire because of works and pressure, each time i come back here i see something amazing, and honestly Processwire 3.0 is amazing and looking forward to do crazy things with this.1 point
-
1 point
-
WOW! Just to answer myself; all of the above can easily be covered. Just don't use the render(); method. Step 1: fetch your menu data and store it in an array: $footermenu_items_json = $pages->get('name=footer-menu')->menu_items; // this is the menu page in menu builder, could also be fetched with the ID $footermenu_items = json_decode($footermenu_items_json, true); Step 2: use that array to build your custom markup: if( count($footermenu_items) > 0 ){ $out = '<ul class="nav-list">'; foreach($footermenu_items as $item){ $url = ($item['url']) ? $item['url'] : $pages->get($item['pages_id'])->url; $target = (1 == $item['newtab']) ? 'target="_blank"':''; $out .= '<li class="list-item"><a href="' . $url . '" class="list-item-link" ' . $target . '>' . $item['title'] . '</a></li>'; } if( $user->isLoggedin() ){ $out .= '<li class="list-item"><a href="' . $pages->get('name=login, template=login')->url . 'logout/' . '" class="list-item-link">Logout</a></li>'; } else { $out .= '<li class="list-item"><a href="' . $pages->get('name=login, template=login')->url . '" class="list-item-link">Login</a></li>'; } $out .= '</ul>'; echo $out; } Just make sure to var_dump the array somewhere to get an idea of what info is stored in there for the nested levels, etc. This is really neat. For me it's the best of both worlds - I can easily create and maintain menus in the backend, but can still fully control the output in the template. Thank you!! cheers, Tom1 point
-
1 point
-
i.am first you can puut this in your head.inc tamplate or some includeded file before.u are doing $page->url $pages->addHookAfter('Page::path', null, 'hookPagePath'); function hookPagePath(HookEvent $e) { $page = $e->object; if($page->template == 'article') $e->return = "/blog/$page->name/"; }1 point