Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Community Answers

  1. Soma's post in Access $page inside render field was marked as the answer   
    You use wire("page")
    If rendering a repeater field from another page, let's say
    echo $pages->get(1001)->render("repeater_field"); So in template/fields/repeater_field.php
    echo "<p>Page containing the repeater: " . $page->title . " " . $page->id . "</p>"; echo "<p>Page currently requested: " . wire("page")->title . " " . wire("page")->id . "</p>"; // render each repeater echo $value->each("<section><h2>{title}</h2>{body}</section>");  
  2. Soma's post in Max. length of selector (when searching with OR) was marked as the answer   
    It says 500. https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Selectors.php#L24
  3. Soma's post in Include=all but exclude unpublished? was marked as the answer   
    Repeaters are located in /admin so access protected too. So I guess for a not logged in user you wouldn't be able to $pages->find(selector)  the repeater pages. I think then you'd need a "check_access=0" or a "include=all".
    Since they're in /admin you could also consider implicit "has_parent=RepeaterParentID" or "has_parent=2" ($config->adminRootPageID) instead of exluding trash somehow.
  4. Soma's post in Pages query only showing all results with default language was marked as the answer   
    Are they active for the alternate languages even?
  5. Soma's post in $input->post["{variable}"] empty? was marked as the answer   
    PW doesn't allow for multidimensional post arrays. https://processwire.com/talk/topic/691-wireinput-only-allows-one-dimensional-arrays-why/
  6. Soma's post in init.inc invoked multiple times? was marked as the answer   
    PW aborts the page in a case the page isn't viewable or not found and renders the 404 instead. A 404 is never a redirect to the 404 page. A 404 always stays at the requested URL and sends a 404 header instead. The rendering of the 404 page does a $page->render(), thus calling the init.php again.
    That's why you should include() a functions php with required_once() or alike to avoid redeclarations.
  7. Soma's post in Reset cache from admin page was marked as the answer   
    The module core -> PageRender does have a button.
  8. Soma's post in Multilingual 301 redirects was marked as the answer   
    Those tools don't support multi language.
  9. Soma's post in image->url path and image real url was marked as the answer   
    $child->image->url If this only does give you the path to the folder, your image field is multiple and not a single image field.
    If you change your field to only allow 1 image, then this would give you the full url to the image.
  10. Soma's post in set selected values for InputfieldAsmSelect in a custom process module was marked as the answer   
    Usually it works if you just set the "$entryPage->titel" to the value, but think it only works with the ID.
    Depends if you use the "ID" or the additional "value" options (id=value|title)
    If using value:
    foreach ($options as $option) {     $field->addOption($option->value, $option->title); } foreach ($entryPage->titel as $value) {     $valArray[] = $value->value; // array of values selected, not key=>title } $field->attr("value", $valArray); Using ID
    foreach ($options as $option) {     $field->addOption($option->id, $option->title); } $field->attr("value", $entryPage->titel); // just passing the field (only when outputformatting off) If that doesn't work just make an array using id.
    foreach ($entryPage->titel as $value) {     $valArray[] = $value->id;  }
  11. Soma's post in POST variables to page via ajax was marked as the answer   
    Make sure your post url ends with a slash.
  12. Soma's post in Sanitizer pageName and french closing quote ("«") was marked as the answer   
  13. Soma's post in Check same field value in all children's page ? was marked as the answer   
    Or little more efficent
    if(!$pages->count("parent=$page, my_field=0")) {      echo "Sold out"; }
  14. Soma's post in Umlauts not transcribed correctly in custom user name module was marked as the answer   
    Or use new $sanitizer->pageNameTranslate(str)
  15. Soma's post in Soma's Multisite module - how to configure? was marked as the answer   
    I'm not sure I understand.
    It doesn't work like this. The name on the domain page remains the same for each language. Otherwise it doesn't match what you entered in the module settings.
    Language through language segment is set on root "/" page name. It then becomes domain.com/en/ or whatever you set it.
  16. Soma's post in Getting file properties, can only get url was marked as the answer   
    What url does it output?
    It may your file field is multiple, then AnimalSound would be an WireArray.
  17. Soma's post in $page->template returns wrong template name was marked as the answer   
    You seem to have a $page->template = 'something' in your template.
  18. Soma's post in How to debug $page->prev - $page->next no output given was marked as the answer   
    Try this
    $anzeige->save(array("quiet" => true, "uncacheAll" => false)); Any page save clears some cache. I don't know but it was always like this that when you have page saves on front-end templates happening.
    That might interferer with some methods that are cached previously. Not sure why prev and next are affected here, could be a bug or a side effect of an optimization for these methods that have some overhead.
    You can also call a $pages->uncacheAll(); before your $page->next and it won't work.
  19. Soma's post in Problem with Pagination was marked as the answer   
    Then your
    <h1><?php echo $page->title; "Holiday Cottages"; if($page->editable()) echo "<p><a href='$page->editURL'>Edit</a></p>"; ?></h1> also outputs title of cottage and edit link?
    It's like you overwrite $page somewhere (header.inc?) or just the template like $page->template = "something" instead of $page->template == "cottage" ...
    Strange, and I don't see what's wrong. Only thing I know is that you're viewing a page that template doesn't have pagination enabled.
  20. Soma's post in $users->find() not respecting upublished/hidden ? was marked as the answer   
    I think since you can't unpublish users, Users find will find all anyway.
    $users->find("your selector here", $options = array("findAll" => false));
  21. Soma's post in Strange Thing... Why i don't get a screenshot via some responsive test websites..? was marked as the answer   
    If you watch console it says: 
    Refused to display 'http://processwire.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
    Just confirming that it's htaccess.
  22. Soma's post in Image doesn't load and it gives a 403 error was marked as the answer   
    "/site/assets/files/1015/" I guess you have multiple image field which would be an array. How about 
    <img src="<?php echo $page->promote->first->url; ?>" />
  23. Soma's post in Meaning of Family Setting: Can this template be used for new pages? was marked as the answer   
    But that's not creating a new page, but changing an already created page. As I remember it was always like this.
  24. Soma's post in Hooking InputfieldFile::renderItem was marked as the answer   
    Or better named
    $pagefile = $event->arguments("pagefile"); $id = $event->arguments("id"); $n = $event->arguments("n");
  25. Soma's post in Ultimateparent in navigation was marked as the answer   
    I'm not sure I understand it correctly. But what if you set
    'max_levels' => 3, 'collapsed' => true, collapsed means it only shows the current branches.
  • Create New...