Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. I'm sure there's more and other ways but look here http://processwire.com/talk/topic/3429-how-to-set-text-linecharacter-limits-in-templates/
  2. Thanks for the suggestion k07n. But the code you removed is there for a reason. I see how this might affect performance (haven't spent too much time with it) but it's needed to rearrange the boxes when you click on the red titles to toggle the descriptions or you will end up with overlaying stacked boxes. Maybe there's another way to archive it but haven't looked into it.
  3. Ryan I noticed some with the module version it takes from github module. For example LanguageLocalizedUrl module has "0140.1.1"
  4. Make sure the authsalt key is the same in config.php. And maybe delete cache and sessions in session folder.
  5. Yeah of course:). But you think there will be ever a author with more than some hundred articles? And what count of tags do you expect? Nonetheless, I think if you likely to have less tags than articles this (following) will pretty fast (like what you do) and if you use markup cache to generate it only every hour or once a day: Just to give another example, in the authors template. I'm sure you know already but just for the record. $cache = $modules->get("MarkupCache"); // is already cached or expired? if(!$data = $cache->get("author_tags", 3600)) { $tags = $pages->find("template=tags"); foreach($tags as $tag) { if($pages->count("template=author, tags=$tags")) { $data .= "<a href='{$tag->url}'>$tag->title</a>"; } } $cache->save($data); } echo $data;
  6. They also drink beer? I guess they also talk about you? Be cautious with the NSA¡ (hey guys!)
  7. Thanks for posting your solution! Ok got it about the cache. Hah, yes the $array->removeAll() can be way easier than a complex add remove, possible but maybe not really needed. It's just like clear and put back the new values. Yeah I agree with what you say. At some point you maybe better switch to an advanced SQL statement to make sure it's as fast as possible. Yea an universal module would be possible also but just a lot more work. But actually fun. Something random and minor: You can also use the shorter $event->arguments("Page"); About the method. I was thinking if there's an simpler way to collect the tags and add them. The only one I can think of is this: $articles = $pages->find("template=article, author=$author"); $author_tags = new PageArray(); foreach($articles as $art) $author_tags->import($art->tags); What you think? Should be faster I think.
  8. It's the same as here, just that it's a inputfield and not a page http://processwire.com/api/hooks/#what_object
  9. Yeah you check for its name or type and only add the button if its a field yo want to.
  10. Well the correct option is, you're right: $nav->render(array("max_levels" => 1)); "levels" area already false and only for classes. If you output only 1 level you don't need "collapsed" true. Not sure what you mean with you get all items.
  11. Not sure what's about the cache thing? Do you have cache on templates? Well it's a naive way, but if you don't go to thousands or ten thousands of tags and articles, you should be fine. I have pretty large sites with lots of things happening like this and I don't even need caching because it's so fast. You can always create a custom SQL query, and join the tables you need. Creating a module isn't complicated or lot of work at all! It same as you code in the front-end and you already know how to do it. Here's a module done in 2 minutes and half the code is yours from above: <?php class TagsHelperAuthor extends WireData implements Module{ public static function getModuleInfo(){ return array( 'title' => 'TagsHelperAuthor', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init(){ $this->pages->addHookAfter("save",$this,"hookPageSave"); } public function hookPageSave(HookEvent $event){ // get current page saved $page = $event->argumentsByName("page"); if($page->template == "article"){ // save tags to page field on author page or any page $authorPage = wire("pages")->get("template=author, name=Authorname"); $authorPage->tags->removeAll(); // remove all tags first $authorTags = new PageArray(); $allTags = wire("pages")->find('template=tag'); foreach ($allTags as $tag) { if(wire("pages")->count("template=article, tags=$tag")) { $authorPage->tags->add($tag); } } $authorPage->save("tags"); // save only the field of the author page } } } Not tested but should give you a hint. Edit: The idea is on every Article save, you update the authors "tags" field and add/save them there. You would just have to adapt it as I don't know your structure exactly. (Changed the $pages to wire("pages") because it's in a function.)
  12. Oh the PW module is here http://modules.processwire.com/modules/chrome-php-logger/
  13. I just installed, went to site, enabled ChromePhp, hit refresh and it's showing in console. This is on latest Chrome 27.0.1453.116 Mac OSX with ChromeLogger 4.0.2 https://chrome.google.com/webstore/detail/chrome-logger/noaneddfkdjfnfdakjjmocngnfkfehhd Looks like you got the Chrome beta version 28. I think it either could be a bug in Chrome beta or ChromeLogger with this version of Chrome. I updated the module to 0.0.4 with a newer ChromePhp class 4.1.0, maybe it's working out for you now.
  14. Soma

    My new Portfolio

    This must be on your side or slow connection. It takes 5 seconds here with wifi.
  15. You can also use the last get() selector inside the parents() and remove get() on the end. It new in 2.3 to use selector with parents in think and you can now also use closest(selector). But using find() in your example and then parents() will not work because find always returns a page array and parents needs one page object. Instead of find you could use a get() like diogo showed.
  16. Soma

    My new Portfolio

    Nice site thanks for sharing. Really cool photos. But what is very annoying on mobile is you can't zoom them. Or didi I miss something? What did you use now for the image scaling? Does the min size plugin work with ImageManager?
  17. You Should remove install.php and site/install directory. PW will even remind you of it every time you login
  18. Ohh I just got an idea for a module. What if you have a gallery type page you upload the images as usual to an images field. Then when saving the page there would be children created for each image and the ones removed from the gallery page. This would be very simple few lines of code. Sorry to hijack your thread. Nothing against the method to have one images field you store a gallery. If theres no metadata needed with no multilang and so on it is a pretty good and simple way to a simple gallery. I use it myself too.
  19. I think the point "without additional" coding or a module is a bit strange seeing all the code you needed to make this gallery... In that time you can code an simple upload module twice
  20. If the action of the form is without trailing slash and PW redirects to the url with a trailing slash, you'll get no GET. This is a feature
  21. Actually $modules->get("MarkupBox") will install the module if it's not
  22. Thanks for writing a new tuto. If you want to have image pages without creating every page manually one by one, you can also use ImagesManager which has upload tool to directly create the pages. So the argument doesnt count ;-)
  23. It's working now, I had to set the rewrite base (uncomment) Rewritebase / But as I said already in the PM, the permission on those accounts for apache and ftp user seem to create problem with not allowing to delete files over ftp created by php. Common problem with shared hostings. I deleted the files on server then with a php script, and installed a fresh install 2.3 stable. It seems all working with image upload. There's seems to be some limitations with that hosting in terms of memory and so on and the sftp is slow as hell. A little more infos seem to be found here: https://sourceforge.net/apps/trac/sourceforge/wiki/Project%20web%20and%20developer%20web%20platform
  24. Yeah sure. I dont know the SF hosting but maybe I find something or know how to do it.
×
×
  • Create New...