• Content count

  • Joined

  • Last visited

Community Reputation

14 Good

About joe_g

  • Rank
    Sr. Member
  1. thank you!
  2. Hi, is there a way I can do something like? $p->find->('sort=-children:eq(0).created,limit='.$limit); In other words, sort by the first childs value of a field. thanks, J
  3. Interesting! times is a repeater with "startdate" (date) "enddate" (date) and "occasion" (string). My function above loops through them to get the earliest start date and latest enddate, and store them in the parent page event, The clients adds a bunch of times (repeater), saves the "event", and then the times are gone. They would have to enter the times again. Now after testing a bunch of times, it does seem to relate to required field: If i skip the required startdate, create 3 times, and press save one of the times was missing. But this only happened twice, then not at all when trying to 10 times more ! Strange, but not the end of the world. But it does seem that the required error message does affect saving a bit.....
  4. tx I'll try that and see if it helps!
  5. Hi there, I have "events" with lots of children "times", to make some queries possible, I copy the earliest / latest time-child into the parent event with this code: This works MOST of the time (99.9%), but the client has been complaining for a long time that this sometimes fails. I've been quite a lot with trying to reproduce the error with no luck. It's maybe because I don't know exactly how hooks work. So, my question is, is this a safe way to do this? Or is it a bad idea to modify a page while saving, like this? $time->startdate is mandatory, but the enddate isn't. Thats why I copy startdate to enddate, if enddate is empty. thanks! $pages->addHook('saveReady', function($event) { $p = $event->arguments(0); if($p->template->name == 'event') { $p->of(false); $enddate = 0; $startdate = 2147483646; foreach($p->times as $time) { if(!$time->enddate) { $time->enddate = $time->startdate; } if($time->enddate > $enddate) $enddate = $time->enddate; if($time->startdate < $startdate) $startdate = $time->startdate; } $p->enddate = $enddate; $p->startdate = $startdate; } });
  6. So I ran into this peculiarity: If I put this piece of code at the end of my 'util.php' (included first on my head.php) — then things work: <? function totallyRandomFunctionName() { /* wire('pages');*/ } ?> Note how wire('pages') is commented out, but it still somehow does the job. Now, if I remove the commented line: <? function totallyRandomFunctionName() { } ?> Then I get this error earlier in util.php, suddenly the wire function isn't existing...: Uncaught Error: Call to undefined function wire() in /xx/util.php:86 Line 86 has: "wire('config')->urls->root" in it. I'm quite curious what goes on here!
  7. "Page::addable", that is what I was looking for - thank you.
  8. Hi there, I'm trying to limit a specific user can only add pages as a child (under) a page created by themselves. The discussion in this thread gets close, it's a working solution on how to only allow editing on pages you created yourself. I'm using this and it works well. But I'm not sure how to modify this for my purposes. I'm suspecting I need to do to something like $this->addHookBefore("Page::added", $this, 'added'); then in "added" check if parent is created by the current user. But I'm a bit lost on how exactly to do this. thank you! /J
  9. After spending another day on this: It's the theme. The old theme (that comes along in the upgrade) can't display the page list in the backend. But still, seemingly it only works if you do it via the site exporter, and not upgrade the usual way by replacing the wire/index/htaccess..
  10. Hello again, Thanks for you answer but my problem isn't related to the namespace. If i try to go from 2.5 to 2.8 I get the same problem: No pages (screenshot). It would be the same if i upgraded directly to v.3. I'm not sure how to start debugging this. Thank you!
  11. I fixed this issue in a different way: I saw the ajax request printed a warning "Cannot set max execution time limit due to system policy", so I commented out line 955 in core/ImageSizerEngine.php seems to work j
  12. right, thank you. Pretty simple
  13. Hi there, I've got an old site with tons of content written in markdown. Wysiwyg editing has matured a bit since 2010 and the client would like to change to ckedit. The question is what to do with all the old markdown, can it be converted somehow? Did anyone do this? Any tips? – thanks!
  14. thank you!, I realise things has improved with v.3. It seems I can also do: $result = $pages->get('/all')->children('tags!=[name=xx],limit=10');
  15. hi, i came across something that is possibly a bug, (or maybe something I'm not understanding): I have several /thing under /things, so like /things/things1. "Thing" contains a page field "tags". Tags is a list of checkboxes. $pages->get('/things')->children('!=xx,limit=10') My problem is that this query doesn't return the children with no (0) 'tags' checked (it's a page field, checkboxes, for tagging). I'd like to create a query that returns all the pages that doesn't have the tag "xx", regardless if no tags or some tags have been selected. thanks!