Jump to content

MichaMichaMicha

Members
  • Content Count

    47
  • Joined

  • Last visited

Community Reputation

30 Excellent

About MichaMichaMicha

  • Rank
    Jr. Member
  1. I have stored a lot of users with their birthdate. Now I'm trying to find the birthdays for the next 7 days but without succes. Already tried things like: template=user,birthdate$=02-26 but without success. It can be done with a raw MySQL-query, but I would like to prevent anything like that. One thing that I've thought of was imploding the current day for the last 100 years, (birthdate=2016-09-26|2015-09-26|2014-09-26,etc) but that would result in a 1100 chars long selector.... Anyone has an idea?
  2. Have not checked out the module yet, but seems like a very nice addition. The JSON+LD Schema is really something Google will be using a lot in the future. Mark my words!
  3. Thanks. However I would like the editor to achieve something like: <p>Lorem</p> <div class='gallery'> <img src='1.jpg' /> <img src='2.jpg' /> <img src='3.jpg' /> </div> <p>Lorem ipsum</p> <div class='gallery'> <img src='4.jpg' /> <img src='5.jpg' /> <img src='6.jpg' /> </div> <p>Lorem ipsum dolor sit</p> Also I would like to prevent the editor to make use of hannacode because it's not that user friendly. Anyone got another suggestion?
  4. I have a content field (CKeditor) where I want the editor to be able to insert galleries with photo's anywhere in the content. Like the image insert functionality already present but with the option to add multiple images and have them transform into a gallery using Javascript. The javascript is not an issue but I'm not sure how to get the images nicely in the CKeditor field. I kind of like the solution Wordpress has for galleries... Any module like that available for Processwire?
  5. Agreed, but I guess PW has never had this many tweets about it as in the last two hours: https://twitter.com/search?f=tweets&vertical=default&q=processwire
  6. Not sure if it's been posted yet, but there is an article on: http://code.tutsplus.com/articles/introduction-to-processwire--cms-22624
  7. Thanks. I ended up just manually constructing the needed url in the template. Wasn't used as much as I thought so it beats the performance impact the Hook would have.
  8. Hmm, sorry. That doesn't work. This still returns the User. To be clear: I'm echoing $someUser->url on a 'normal' page/template. I want the hook to return the url from the 'normal' page appended with the name field for the user. I'm using urlSegments on the 'normal' template to receive the users name. There are multiple 'normal' pages that can have the same user as a urlSegment (having them in a Page selecting field on the 'normal' template) These are the some example values that I would like to return in the hook. /just-a-page/john-doe/ (when the calling Page is "just-a-page") /just-a-page/jane-doe/ (when the calling Page is "just-a-page") /another-page/jane-doe/ (when the calling Page is "another-page") /yet-another-page/lorem-subpage/john-doe/ (when the calling Page is "yet-another-page/lorem-subpage/") Of course I could just use this in my 'normal' template: echo $page->url.$theUser->name; but I'm always trying to learn, so would like to use the Hook
  9. I'm trying to modify the property 'path' for a specific Page (User, actually) using the following code: $this->addHookAfter("Page::path",$this,"modifyUserPagePath"); AND public function modifyUserPagePath(HookEvent $event){ $p = $event->object; if($p->template == "user" && $p->hasRole("ambassador")){ die("MODIFY THE PATH HERE WITH PREFIX FOR THE CURRENT VIEWING PAGE"); } } But i'm not able to retrieve the page that is currently running (as in, the page in the browser url). Please note I'm also using the render() method to render subpages content. I don't need the subpages url but only the original $page requested. Is there a pretty way to do this (besides looking it up via $_SERVER['REQUEST_URI'] )?
  10. Pretty old topic, maybe you figured it out already, but: You always need a wrapping class row when you use columns. You code should be: <div class='row'> <div class='medium-3 columns'> <div class='row'> <div class='small-12 columns'>content</div> <div class='small-12 columns'>content</div> <div class='small-12 columns'>content</div> </div> </div> </div>
  11. Finally got a workaround for this. Simply added $this->pages->uncache($repeaterParent); after https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeRepeater/FieldtypeRepeater.module#L556 When debugging is on in config.php you see the message twice: Session: Created Repeater Page Parent: /admin/repeaters/for-field-140/for-page-24397/ Not the prettiest solution but at least the client can add pages again.
  12. Works, and the following code should set the label in different languages (in combination with the code kongondo posted). $english = $languages->get("english")->id; $f->set("label{$english}","Date");
  13. I've stumbled upon a weird issue with repeaters. I've created a repeaterfield with only a title field and assigned it to a template. When I create the first page everything goes well, but then when I'm creating additional pages I'm getting this error: ProcessPageAdd: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'for-page-23947-23799' for key 'name_parent_id' I'm not getting redirected (probably because of the error, but the page does get created with the RepeaterField correctly). The problem seems to exist in the file FieldtypeRepeater.module in the function 'getRepeaterPageParent'. I've modified the file to see what actually happens and it looks like the function doesn't find the required page of saves the page correctly. protected function getRepeaterPageParent(Page $page, Field $field) { $repeaterParent = $this->getRepeaterParent($field); $parent = $repeaterParent->child('name=' . self::repeaterPageNamePrefix . $page->id . ', include=all'); $this->message("L".__LINE__." | selectorresult: ".$parent->id); if($parent->id) return $parent; $parent = new Page(); $parent->template = $repeaterParent->template; $this->message("L".__LINE__." | template: ".$repeaterParent->template); $this->message("L".__LINE__." | parent: ".$repeaterParent->path); $parent->parent = $repeaterParent->id; $parent->name = self::repeaterPageNamePrefix . $page->id; $parent->title = $page->name; $parent->addStatus(Page::statusSystem); // exit early if a field is in the process of being deleted // so that a repeater page parent doesn't get automatically re-created if($this->deletePageField === $field->parent_id){ return $parent; } $parent->save(); $this->message("L".__LINE__." | looking for: ".self::repeaterPageNamePrefix . $page->id); $this->message("L".__LINE__." | current for: ".$parent->name); $this->message("L".__LINE__." | Created Repeater Page Parent: NAME={$parent->name} a " . $parent->path, Notice::debug); return $parent; } See the attachment for the output. IMO the second time FieldtypeRepeater: L574 | should output the previously created page... Anyone has an idea what's going wrong? I'm on the latest master branch.
  14. Thanks. Have not had the time to check it, but it already looks good! Edit: Ryan quickly fixing things? https://github.com/ryancramerdesign/ProcessWire/commit/705de9e44ca76c03b1a1b0f5d39f7ef6b665cba8
  15. I've really tried my best but seems like I'm not able to change a fields description text in context of a template via the api. $template->fieldgroup->title->description = "This should be the description"; $template->fieldgroup->title->save(); $template->fieldgroup->save(); Anybody having the same problem? Note: if that works I also want to change the description in different languages, but that should not be a problem.
×
×
  • Create New...