Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. I get the idea, but have hard time to see a good use case or the clear benefits. I think I get the point but hardly felt need to share templates between languages. Care to elaborate a little more with some real examples or resources where this comes into play?
  2. Theres also a max width height setting to use to resize larger uploaded images if they're bigger.
  3. Like this $out = sprintf($this->_("Created %d pages."), $count); for within modules.
  4. Ok I thought there maybe a way to construct PageArray's. You can't alter the children built in property I think as it is in fact a method to retrieve the children from the DB on runtime using selectors $page->children($selector), but you could add a custom value on runtime memory and make it another PageArray. Then add some children to it. Since you can't use "children" just have to name it different for example "mychildren" and it works. You can also then use all the PageArray methods on them as ususal. You will just have still the children() and parent(), siblings() etc available but they would be in the original context of where the page originally is and not in your pseudo PageArray. Here's a test script might useful for many others too. // note just simple test pseudo code // base array object $pa = new PageArray(); // get some pages to work with $category = $pages->get("/templates/"); $about = $pages->get("/about/"); $home = $pages->get("/"); // add new PageArray property "mychildren" $category->mychildren = new PageArray(); // add other pages in $category->mychildren->add($about); $category->mychildren->add($home); // you can sort them $category->mychildren->sort("-created"); // add the $category to the base array $pa->add($category); // output the nested PageArray using mychildren echo "<ul>"; foreach($pa as $p){ echo "<li><a href='$p->url'>$p->title</a>"; echo "<ul>"; foreach($p->mychildren as $child){ echo "<li><a href='$child->url'>$child->title</a></li>"; } echo "</ul>"; } echo "</li></ul>"; Gives a nested list: Templates About 2 Home
  5. oops...
  6. Thanks for posting this. Just wanted to say that you don't need to include all core and install files. Just the template and module folder would suffice. Or if you want you can use Profile Exporter module to export the setup as an install.
  7. No, again you can't add children or have parents on a self created PageArray or WireArray. For the other thing I think there's some easy solution, just can't make any sense atm with those sub categories... however to get it to work I think you can simply check against all children of the category. if($children = $pages->find("template=offer,product_category={$category->children}")){ ...
  8. I wanted to add that both Page List Label modules copied my modules method resizeThumb(), which is only there to resize "FieldtypeCropImage" thumbnails (3rd party module) thus it's using another format for naming. Normal PW images get resized using normal $image->size(0,100) method. Edit: thumbnails created by FieldTypeCropImage also still doesn't get deleted when the image is removed from page so I didn't bother about their naming too there.
  9. You can't have "children" or "parents" in a Page or WireArray. It's a one dimensional thing. You could create your own 2 dimensional array storing the id's and then iterate that to create the navigation. You could create the navigation directly from the categories and list pages that belong to the current category. I'm not sure about your menu example, as I don't see where the products are and such, it's just the categories as is. So without really see all context and needs according to your code I would do it like this. $navcode = '<ul>'; foreach($categories as $category) { $navcode .= "<li>$category->title"; if($children = $pages->find("template=offer,product_category=$category")){ $navcode .= "<ul>"; foreach($children as $offer) { $class ($offer === $page) ? " class='active'" : ''; $navcode .= "<li$class><a href='$offer->url'>$offer->title</a></li>"; } $navcode .= "</ul>"; } $navcode .= "</li>"; } $navcode .= "</ul>"; $nav->set('navcode', $navcode);
  10. I don't see any abuse here. $config is a good way to do it, it's there for such things.
  11. I see what you mean. I use my teflon theme so I don't know this problem as the top menu are dropdowns and it requires me 1 click to get back anyway. You could use my theme or place the "Modules Manager" admin page on root, instead of setup. Well, it's possible of course. It would require a hook for the ProcessModule to render a link back to the Modules Manager. Since Modules Manager isn't autoload but a process module only loaded for that particular admin page, it's not something that can be done within Modules Manager and would require an additional module just for that. Modules Manager is planned to be integrated in core at some point, so there will be lots of changes and improvements needed and will replace the current module page.
  12. Soma

    Hit 1000+ likes

    Thanks for the likes It means a lot to me you guys seem to really like me. I don't know what this number means but it's a little scary... heh
  13. Just for convenience: http://processwire.com/api/cheatsheet/?filter=hidden&advanced
  14. The magic selector include=hidden does the trick.
  15. Theyre not messed up at all more a slick playing ground which also helps spotting possible issues with other modules an upgrade paths. What you could do is let the installer there and just clean db and files and run installer again. Or use shell script to quickly rsync and copy a clean install over your existing. If you want to start new module or theme you can also spend 1 minute to create clean install.
  16. I have a shell script to do a copy of an install to copy files and db. I only use this to dev live copy the current state. For developement and testing i only use 1 or 2 installs i have since a year. No need to install a new pw just for creating a new module or theme. So dont understand your need to do so.
  17. The forum is full of example for it if you search for it enough Basic code needed to add new pages would be. $np = new Page(); // create new page object $np->template = "basic-page"; $np->parent = "/about/"; // or id or page object $np->title = "Hello World"; $np->save(); It's very easy once you get the hang of it. There's a lot more you can do and sometimes it can be handy to know it to import stuff and create pages via API or in modules. If you want to can take a look at my super duper page creation tool, which is a work in progress but you can add endless amount of pages while looking TV. http://processwire.com/talk/topic/2138-process-tools-create-pages-wip/
  18. Edited post for you Nik.
  19. Ah you mean it shows the php code on the Website? This is php code and you have to put it in <?php ... ?> to make it work. Sorry but this is so obvious that I didn't think of it.
  20. Guys coordinate your responses, hold straight.
  21. It happened to me. I wrote some post and after posting it was gone forever
  22. Will checkout. Link is broken!
  23. I still don't get what the problem is. "language" template you don't need to do anything anyway, that's why it's a system template. Getting language is simply $user->language->name. And you'd have to do this once in your templates code if you do it "right". Actually Ryan is a designer and coder, and compared to most out there, that call themselfs designers, he's even better. ;-) I don't think there's much UI issues, well not more than with any other CMS software. Localized urls? You mean using the LanguageLocalizedURL module? Even there you don't really need a extra field. Yeah it's obvious.
  24. According to autocomplete documentation you'd have to do something like this (works). $('#search_query').autocomplete({ source: function(request, response){ $.ajax({ url: '/search/', type: 'get', dataType: 'json', data: { 'q': request.term }, success: function(result){ response(result); } }); }, minLength: 2 });
  25. Have you tried 'data' instead of Data. sorry mobile autocorrect..
×
×
  • Create New...