Jump to content

tpr

Members
  • Posts

    2,321
  • Joined

  • Last visited

  • Days Won

    44

Everything posted by tpr

  1. I'm also facing this (I'm new to Twig in ProcessWire). Of course setting each variable first in the "controller" file, like $view->template, $view->template->name (eg. in "services.php" for services.twig) fixes this, but this overly complicates things (and surely there's a better solution). It's the second time I'm trying my head around Twig but I still can't see the benefits over Latte
  2. Have you tried adding any kind of "sort" to your query? ($g)
  3. GitHub page is up, see first post.
  4. This error is rather caused by the server and not your code (at least that's what I found on Google). Does the error go away if you remove that line? Btw you could echo the translation in a simpler way: echo __("Live long and prosper!", "/site/templates/_header.php");
  5. I have no clue then... is caching enabled, or are pages published and visible on the site?
  6. Agreed. I did some tests and while it could work the safest thing is adding the markup manually. In the meantime I added some cool things to make you FEEL better FEEL.popupSettings: settings to pass to Magnific Popup FEEL.wirePath instead of lightboxJSpath & lightboxCSSpath FEEL.stickSaveButton: set Save button position fixed to the top-right corner Multiple edit links Edit link positioning helper classes Simplified markup Preview of inline and fixed modes: This version is not released yet, I will create GitHub page with proper documentation.
  7. This code works perfectly here. Are the pages properly set up hierarchically? (I guess yes) Where do you have this in code? Does $page refer to the current page?
  8. And one more: function n($singular, $plural, $count) { echo t(_n($singular, $plural, $count)); } This handles translations of singular/plural nouns, using the earlier introduced "t" helper. Of course strings have to be listed in "_strings.php" to be translatable in the admin. (I had to use "echo" instead of "return", probably because the template engine I'm using) Usage: n('minute', 'minutes', $page->count_of_something) Using "/*!" instead of "/**" will prevent addition of stars when hitting new lines in IDEs: /*! Intentionally commented out GENERAL _x('minute', 'General'); _x('minutes', 'General'); SEARCH _x('Search site', 'Search'); _x('No matches', 'Search'); *******************************************/
  9. I guess if someone knows how to move the "wire" dir (or setting up an environment not in the root) then setting paths in the JS won't be a challenge
  10. Create two selectors and apply them as needed, like this (untested): if(...) { $selector = 'limit=3, sort=random'; } else { $selector = 'date_field < today'; } foreach($page->testimonials->find($selector) as $testi) { ... }
  11. Perhaps your PW installation is on steroids.
  12. I wanted to know whether I could add the Edit link wit JS only, so no markup would needed. That would make FEEL really easy to add, only including the script. Perhaps there's an Ajax call to figure this out, or the cookie "wire_challenge"?
  13. Not sure I get it right, but once you click on the "Save" button in the lightboxed admin, after closing the lightbox the underlying page will be reloaded. (actually hitting "Enter" is enough instead of "Save"). If you don't click on the "Save" button then you can close the lightbox and the page won't reload.
  14. I will add jQuery requirement to the description, thanks! Is there a reliable way to check with JavaScript if the current user can edit the current page? If there would be, then the link markup could be also handled by JS.
  15. No, I did not know fredi until the past 10 minutes Of course I've heard about it but never tried. Mine (petname FEEL) is a very simple addition - only a JavaScript file (or snippet) and a link markup is needed. I was using a similar solutions in my previous projects and finally decided to make it public, that's all. The other answer is "because I had to check if it's possible" It is simple so it doesn't have many settings unlike modules like Fredi has (or will have). If it fits your (or your client's) needs, then use it, otherwise look for more advanced frontend editors.
  16. i removed the previous zip from the post. I think posts themself could remain in place. Thanks!
  17. Just added the latest release with some fixes and optimizations, see the first post.
  18. Ok, polished this a bit and got rid of the Chrome error - unfortunately only by using setTimeout so it's not perfect. There are some settings to tweak. Update: see latest release and info in first post.
  19. So clicking on Save would close the lightbox immediately if there are no errors? Actually I managed to solve it though it's a bit slow - the lightbox still have to load but it's hidden, and closed automatially if there are no errors. The problem is that Chrome throws an alert "Network error, please try again" with no error anywhere. Works fine in FF/IE though. Yes, because the JS has to wait until the iframe is loaded, and then apply remove(). I was able to mask it but first I had to solve the Chrome issue above.
  20. Update: Latest release and documentation is available here: https://github.com/rolandtoth/FrontEndEditLightbox Modules directory: http://modules.processwire.com/modules/front-end-edit-lightbox/ ----------------------------------------------- Just implemented my front-end edit feature, minimal style I know there's many other solution to this but I tried making something much simpler to implement. The result is one JavaScript snippet - no css, external js dependency, module, etc. It uses the admin's Magnific Popup because it's always at hand and works just fine. The page automatically reloads on closing the lightbox, but only if the page was saved (via localStorage). You can also list jQuery selectors to hide items in the admin (see "selectorsToHide"). Usage Add the edit link to your template file (see code below) and copy the following to your main .js file.
  21. The second seems fine to me, but you can use a simpler syntax (from 2.5.27): $featuredIDs = $pages->get('template=home')->featured_items->id(); http://processwire.com/blog/posts/processwire-core-updates-2.5.27/ Then <?php if (in_array($project->id,$featuredIDs)) : ?> featured<?php endif; ?>
  22. I'm using almost the same setup, but my "t" function handles context too. The good thing is that _strings.php can be copied to your next projects too. function t($text, $context = 'General', $textdomain = '/site/templates/_strings.php') { return _x($text, $context, $textdomain); } _strings.php: // Search _x('Search site', 'Search'); _x('No matches', 'Search'); // Forms _x('From', 'Forms'); _x('From email', 'Forms'); _x('To', 'Forms'); ...
  23. I think it's just fine using strings.php if it helps you - actually I'm using this right now, the only difference is that I named it "_strings.php", to avoid showing up as a template file. Another simple solution can be found here, making a dedicated page for strings: https://processwire.com/talk/topic/10443-how-to-do-this-global-vars/
×
×
  • Create New...