Jump to content

Tom.

Members
  • Posts

    461
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by Tom.

  1. You could possibly use a PageField and using "Custom selector to find selectable pages" with the custom selector parent=page. I asked this recently and that's the best way to do it. For the actual dates - Is the date used as the title? if so that should be fine. If not use "Label field" and use your date field. This should give you a drop down with all the dates and selecting them will create that relationship with the cruise page.
  2. Perfect, thank you very much
  3. Sorry, you're right. It's a Single, however I've tried: return $pages->find("template=subcategory, id={$page->category->id}"); Still nothing though strangely. EDIT: Haha, never mind I'm being silly. I had a complete brain freeze there. Battling with a cold. Thank you for your help Adrian. I needed: return $pages->get($page->category)->children(); One question though, is it possible to reload the field via AJAX when the category changes?
  4. Thanks, I completely forgot to put in the return, now to get it to return rules based on the other PageField. I tried: return $pages->find("template=subcategory, id=$page->category"); Didn't quite work. I thought I worked it out.
  5. Hello, Just trying to figure this one out. I have a PageField which pulls Categories. Each Category will have Sub-Categories as it's children. So I have two PageFields on the page, Category and Sub Category. I want the Sub-Category PageField to pull back results based on the Category. I thought maybe like Visibility and Required If, I'll be able to use values from fields on that page. So under "Custom selector to find selectable pages" I tried "parent=category" <- Category being the PageField. Does anyone know how to do this, or if this is even possible? EDIT: Figured it out, I used the PHP code instead
  6. Just an update for anyone who may hit this issue in future. Wrapping your $session in an the following if statement works. $(!$config->ajax) { } It's because the front-end editing when activated reloads the page using ajax. More on it here: https://github.com/ryancramerdesign/ProcessWire/issues/1602#issuecomment-172309783 - Thanks Ryan for clearing it up.
  7. I never really use render much as I prefer complete control over my markup. However, have you tried foreach($page->draft article as $draft) { echo $draft->render(); }
  8. I didn't manage to figure out the reason behind the duplication. However as always ProcessWire saves the day. I thought the sort function only worked with fields set in the database. However I thought I'd just try it: $results->sort("distance"); works perfectly. Ryan you're a God.
  9. Sorry, this is a little bit of an easy question. But I was just wondering why this wasn't working: So I have a map field that will have a longitude and latitude. I'm using this to calculate the distance between each entry and storing this in the PageArray. function distance($point1, $point2) { $radius = 3958; $degPerRad = 57.29578; $distance = ($radius * pi() * sqrt( ($point1->lat - $point2->lat) * ($point1->lat - $point2->lat) + cos($point1->lat / $degPerRad) * cos($point2->lat / $degPerRad) * ($point1->lng - $point2->lng) * ($point1->lng - $point2->lng) ) / 180); return round($distance); } function get_distance($start, $results, $radius = 30) { foreach($results as $result) { $result->distance = distance($start->map, $result->map); if($result->distance > $radius) { $results->remove($result); } } usort($results, function($a, $b){ if($a->distance == $b->distance) { return 0; } return $a->distance > $b->distance ? 1 : -1; }); return $results; } For some reason the usort will not work. However I managed to figure it out by using: $filter = $results->getArray(); usort($filter, function($a, $b){ if($a->distance == $b->distance) { return 0; } return $a->distance > $b->distance ? 1 : -1; }); $results->setArray($filter); Though it will duplicate the last returned item. Here is how I'm accessing the function: $activities = $pages->find("template=activity, id!=$page"); $nearby = get_distance($page, $activities, 40);
  10. I've also realised that this should be in Wishlist, not FAQs. Still learning
  11. I completely missed that, thanks Lost. Apologies for the duplicate request.
  12. I know there is modules out there for this. However I would love to see it in the core and more integrated. I really believe in the a clean user interface for clients. At the moment in this current project, the interface is really clean and it's easy to know where all the content needs to be and how to add it using the PageTree. However, I'm adding a few new things such as a login page, that will not be ever used by a particular role. It's purely there to create the URL "/login/" and have that link up the login.php. For example how the 404Page works currently. It would be nice to be able to hide this from them so they don't get confused with it being there. I know this is a small trivial thing, but I imagine a few people would like this, for example if they had a settings page. They may not want that shown in the page tree for moderators and only for administrators. I've seen modules that hide pages that are uneditable, however all my top-level pages are uneditable. I've seen it done by user, however this will need to be by group. All I can imagine it being under Settings -> Who can access this page? as Settings -> Who can view this page in tree? and have tickbox groups, append to children that don't have their own permissions. All that good stuff What do you guys think? Am I being silly and this is already available? I feel like the permissions system is so good, it might be.
  13. Just an update, this is still happening on 3.0.4. It will work fine for a little while, I thought it was fixed in 3.0.4 but then it would just suddenly revert back to not working again. That seems strange to me. No code changes were made between it working and not working. As previous, uninstalling and reinstalling the Front-End Edit module get's it working fine again for about 15-30 minutes. (Both the Front-End editing and the session works fine). Anyone have ideas?
  14. $page is always relative to the current page. So if you are asking for the siblings of the current page, it would do just that. Instead you need to use get, to make sure that parent is always the same. To do this you use $pages->get()->siblings inside the () add your selector.
  15. Inside that foreach, add another using $news->children as $news. I would give a better code example, but I'm on my mobile. Sorry, I can't find the edit button on the mobile site. But I just noticed you aren't echoing out your title you need to use <?=$news->title?>
  16. This thread is great, you are far more technical than me. I'm just a front end developer. So to see someone having such a good time with the advanced part of ProcessWire is really encouraging. I too came from WordPress. It was my main platform for developing everything, and had been for many years. As you can imagine, finding ProcessWire was a breath of fresh air. I must admit, I look at your code and I have no idea what's going off as I'm not that advanced. But you seem to find everything that is usually really difficult, easy in ProcessWire. I too have this. Only last year was I pulling my eyes out with pagination on WordPress. ProcessWire it's easy. As for official discussion for PW3, there really isn't one to my knowledge. However, I think something like Gitter would work as we can have trivial discussions without spamming the forum. I was thinking the same for the Brand refresh for PW.
  17. I imagine it's a more powerful repeater. But we will have to wait and see.
  18. https://github.com/ryancramerdesign/ProcessWire/tree/devns
  19. Tell me about it! 3.0 is going to be awesome! Every time I think ProcessWire is perfect, Ryan keeps proving me wrong by improving it Keep proving me wrong Ryan!
  20. That's looking great, I would possibly consider having the edit button on the grid view and open in modal. So if you find the image you want to edit the description on in grid, you don't have to go into the edit mode and go looking for it again. This is some really good stuff! I could really do with this in a recent project where there is a custom png icon set to use on the website and I wanted them to be able look through the list and select the one they want to use Keep up the great work.
  21. How strange, some hosts block the usage of php.ini. But as you said they added a php.ini file. It would seem weird for them to add it if they didn't support it. From the top of my head I can't see for whatever reason ProcessWire would conflict with php.ini. So I might be tempted to say, even though your host added it, they don't actually support it. I would instead add this to the bottom of your .HTACCESS file: php_value upload_max_filesize 32M php_value post_max_size 32M php_value max_execution_time 300 php_value max_input_time 300 It can also be completely possible that your host has blocked that too. So the final way of doing is via PHP itself. (However I'll have to do some research into where to add that in ProcessWire). Possibly add this at the bottom of /site/config.php/, but I'm just guessing there. ini_set('post_max_size', '64M'); ini_set('upload_max_filesize', '64M'); I really would recommend against adding it via PHP.
  22. Try it without defining a max_execution_time and just the post_max_size also upload_max_filesize. Also if you have them there, they don't need ";" on the end.
  23. Try: echo $slider->eq(0)->images->frist()->url;
  24. Sorry, I'm on my phone so bare with me. $results = $pages->get("/")->children("template=events|articles"); foreach($results as $result) { echo $result->title; foreach($results->children as $child) { echo $child->title; foreach($child->children as $child) { echo $child->title; } } }
  25. Hello, This has been fixed on GitHub, re-download the version you are using and replace the wire folder (Remember to backup)
×
×
  • Create New...