Leaderboard
Popular Content
Showing content with the highest reputation on 03/10/2016 in all areas
-
Currently I'm building a multilanguage website but what's more important, I managed to convert my "drop-in" helpers into modules. These include TemplateLatteReplace and NetteFormsHelper modules, which will be shared after they look stable enough. The Latte template engine module is almost invisible: handles default template render and wireRenderFile just fine. I may have gone with the TemplateEngine module but I like that it's lightweight and that I understand what's going on inside NetteFormsHelper makes creating forms a breeze (though it's 100% developer-centric), and I'm working on adding useful features to it. Currently it supports: ajax or non-ajax submission live form validation (js) automatically add js/css assets saving data as page using "json_storage" field (which is a simple textarea holding a json encoded array, but visually looks like a formatted table in the admin) send emails with Latte tempates several form layouts (form renderers) autocomplete: supports suggestions from arrays and urls (ajax) character counter: needs only passing an array of settings, can count up/downwards, its text is customizable/translatable Form and field definitions are separated so forms can be easily copied to another project. Just to clarify: these are non-PW fields. I also have an AutoSmush module (imagemin through resmush.it) which actually works but needs a major revisit before going public, if ever. Anyway, bulk running on site images eliminates google pagespeed warning, which is great. Another helper I'm usng is Tracy debugger, which was made into a module by adrian so one todo item could be removed These modules makes development much more fun. I should have started them as modules right from the beginning.7 points
-
@OllieMackJames: Are you able to use PW 3.0.10 for your site, or do you need to stick with PW 2.7 ? If you can use PW 3, you simply may copy one of the ImageSizerEngines into your site modules directory, change the classname, and add the optimization functionality. To add the functionality, I highly would suggest to use an API image option, e.g. array("optimize" => true). This way you are able to control which variation should be passed to the optimisation service and which one not. At the end of the image manipulation, you can ask if optimize is set: if($this->optimize) { $optimus = new Optimus('<your_license_key>'); $result = $optimus->optimize($dstFilename); file_put_contents($dstFilename, $result); } That's all you need. You also may set the optimize default to true in site/config.php $config->imageSizerOptions = array(..., ..., ..., "optimize" => true)); and then explicitly disable it via individual API option settings in your template files. Just choose what fits best for your site.3 points
-
After convincing my main client/boss of the advantages of PW over WP, I'm currently build his personal/company site new version. He's a Project Management expert and currently works for the United Nations. His website received around 2k unique visitors per day. Running WP on a Digital Ocean 4GB droplet with Varnish and Apache on Ubuntu 14. MySQL DB runs on another droplet with 2GB. There are other apps running on the same 4G server. I'm planning to use Laravel's Forge to admin the new version. It will make things easier I think. This new version will merge two websites, ricardo-vargas.com and macrosolutions.com.br (the company services). I'm posting the screenshots for the template and admin pages of a consulting service that today leaves at: http://macrosolutions.com.br/consulting/projects-offices-assessment-optimization-and-restructing/ on the old site. There's no front-end yet but I reckon posting these screens may help someone. Numbers: 43 Fields organized in 4 tabs.3 points
-
Hi folks! I'm about to add my new module FieldtypeAssistedURL to the repository. You find the source code on github and hopefully in the modules repository soon. Here an extract from the README.md: This module offers you a new field type AssistedURL Field, providing and input field for storing absolute and relative URLs. The field type adds a button to open the URL chooser dialog known from the CKEditor link feature without the tab navigation bar for specifying link attributes. Using the URL chooser dialog the editor may select URLs from internal pages or uploaded files via a search field with auto-completion, a page tree control, and a file selector control. Please feel free to post suggestions and any form of feedback here in the forums or on github. Wumbo2 points
-
Another thing you can do is hook Pages::added (only called for new pages, not when re-saving existing ones) and in your hooked function set the page name to the page id, which is already part of the page at that point.2 points
-
I agree it's not optimal either, but the best way to do this is to click on "Jo" to highlight it before dragging "Dateityp" under it. Think of it as expanding the tree below "Jo". Even though it has no children yet, you have to "open" them before you can put one in. It makes a lot of sense but I agree it's not the most intuitive experience. With Ryan adding long-click actions now, I think this would be a use case worth considering. I. e., dragging and holding a page on top of another page for one second could make it expand.2 points
-
ImageSizerEngine ImageMagick CLI Version 0.1.1 beta (requires PW 3.0.10+) Get it from the modules directory or from github. For information what it is and how to use and install, please read this Blogpost.1 point
-
Seems to be working fine for me on 3.0.10 - but I haven't exercised it to the full yet.1 point
-
Here's what I did. /* if(strlen($this->input->get->include) && $this->input->get->include !== 'hidden') { if($this->input->get->include === 'all') { if(!$this->user->isSuperuser()) $this->errors[] = "The option 'include=all' is only allowed for administrators"; } else { $this->errors[] = "Unrecognized value for 'include'"; } } */ //SB replaces above which FileCompiler thinks is a including a file $ginc = $this->input->get->include; if(strlen($ginc) && $ginc !== 'hidden') { if($ginc === 'all') { if(!$this->user->isSuperuser()) $this->errors[] = "The option 'include=all' is only allowed for administrators"; } else { $this->errors[] = "Unrecognized value for 'include'"; } }1 point
-
Servus bernhard, thank you for your attention. After a long office day I will better try this on weekend *). Fixed some stuff for the moment, especially dependencies from other modules (CKE). *) besides I have to clean up a messy PW test installation first1 point
-
Just a comment about stating both a name and a title here. If you set both then it's up to you to ensure that the URL of the page is unique—heavy caveat, I think I am correct in stating this... Certainly I found an error on the 2nd page creation (with some super dumb test code that did not even try to create unique URLs for pages; so probably not unexpected!), but then I was looking at how to make pages unique etc when I found I was trying too hard... I noted the error I was getting and Wanze's comment that solved my problem here, short answer, don't set a name and PW does it all for you1 point
-
You wouldn't want to optimize images multiple times. You'd rather want to hook into some point, where you you'd get the images, which are added successfully and just optimize those newly added ones. For details on which hook might be fitting you'd have to wait for other answers.1 point
-
Just for information, wire()->database is the core PDO database handler while wire()->db is the (now deprecated(?)) MySQLi version, kept available for some modules that haven't been updated PDO yet.1 point
-
While 2500 queries per page load is quite a bit, it isn't completely unheard of for a complex multi-language site (though it cries for a bit of caching). Two connection per view is normal. The SQL_NO_CACHE keyword is only added if $config->dbCache is disabled, which is enabled by default, and this definitely puts a heavy load on the server (data for every query has to fetched anew). So I'd enable dbCache in site/config.php again and test if the problem is still present, then also make sure that $config->debug is disabled for the live site.1 point
-
Yes, it prevent memory errors. The sizer is invoked in here in Pageimage. If it returns false, for what ever reason, but also for a memorcheck, the error is handled here in Pageimage starting from line 434. It writes a text line into the variation file: "This is intentionally invalid image data.\n"; And it logs that error. But it will not interrupt your page render / page load. It will proceed further content, just the image what would exceed your available memory isn't created, is missing. But this only belongs to the GD-lib, not to IMagick. IMagick can process image manipulation by lines or by chunks, what let it successful work with less memory too.1 point
-
You'd know the line numbers from any error messages that Tracy has reported. You can of course always enter line #1 for some scenarios. Maybe it would be nice if I had a trigger for inserting at the last line as well? But, agreed it is probably a little obscure as a feature - I'll see how much I end up using it and see if others find a use for it.1 point
-
Here's an old thread and Ryan's response A quick note for newbies....be careful not to invite the whole family ($page->find()) if you don't have enough room (memory)...you might need to limit numbers1 point
-
foreach($grandparent->find("template=product") as $product) { ... } should do the trick.1 point
-
dropped a first prototype onto github some minutes ago. very early stage, developed and barely tested under PW 3.0.9. Reuses some stylesheets from CKEditor, so be sure you have installed that as well, if you want to test it. https://github.com/nikosch/ProcessWireImageLink [edit] not sure, if this works in other versions of PW and how it behaves with additional image processors. But the code is no rocket science, so the chances are not too bad1 point
-
Right now I switched this particular case over to TemplateFile.. But thanks for this great insight gebeer! Didn't even know about this Can't get it working with AIOM where I need a "normal" one dimensional array $config->customJs has the array within "data" key $config->customJs->getIterator() doesnt work either and ->data is protected... By the way while investigating the source, Ryan commented the unique method and states that it's no longer necessary, add() is taking care of this already ;-) To "inject" custom vars into renderValue, should be possible anyways to "create" new wire() vars like wire('js', array()) (or wire()->set('js', array())), then it should be possible to $wire->js[] = 'foo' from the field template, and almost anywhere else..1 point
-
Hi arjen, I'll dig those up again. Not sure why I would have put an expiration on the pastes.1 point
-
This could look like this in a template $arrayData = array( "success" => 1, "products" => Array( Array( "id" => 1, "type" => 6, "name" => "product1", "title" => "Product1", ), Array( "id" => 2, "type" => 5, "name" => "product2", "title" => "Product2", ) ) ); class MyData extends WireData {} $someData = new WireArray(); foreach($arrayData['products'] as $prod){ $p = new MyData(); foreach($prod as $key => $val) $p->$key = $val; $someData->add($p); } $someData->sort("-type"); foreach($someData as $r) echo "$r->title<br/>"; $result = $someData->find("title=Product1"); foreach($result as $r) echo "$r->title<br/>";1 point
-
There's that idea for a social site (hard to come up with a correct term without giving too much away) I've been carrying around for ages. One thing that has always held me off was knowing that I'd need a tightly integrated forum. I've plugged a few forums onto existing sites and always regretted taking the job. So now that I've discovered PW, I decided to do it the other way round - build the forum on PW, then add everything else on top. I'm planning it to be highly interactive, so it's not something done in a week, yet it's simply incredible what PW allows you to do in a matter of a few days. Here's what I have so far (don't look to closely on the design, if I really go live with my idea, I'll have someone else with appropriate skills do the visual design). And don't mind the naming, I've only used PWForum as a working title in lack of inspiration. Start page (dynamic menu, sidebar configured using selectable widgets) It's reasonably responsive, not something I have experience with, so it's a learning curve I already asked you to overlook the visual issues, didn't I? (but hey, things are there and it validates) There's already a bunch of features like friends and badges built through page fields, but lots of the frontend logic still has to follow. A working private chat (jquery ajax polling) is already there. This is probably going to make it into the modules directory, even if it's just as proof-of-concept. Doing that I learned about the different ways of "magically" including scripts and styles. For production use, I'll have to implement some kind of memory caching in front of the webserver for all the ajax calls, which is also a new playground. Both chat and forum messages use bbcode-like markup. I'm building my own textformatter and editor bundle for that to get it lean and flexible enough. The textormatter already allows you to configure smiley patterns in the backend. There are going to be a lot of profile settings. I'm sure I'm going to have to add more than one tab. This is just a project I'm doing for fun, so I don't have a timeline, it's more about toying with things and finding clean solutions. If things work out, I hope to have everything worked out some time around Easter and bundle it as a site profile for others to disassemble1 point
-
I´m building a Markup Patternlab for my company to make it easy for our Devs and Graphic Designers to speak about the same elements and force them to produce reusable code. This is a little side project of mine because i have to manage some freelance designers, devs and our inhouse designers and devs. So this Patternlab is also serving as corporate styleguide once finished. If im allowed I will publish the whole App for the comm. Have a look:1 point
-
Update: For the curious minds, the site is published at: http://www.ecocarb.com.br/ ( but only pt-br version for now) --- I'm creating a small project for a company owned by a cousin of mine and I'm using it to try new things, most on the front-end side but I decided to try jade with php. What I'm using: gulp to run all tasks – compile all sass and jade files and copy processwire files to the public folder bourbon + neat – nice mixins and grid system with a small footprint (project total css if less than 8kb - gzipped) jade + jade-php – I'm loving jade and with the jade-php npm package I can run ProcessWire code just fine. It's not the perfect world, sometimes I have to mix <?php ?> tags but I'm fine with it for such small project. Here's my basic-page.jade file: The rendered html: And here's the homepage so far (please ignore the translation, it is not done yet): And homepage's code: extends _main block header link(rel='stylesheet', href!='<?php echo $config->urls->templates?>css/home.css') block main-content include partials/_hero.jade .cta section h6 - echo __('O que dizem nossos clientes') include partials/_comments.jade a.button(href!="<?php echo $pages->get('/contact/')->url ?>") - echo __('Teste grátis por 30 dias') br small - echo __('Agende uma apresentação') section.desc h2 - echo $page->summary .services .line-behind-text h6.section-title - $services = $pages->get('/services/')->get("headline|title") - echo $services include partials/_cards.jade1 point
-
1 point
-
This also seems interesting as maybe also seen: http://madebymany.github.io/sir-trevor-js/1 point
-
Now we have this, I can imagine we have a "snippet" bucket somewhere were we can share some high quality "snippets".1 point
-
1 point
-
I'm not 100 % sure right now, but I think if you don't set a name, Pw takes already care of this problem. Edit: Yep it does, found the code in Pages::___setupNew() protected function ___setupNew(Page $page) { if(!$page->name && $page->title) { $n = 0; $pageName = $this->fuel('sanitizer')->pageName($page->title, Sanitizer::translate); do { $name = $pageName . ($n ? "-$n" : ''); $child = $page->parent->child("name=$name"); // see if another page already has the same name $n++; } while($child->id); $page->name = $name; } //... So just set the title. If the same title appears multiple times, the API generates a name with -1,-2,-3...1 point
-
you just have to assign the page object to the field. //assuming that the video page was created before this foreach ($tags as $tag){ // get the corresponding tag page $tagPage = $pages->get("template=tags, title=$tag"); // if the page doesn't exist, create it if(!$tagPage->id){ $tagPage = new Page(); $tagPage->template = $templates->get("tag"); $tagPage->parent = $pages->get("/tags/"); $tagPage->title = $tag; $tagPage->save(); } // assign the tag page to the video page $videoPage->of(false); $videoPage->tags = $tagPage; $videoPage->save(); } Voilá! Didn't test this, but should work Edit: corrected the code according to what was said in the next two posts1 point