Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. Well you'd have to insert it into a image tag to see an image of course. echo $page->image->url only returns the url and not an image tag. You have to create your markup, PW doesn't generally generate markup. So that might look like this. Depends on how you need the image be rendered. $imgurl = $page->image->url; echo "<img src='$imgurl'/>"; That's all also shown in the images documentation with examples:
  2. If it's a single image field you do simply: echo $page->image->url; If the field allows for multiple you have to loop the field or directly access one through index. $page->image->first()->url; You find some API infos here http://processwire.com/api/cheatsheet/#files And also in the Docs http://processwire.com/api/fieldtypes/images/
  3. Ok thanks for confirming, I just updated the readme.
  4. I just setup a complete new install with this module, and it also didn't work with pagination. I only enabled urlSegments to the proxy template (as in manual) and as soon as I enabled page numbers also it started working again. Can you check if you have url segements and page numbers enabled on the language proxy template. Works all fine here.
  5. I will try later with a fresh installation, just to make sure. BTW what does my code example output? The admin debug output doesn't help much. Any errors? What are the url's and what does not work and does it show?
  6. Based on netcarvers first script I tried this on my products (550) and grouping them by price field. $pa = $pages->find("template=product,sort=sort"); $groups = array(); foreach($pa as $p) $groups["$p->sc_price"][] = $p->id; echo "<ul>"; foreach($groups as $key => $gr){ $count = count($gr); echo "<li>$key ($count)"; if($count){ echo "<ul>"; foreach($gr as $key => $pid){ $r = $pages->get($pid); echo "<li><a href='$r->url'>$r->title</a></li>"; } echo "</ul>"; } echo "</li>"; } echo "</ul>"; echo "<br/>memory:".memory_get_peak_usage()/1024/1024; This doesn't add much memory in my case, 1MB more and maybe takes +~1sec but haven't looked at execution times. So 2000 pages will maybe be around +2-3MB and 2-3 seconds. I can run this script along with a ton other heavy scripts easily with 16M php memory limit. Further if you use PW's markup cache to only generate the list once every hour you would save some resources. Try it and see what you get. If memory would be a problem you might still consider constructing 1 or 2 sql queries and see if it performs better. This surely would involve some complex sql joins over fields, fieldgroup and page tables and make sure pages are published etc.
  7. What field is the field you want to check the same value? If it would be a page field it would be easy with find selectors.
  8. Without SQL you could do it with simple bootstrap or in a template: foreach($pages->find("template=basic-page") as $p){ $p->body = str_replace("/newsite/","/",$p->body); $p->save(); }
  9. Just to make sure some more random thoughts. Any more infos would be helpful. What are the module setting? Have you enabled "Allow Page Numbers" in the template where you want to do pagination? Also try this code along with the pagination code: if($input->pageNum){ echo "<br/>pageNum: $input->pageNum"; } Any Infos on what doesn't work and what it exactly does would also be helpful. Generally any code in templates can maybe be the problem so I'm a little lost here because it works fine here. The url landitus posted is wierd and can't think of why it would be /page2/page2 as this is clearly wrong.
  10. In a autoload module you could hook the page render and replace all img tags. public function init() { $this->addHookAfter('Page::render', $this, 'hookPageRender'); } public function hookPageRender(HookEvent $event) { $out = $event->return; if(strpos($_SERVER['REQUEST_URI'],$this->config->urls->admin) === 0 ) return; $img_regex = '%(<img.*/>|</img>)%ixU'; $event->return = preg_replace($img_regex, "<div class='img'>$1</div>", $out); } If you want to only replace certain images in the body you could use some markers or a html parser like php simple html dom http://simplehtmldom.sourceforge.net/
  11. Oneliner alarm <?php if(!$session->noPop) include("./popup.inc"); $session->noPop = 1; ?> No intendation
  12. That error indicates the $user->viewable_pages either doesn't exist and or is not an page array so it can't call has().
  13. you can use the $page->passwordfield->match("somepasswordstring") function to compare hashs.
  14. Ups!
  15. Add new field, select "password" field and enter name.. Ahhh you mean so it get's used as a real password field with encryption? I don't think but should be possible to add functionality through a module? Edit: look normal so far, it works without anything!
  16. Where getting a little old! It's field_pass not field_password And yes you can put a "password" field in other templates
  17. There's a module you could use... but before you start, afterwards it won't work unless you maybe resave all pages via API when still n subdir. http://modules.processwire.com/search/?q=abstract
  18. Thx for the infos, but still can't see what would cause it. There must be something i don't see or know. Anyone have same issues?
  19. As much information possible to reproduce would be helpful, because pagination works fine here with whatever code. More code, module settings, setup, versions, PW in a subfolder, other modules that does something on urls or pagination?
  20. You could use my MarkupSimplaNavigation module to generate the navigation. I think you don't need to add classes to first grandchildren, as you could target them by CSS and JS easily without.
  21. I think it has to do with the users page which has no outputformatting like regular pages. So even a single (max1) image field will be a wire array. Ryan correct me, but I think $user has outputformatting on and if you retrieve user through $users it is out. So to test you could add a date field and see what that outputs in both cases.
  22. Hey guys. I don't have the time to look into it currently and pagination works for me in my testinstall. Thanks Wanze, never used caching, so good to know. If anyone want to help , just feel free.
  23. You could use ID_name or name_ID.
  24. Thanks Ryan, the /.../.../ was inserted by me. Ok I think i'll have to take a closer look to what modules I have (there's lots) on my playground. Edit: Yeah recent experiments on a save hook I forgot about was the problem...
  25. "print_r" on page or pagearrays isn't really helpfu as it will show a lot you don't want to see. Usually you try to find out if there's any pages found and fo am echo here and there. just echo $file_pages should return a list with id(s) 1003|1022|1033. Also I'm curious what you get with this? echo $fields->get("files_link")->derefAsPage ."<br/>"; echo $fields->get("files")->maxFiles ."<br/>";
×
×
  • Create New...