Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. What do you mean? It doesn't work for you? I'm using latest PW with new admin theme (although shouldn't matter at all). I don't think this should go as far, and not something that is easily possible.
  2. Just created a new module 'AutoSave' page for the great ProcessWire CMS http://t.co/L3Zp3wz2IX #processwire

  3. AutoSave This module saves the page via ajax when editing in the admin. The interval for saving the page is configurable in the AutoSave module settings. By default it will only be enabled for unpublished pages. So far it seems to work fine for all fields and supports multilanguage. There's a message dialog show on top of page when saving happened with either a success or error. Requirements ProcessWire 2.3+. Haven't really tested with 2.3. Known Issues Nothing really obvious so far. Note that when you have multiple editors editing pages, it would be possible 2 persons editing the same page would overwrite each other, since the page is autosaved! The only solution for this would be to have my PageEditSoftLock module enabled with the complete "Lock" option active, so the page would be locked for editing. Todo Add some checks, if connection is lost. To be defined This module is currently a proof of concept. This module may not be suitable for all instances, but for personal use it may help preventing loss of long edits, most likely blog posts. Not sure this should be used for regular sites with clients editing. Most likely there's some more issues that interferer with what a CMS "page save" has to deal with. So you might find some ugly stuff happening. Thanks to Apeisa and his great Fredi font-end module, from where some logic is borrowed to save the page via ajax. Download https://github.com/somatonic/AutoSave So, that would be my last stroke for this year! Have a great silvester party and a happy new 2014!
  4. $parent = $page->parent; $current = $page->id; $overviewchildren = $parent->children("id!=$current, limit=4"); Or maybe $overviewchildren = $page>siblings("id!=$page, limit=4"); Edit: oh and welcome!
  5. I'm not sure what login you mean but for custom login using $session->login(user,password) you'd have to code it like this: //.. try{ $u = $session->login($username, $pass); if($u && $u->id){ $session->redirect("/somepage/"); } } catch(Exception $e) { echo $e->getMessage(); }
  6. Hanna code just for internal links may a bit cumbersome, but one way to do it. PageLinkAbstractor is an attempt to abstract links to id's, but I'm not sure anymore what it does. I have my own LinkAbstractor for my sites that are mostly multilanguage, and I convert internal links to "pageid:1233" on save and convert them back to a url. Current version of PW and TinyMCE, CKeditor have this feature in now and use language aware links. Thanks to Pete, Ryan and me. ---- Drawback of all this methods is that you can't link from one language to another easily. I guess this is the price to pay when using one page for multiple languages, and this not being the only one. Many features that usually are easy and straight forward become a permanent hassle, cause every feature will need to be considered working for multilanguage too.
  7. You obviously don't know my AdminHotKeys module.
  8. I'm already on a proof of concept thingy as there's already a saveAjax feature in ProcessPageEdit. Though I also think what's so hard to write an article in a text-editor, or just hit "save" once in a while when you write an article that takes time.
  9. There's various threads about what you ask already. Some ways to do it you'll find in my gist examples https://gist.github.com/somatonic/5420536#file-paginator_manual-php As for debugging rendertime you can use Debug class: $rendertime = Debug::timer(); // do your stuff $rendertime = Debug::timer($rendertime); echo "rendertime: $rendertime";
  10. the code is just from the example of the owl json custom data. data["items"] is from the json data. It could also be just data.items. Of course you could use just any methods that works for iterating a object/array. { "items" : [ { "img": "assets/owl1.jpg", "alt" : "Owl Image 1" }, { "img": "assets/owl2.jpg", "alt" : "Owl Image 2" }, { "img": "assets/owl3.jpg", "alt" : "Owl Image 1" }, { "img": "assets/owl4.jpg", "alt" : "Owl Image 2" }, { "img": "assets/owl5.jpg", "alt" : "Owl Image 1" }, { "img": "assets/owl6.jpg", "alt" : "Owl Image 2" } ] }
  11. Not "probably", it will work the way I showed you. I don't think you want to modify the carousel core code, because it works already the way you want. I know how it handles the jsonSuccess and I showed you how to properly use it to call your plugin. If at all I would not make a jquery plugin, but just call a function. This is not the owl support forum nor stack overflow. Sorry can't help you further. Edit: jsonSuccess: $(document).matchCarousel() // call to my plugin matchCarousel.plugin.js This won't ever work but also is not really a problem, as I showed you how to handle it correctly. Looks like you don't understand it anyway. The problem is not the owl core code.
  12. Pretty messy... I would try something like this: (function ($) { $.fn.matchCarousel = function(data, options) { var settings = { 'maxMatches': 10 }; if (options) { $.extend(settings, options); } function customDataSuccess(data) { var counter = 0; for(var i in data["items"]){ var img = data["items"][i].img; var alt = data["items"][i].alt; content += "<img src=\"" +img+ "\" alt=\"" +alt+ "\">" } $("#owl-demo").html(content); }; customDataSuccess(data); } })(jQuery); $(document).ready(function() { $("#owl-demo").owlCarousel({ jsonPath: 'data.json', jsonSuccess: customDataSuccess }); function customDataSuccess(data){ $(document).matchCarousel(data,{ maxMatches: 10}); } }); The callback function jsonSuccess doesn't allow for directly calling your plugin with arguments, but within the callback function you could easily pass "data" and other arguments... Or little simpler and direct $(document).ready(function() { $("#owl-demo").owlCarousel({ jsonPath: '/site/templates/scripts/data.json', jsonSuccess: function(data){ $(document).matchCarousel(data,{ maxMatches: 10}); } }); });
  13. Another thing I noticed is that you use wire(pages) ... wire(session). Which may work, but will throw a notice that it expects wire("pages") or wire("session"). If you would enable debug mode you'd end up with notices all over your site.
  14. Just wanted to mention that redirecting to the 404 page is wrong. wire(session)->redirect("/http404", false); Even if this would be correct... on a side note: the redirect to "/http404" without trailing slash would redirect to "/http404/" (with default settings), and further more if the 404 page uses the basic-page template and the requested page too, you'd end up in endless redirect. Back to why using this is wrong: It won't give you a real 404 page with correct header! It will just redirect to a regular page with content. Means this page will get indexed instead for all pages you're doing this. The way to do it is: throw new Wire404Exception(); This will render the 404 page content with correct header and keep you at the url you requested.
  15. You lost me somewhere in between. Keep it simple maybe with code example.
  16. I don't think you can use the user pages to use access control for front end. User pages are special pages and I think not meant to be used as viewable pages on the front end anyway. Since you're speaking of front end users, you just get the users the members "can view" according to some "virtual" rules and use API to list their profiles using a dedicated page/template. I.e. /users/profile/xyz and use urlSegments to control the listing. On front end you're free to check for access and do what is needed to show or hide stuff. You member role would also be just a guest role with only view access since they won't need or have admin access. So it's up to you to control that in your templates. Just a dummy example. if($user->hasRole("member")) { $members = $users->find("roles=member"); .... } else { echo "Sorry, you're not allowed to view."; }
  17. RT @tinaciousdesign: Tinacious Design website redesigned for the new year - http://t.co/rjK5nrHDyg http://t.co/GhMpvgLEKH

  18. RT @rilpartner: 8yrs ago before it went big, @rilpartner saw the power of #drupal & invested heavily in it. Today we say, expect @processwi

  19. That means $pa = $pages->find("template=basic-page"); foreach($pa as $p){ $p->price_total = $p->amount * $p->price; } foreach($pa->find("sort=price_total") as $p){ echo "<p>$p->title $p->price_total</p>"; }
  20. And what is wrong with your code, why must there be a better way? I just think you may not do it in template but after saving the page, it's also not kind of validation but a cleaning. So you wouldn't end with selectors being "false" saved to DB. ProcessWire hasn't some other way to do what you want/doing here, possibly also because of performance - it doesn't attempt to check for each selector if it's really valid/field exists. Technically there's also a way to add a runtime value to a pages that is used in selector on page arrays.
  21. I'm not sure I understand. Does this mean you can enter a wrong selector and it still works?
  22. Another option would be to browse this the page and copy the link, Or use the admin search and copy the link from the results.
×
×
  • Create New...