Jump to content

Robin S

Members
  • Posts

    4,928
  • Joined

  • Days Won

    321

Everything posted by Robin S

  1. Another week, another set of useful updates. It would be good if there was a URL option to return the complete URL of the current page, including URL segments and page numbers. Earlier in the year I was looking for such a feature and had to do this: $full_url = $page->url; if($input->urlSegmentsStr) { $full_url .= $input->urlSegmentsStr . "/"; } if($input->pageNum > 1) { $full_url .= $config->pageNumUrlPrefix . $input->pageNum; } Regarding the /*NoCompile*/ comment, it seems it doesn't work if the include statement uses a relative path without any dot syntax (which may not be best practice but is still valid). So for an included file in the same directory... include "test_include.php" /*NoCompile*/; ...the included file is still compiled.
  2. Yes, that's right. Repeater Matrix can be useful when you want to structure your page as a series of blocks of different types that the editor can add and sort as needed.
  3. This sounds similar to this recently fixed issue: https://github.com/processwire/processwire-issues/issues/97 You could try updating PW from the dev branch to see if that resolves it.
  4. When you create forms using the core Inputfield modules then you are using the same methods as used for the PW admin interface. If you're seeing something different in the admin than in your frontend (e.g. width of textareas) then use your browser dev tools to check the CSS that is applied in the admin. There you'll see that textareas have a width: 100% rule, so that the final width of the element can be controlled by the <li> wrapper (which can have its width style set inline via columnWidth).
  5. Interesting, thanks. The purpose of the site is also a bit mysterious. The docs read like a "how to use" but there doesn't seem to be any download link. Do you think it's intended to be distributed (sold?) or just for demonstrating what is possible with PW?
  6. I'm really curious. Someone has put a lot of work into that. Domain gives no clues as WHOIS data is anonymised.
  7. Not sure that you need to do the first pipe replace - you could just explode on commas and then trim(). You'll add the pipe when you implode. Also, passing by reference in a foreach can catch you out so perhaps better to avoid it. // Explode search input into array $search = explode(",", $input->get->search); // Sanitize each value foreach($search as $key => $value) { $search[$key] = $sanitizer->selectorValue(trim($value)); } But otherwise it looks fine to me; that's what I would do.
  8. Hi @mmc, welcome to the forums. It strikes me as unusual to use CKEditor in a contact form - I don't think I've ever seen a contact form that invites the visitor to submit their message using an RTE. A plain textarea is more typical. But anyway... For width you can set the inputfield columnWidth property: $field->columnWidth = 25; // sets width to 25% Or you can just set the width of the element that contains CKEditor in your CSS. For height, InputfieldCKEditor extends the InputfieldTextarea class so you can use the rows property: $field->rows = 3;
  9. This is very cool. Both the module and the bundled actions will be super useful. Thanks!
  10. Just adding Ryan's answer from the Github issue for future reference:
  11. I expect this wouldn't suit because you want the separate $bookings variable for doing other things with, but just wanted to add that you can get to an array of room data in a single query: $roomsData = $pages->find("date=$today, parent.room=roomOne"); // you'd probably limit by template here too
  12. @elabx, the unformatted value of an images field is always a WireArray. Having the value be a Pageimage for a single image field is the result of output formatting. I think what Soma is saying above is that output formatting is off when you bootstrap the PW index.php. So the issue doesn't occur because of an AJAX call, it occurs because of the bootstrapping. So solutions would be either: Just be aware that output formatting is off when bootstrapping PW and adjust your code accordingly In your AJAX call, load a normal PW page rather than a PHP file that bootstraps index.php
  13. I believe that each time you call $pages->find() or $page->find() the PageFinder class is used to query the database. If you're wanting to analyse performance in detail then Profiler Pro in the new ProDevTools would probably be money well spent. Besides the tool itself there is this benefit:
  14. This is trivial, but the template edit link in the Page List hover actions is 1 pixel lower than the other actions. Same in Chrome and Firefox.
  15. When editing field settings (Setup > Fields > my_field) I'm seeing an error: PHP Notice: Trying to get property of non-object in ...\modules\AdminOnSteroids\AdminOnSteroids.module:1224 BTW, thanks for making this configurable:
  16. This line is different to what you show in the codeblock above it: namely, there is the extra ->id in there. The ID property of a page is an integer, so it doesn't have a mainImage that you can call size() on. If you remove the ->id it should work, but I recommend you check to make sure mainImage is actually populated (i.e. that an image has been uploaded to the field) before you do size().
  17. Have you seen this module? http://modules.processwire.com/modules/pages2-json/ I think a hook to Pages2JSON::getValue could be used to return the fields from the Repeater child pages.
  18. ProDev Tools: Sold! Sounds perfect to me.
  19. Ah, that's great news! When I was trying to resolve the problem I was focusing trying to adjust the position of the child <ul>s that flyout to the right - it didn't occur to me to try adjusting the parent <ul>. Good stuff!
  20. I don't think that will work. The submenu is positioned using the jQueryUI Position utility. Anything you do in CSS to change the dimensions and/or position of the submenu is accounted for by Position and it will just move the submenu further over as a result. The admin menus would be so much more manageable if they were just simple nested <ul>s. I don't understand why the admin theme takes the complicated approach it does.
  21. That's odd - I don't see how that can happen. An images field will return an array of images (a 'Pageimages' WireArray) if you have chosen that in the field settings. This approach is okay, but if it were my project I think I'd find that a bit awkward. Hard for editors to make a clear connection between which text field goes with which image. And 10 identical fields seems like something to avoid where possible (maintenance would be a pain for a start). Suggestions... If the text field only needs a normal text input then use the Description field for each image. If the text field needs to be a textarea then try the Image Extra module. If the text field needs to be a CKEditor field then consider creating a Repeater containing an image field limited to 1 image and the CKEditor field. Then you can fix the Repeater to 10 items using Limit Repeater (shameless self-promotion )
  22. It's Bootstrap-specific in that Bootstrap requires you to add (among many, many other things) an unnecessary data-toggle="dropdown" attribute to the <a> element. It's unnecessary as that element can already be targeted as a direct child of an <li> element with "has_children" class (or whatever other class you might want to use for dropdown menu purposes). That is what @ottogal referred to above: MarkupSimpleNavigation does not equal ProcessWire - it's a third-party module for ProcessWire. PW allows you to generate your markup any way you choose. Personally I find MSN to be a very useful module but it's not compulsory to use it. Some people create their own menu markup from scratch using just the API and basic PHP functions like foreach(). And there are other modules for generating menu markup such as Menu Builder (haven't used it myself). I'm not a good one to answer this as I don't like CSS frameworks - I find them a hindrance rather than a help. I prefer to create my stylesheets for each project from scratch using SCSS. That way there's no bloat and I can build exactly to my design mockups without needing to conform to any framework expectations. I understand UIKit is popular with others though.
  23. You will find debugging much easier using Tracy Debugger than with $this->message. Have you seen these modules and topics relating to Amazon storage? http://modules.processwire.com/modules/amazon-s3-cloudfront/ http://modules.processwire.com/modules/schedule-cloud-backups/
  24. Well, the markup you want to output is actually quite complicated. Needlessly complicated too IMHO, but that's Bootstrap's fault. @Soma, author of MarkupSimpleNavigation, said it pretty well: Couldn't agree more. Soma does have a Gist for generating Bootstrap markup with MSN, but it's for Bootstrap 2: https://gist.github.com/somatonic/6258081 Here is one way you could generate markup for your menu: $nav = $modules->get('MarkupSimpleNavigation'); $options = array( 'has_children_class' => 'has_children dropdown', 'levels' => true, 'max_levels' => 2, 'selector' => 'template!=MediaLibrary', 'outer_tpl' => '<nav class="collapse navbar-collapse navbar-right" role="navigation"><div class="main-menu"><ul class="nav navbar-nav">||</ul></div></nav>', 'inner_tpl' => '<div class="dropdown-menu"><ul>||</ul></div>', 'item_current_tpl' => '<a class="current" href="{url}">{title}</a>', ); $nav->addHookAfter('getItemString', function(HookEvent $event) use($options) { $item = $event->arguments('page'); if($item->hasChildren() && count($item->parents) < $options['max_levels']) { $class = $item == $this->page ? ' current' : ''; $event->return = "<a class='dropdown-toggle{$class}' data-toggle='dropdown' aria-expanded='false' aria-controls='navbar' href='{$item->url}'>{$item->title}</a>"; } }); echo $nav->render($options); Don't know about your JS issue, but that won't be PW-related.
×
×
  • Create New...