Jump to content

interrobang

Members
  • Posts

    244
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by interrobang

  1. The official docs say this: I didn't test, but something like this should work for you: $catPages = $pages->find('parent=/system/category, title=print|video'); $categories_selector = ''; foreach ($catPages as $catPage) $categories_selector .= ", categories={$catPage}"; $result = $pages->find("parent=/articles/, body*=$query $categories_selector");
  2. Arjen, I dont't know if already know about this, but maybe you can apply for the mailchimp inegration-fund and get some money out of your efforts: http://mailchimp.com/about/integration-fund/
  3. Another review in german: http://lukasepple.de/blog/2012/08/grundlagen-processwire/
  4. I think it would be nice if we could do something like that: $myImagesizer = new ImageSizer(); $myImagesizer->setUpscaling(false); $myImagesizer->setQuality(20); $myImagesizer->size(600, 400); $img->apply($myImagesizer); This way it would even be possible to extend Imagesizer and add some new methods to it without modifying Pageimage. I am thinking at filters like blur, desaturize,...
  5. Have a look here: http://processwire.c...ng-image-field/ You know that you can sort the images by drag and drop? I would go with the 2 images field approach if possible.
  6. In order to get use phpstorms codesense you must tell phpstorm what variables are there. Just add a PHPDoc comment like this to your php template files and it should work. Even without using my fork you get some codesense support, but a lot of properties are missing. /** * @var Pages $pages * @var Page $page * @var Templates $templates * @var Fields $fields * @var Users $users * @var User $user * @var Roles $roles * @var Permissions $permissions * @var WireInput $input * @var Sanitizer $sanitizer * @var Session $session * @var Config $config */
  7. I just googled and found a chinese blog mentioning pw: http://www.cnblogs.com/web8cn/archive/2012/07/30/2614795.html
  8. There are a lot of useful polyfills like this jquery plugin out there. Have a look here: https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-browser-Polyfills I like especially the web forms polyfills. Nearly every html5 form feature can be used now in every browser! Thanks for mentioning php-diff - could be useful for an upcoming project.
  9. Ryan, in my github repo (https://github.com/b31/ProcessWire) all my phpdoc changes are done. Do you want a pull request?
  10. Most of the time my customers want self hosted videos. Usually I give them a simple File-Field and embed the video with a <video> tag and include a javascript (mediaelementjs.com) with flash fallback for browsers without html5-video support. Medialement.js even has a youtube plugin so you can Embed youtube videos like this: <video width="640" height="360" id="player1" preload="none"> <source type="video/youtube" src="https://www.youtube.com/watch?v=nOEw9iiopwI" /> </video> I have not used this module yet, but maybe Medialement.js is a interesting option to include?
  11. And there is even a vim plugin for phpstorm: http://plugins.intellij.net/plugin/?id=164
  12. Soma, you have swapped the labels of "Goto Setup" and "Goto Pages" in AdminHotkeys.module Your module is now part of my default processwire setup. Really useful..
  13. I updated your code: <?php $features = $pages->find("featured=1, limit=6, sort=-date"); foreach($features as $feature) { $thumb = $feature->images->first()->size(100,100); echo "<li>" . "<a href='{$feature->url}'><div id='explore_thumb'><img src='{$thumb->url}'></div></a>" . "<h3><a href='{$feature->url}'>{$feature->title}</a></h3>" . "<em>{$feature->date}</em>" . "<p>{$feature->intro}</p>" . "</li>"; } ?>
  14. Wow, this is a nice little helper. Great work! One suggestion. Is it possible to go to the templates / field main page if I just press enter in the empty modal? This way we dont't need a additonal shortcut for these pages.
  15. You can work in fullscreen in PhpStorm, too. But I think a IDE is for advanced programmers like yourself of less use. I only know some PHP basics and I think a IDE can help me a lot to write better code in less time. I want to add all properties and methods which are currently invisible because they are called via magic methods but are listed in the Cheatsheet. Basically I want the Cheatsheet available in my IDE I think I dont understand what you you are saying about most properties are not API accessible. My IDE shows basically the same information as the APIGen documentation. I think there is no need to add better comments to the public methods. Yours work quite well in my IDE. If you are really concerned that we can see public functions that are not part of the public API you can maybe add a @access private or a @internal tag? The offical purpose of the @propery and @method tags is to add documentation for "magic" properties and methods. So I don't think we get a incorrect view of the API. See here: http://manual.phpdoc...operty.pkg.html http://manual.phpdoc...method.pkg.html I haven't completed the phpdoc-comments for all classes yet, but the most important classes are ready: https://github.com/b...f073ad2ea97d03a
  16. It seems there isnt't very much interest in this. Anyhow, Ryan, would you merge phpdocs like this example into you code if I send you a pull request on github?
  17. In this thread Ryan said a history module will be part of the next major release:
  18. I would like to see some more usage of PHPDoc comments. As a quick test I modified the Page class to include @property comments for all the magic properties, and it works great so far. My IDE now doesn't show warnings for things like $page->name and even gives me autocompletion. I think it would quite useful to include something like this for all the classes also listed in the cheatsheet. What do you think about it? Btw, my IDE is PHPStorm. This is how my Page.php header now looks like: EDIT: Updated the code example to include the cheatsheet comments: /** * ProcessWire Page * * Page is the class used by all instantiated pages and it provides functionality for: * * 1. Providing get/set access to the Page's properties * 2. Accessing the related hierarchy of pages (i.e. parents, children, sibling pages) * * ProcessWire 2.x * Copyright (C) 2010 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * * @property int $id The numbered ID of the current page * @property string $name The name assigned to the page, as it appears in the URL * @property string $title The page's title (headline) text * @property string $path The page's URL path from the homepage (i.e. /about/staff/ryan/) * @property string $url The page's URL path from the server's document root (may be the same as the $page->path) * @property string $httpUrl Same as $page->url, except includes protocol (http or https) and hostname. * @property Page $parent The parent Page object or a NullPage if there is no parent. * @property int $parent_id The numbered ID of the parent page or 0 if none. * @property PageArray $parents All the parent pages down to the root (homepage). Returns a PageArray. * @property Page $rootParent The parent page closest to the homepage (typically used for identifying a section) * @property Template $template The Template object this page is using * @property FieldsArray $fields All the Fields assigned to this page (via it's template, same as $page->template->fields). Returns a FieldsArray. * @property int $numChildren The number of children (subpages) this page has. * @property PageArray $children All the children (subpages) of this page.* Returns a PageArray. See also $page->children($selector). * @property Page $child The first child of this page. Returns a Page. See also $page->child($selector). * @property PageArray $siblings All the sibling pages of this page.† Returns a PageArray. See also $page->siblings($selector). * @property Page $next This page's next sibling page, or NullPage if it is the last sibling.† See also $page->next($pageArray). * @property Page $prev This page's previous sibling page, or NullPage if it is the first sibling.† See also $page->prev($pageArray). * @property string $created Unix timestamp of when the page was created * @property string $modified Unix timestamp of when the page was last modified * @property User $createdUser The user that created this page. Returns a User or a NullUser. * @property User $modifiedUser The user that last modified this page. Returns a User or a NullUser. * @method string render() Returns rendered page markup. echo $page->render() */ class Page extends WireData { ...
  19. I think you are talking about an already existing feature:
  20. It should be quite easy to add these methods to Pageimage by a module. ImageSizer already has everything we need. I just did a quick hack and put the Pageimage->size method into my template.php, just to see whats possible with a few modifications, and it seems to work great. function resizeImage($image, $width, $height, $cropping=true, $upscaling=true) { $width = (int) $width; $height = (int) $height; $basename = basename($image->basename(), "." . $image->ext()); // i.e. myfile $basename .= '.' . $width . 'x' . $height . "." . $image->ext(); // i.e. myfile.100x100.jpg $filename = $image->pagefiles->path() . $basename; if(!is_file($filename)) { if(@copy($image->filename(), $filename)) { $sizer = new ImageSizer($filename); $sizer->setCropping($cropping); $sizer->setUpscaling($upscaling); $sizer->resize($width, $height); if($image->config->chmodFile) chmod($filename, octdec($image->config->chmodFile)); } } $pageimage = clone $image; $pageimage->setFilename($filename); $pageimage->setOriginal($image); return $pageimage; } usage like this: $neverUpdscaledImage = resizeImage ($page->image, 100,100,true,false); $uncroppedImage = resizeImage ($page->image, 100,100,false,true); echo "<img src={$neverUpdscaledImage->url} />"; Btw, I dont't recommend to do it like this. I just wanted to test whats possible.
  21. Thank you Ryan. I did not know about template->cache_time as it is missing on the cheatsheet. This looks like a nice solution for my use case!
  22. Not tested, but cant't you store your custom sortfield temporary in your pages and sort them later by this field? Something like this: foreach ($yourpagearray as $p) { $p->sortfield = toLowerCase($p->title); } $yourpagearray->sort("sortfield"); EDIT: this code should work: foreach ($yourpagearray as $p) { $p->tempsort = strtolower($p->title); } $yourpagearray->sort("tempsort");
  23. In the moment the cache clearing options only appear if you specify a cache time > 0. Is it possible to have the options always selectable? This is my use case: I build a multi-language using the "Display a different language based on URL pre-segment" approach and want my pages cached. The only pages I can enable caching are my language-gateways, otherwise the first requested language will be used for all languages. In the moment I am using a simple custom module which clears the cache of every page on any page save, which works fine, but I would prefer tu use your cache clearing options. Does this make sense or is there some logical error on my side?
  24. Hm, maybe thats the reason my colleges sometimes call me a "Typo Nazi". I always use kB, so it doesn't look like a mistake for me. But now I started to look around how my applications format "kB", I can only find the all uppercase formatting KB. Maybe this is a compromise between correct and pretty? And I couldn't find any document explaining why kB is mixed case, while the rest (MB, GB, TB,..) is all uppercase.
  25. Thank you Ryan, your idea works perfectly fine in my use case. This is even better then entering tags! I always forget these Textformatters exist. Nice to hear they will get internal support!
×
×
  • Create New...