Jump to content

Can

Members
  • Posts

    350
  • Joined

  • Last visited

Everything posted by Can

  1. @adrianmak you mean the site/ready.php hook method mentioned in my second post? Then it really doesn't matter how you output your content, because site/ready.php will be invoked way before any page template. The second hook "addHookAfter(Page::render" runs after all you template files have been processed and the output is almost ready, at this point $event->return in this hook contains your whole markup and the hook puts all of it in one database row using wirecache. The first hook checks if there is a cached version of this page and outputs it using exit() which will just print the whole cached html markup and stops any further php, so you end up using only 1 database request for markup creation, if no cache file present it won't do anything, so everything will be output as normal (as if there were no caching at all) and then the second after hook will cache it... the second posts approach is much simpler to implement and cleaner than the first posts one ;-)
  2. Thanks for sharing @Robin S so, I would then save the checkbox to my modules config, and inject some similar js into page edit for enabled CKEditor fields instead of my current approach, symlinking the plugin into site/InputfieldCKEditor/plugins and then messing with field settings.. I like!
  3. oookay, (of cause) my fault^^ should've used tracydebugger or just place the propper code..it just works now in getModuleConfigInputfields() thing is, it's actually a setting of InputfieldCKEditor, my module is symlinking a CKEditor plugin and this needs to be enabled, and I liked the ability to do all this from the same page, so installing this module would become easier. makes sense?
  4. that's a great idea, had the thought about some hook but missed to ask.. unfortunately I can't get it working the checkboxes are not part of the module config fields, they're just sitting within a markup field in a markupAdminDataTable and as mentioned before, I can see their data being sent with the form in dev tools but am not able to catch it, always seems to late so configData won't work as it's not part of it and $input->post is always empty when I catch it :/ Uh and got the hook only running from construct function of module..init and ready wouldn't do anything
  5. I'm diving thru the module code (and I had dinner^^) and I like it, but sorry I still don't get how it'll help my need? only idea came to mind would be to store it in module config and e.g. in ready function I check them and if I need to change field settings or not.. I hoped I could do all this on config save.. EDIT: thing is I wanted to line all available fields nicely in a MarkupAdminDataTable and that seems to interfere with saving to module settings..
  6. Thanks kongondo, that's what I'm afraid of, maybe I can rearrange the markup, but right now those checkboxes are not really part of the module config, they're just sitting in theire they're automatically checked if the inputfield has the plugin already enabled, if not you could just mark all you want to enable and save the module then I need to know for which fields you want to enable the ckeditor plugin to do so ;-)
  7. Hey guys, I'm building a module from https://processwire.com/talk/topic/13471-better-ckeditor-image-insertion-at-least-for-me/ it's declared as "class HappyImage extends WireData implements Module, ConfigurableModule" everything works so far, but I don't know how to process input send with module config submits The module is showing all available CKEditor fields and if my plugin is enabled for it or not with a checkbox, this checkbox gets properly submitted (I inspected with chrome dev tools) but I don't know where to I receive those inputs? I put some test logic just to see what it spits out but no matter if I place in module's construct, init, ready or even in getModuleConfigInputfields, no input at all.. :/
  8. Would be nice if password field were actually made required by field settings, but thanks a lot for the hook adrian just wanted to unrequire pass field because not all user need a pass as some might only be staff entry to show on the front page and I just confirmed that an empty password wont allow login..I like! maybe it could be deactivatable in advanced mode
  9. Hola amigos, I had the need for some changes and now I'd like to make it completely more meaningful and useful.. So it now implements Countable, I would say the whole management of default classes is optimized and it'll optionally wrap all class names in class="class names" attribute markup which you can also customize so you could use it to define your data-processwirelove="forever and ever" or whatever you can imagine.. and as you can define only one of them you could even use it to output, actually don't have any example in mind right now, but doesn't has to limited to html attributes uh, maybe some basic shop outputting all available t-shirt colors like "Available colors: blue green yellow" For this I consider changing the name to something like SpacedString - as it actually is exactly this a space separated string, optionally with prefix/suffix SpaceSeparatedValues - like the first HtmlAttributeBuilder - That's the main use case so far (at least for me) AttributeBuilder - Maybe better then HtmlAttributeBuilder as it's not limited to HTML or better to keep the existing name for any reason your suggestions? would even be possible to include an option for another delimiter?! but actually I don't need that for now, so if no one requests this.. I would love to get your guys cents on this If nobody complains I would publish only a namespaced version for now as I'm only using pw 3, if really needed one could easily strip namespace and required flag This version I'm finally planning to publish to mod directory EDIT: another question, should it autoload and prepopulate wire("bodyClass") or ist it better to always init manually like $itemClasses = new HappyCssClasses(); (still autoloaded), as non autoload you would have to $modules->get("HappyCssClasses") to load it before init (which isn't too bad) but when installed I guess people are actually interested in using it right?! I might even be able to let the user decide in module settings...
  10. Have you tried to refresh module cache? I just had a problem where the whole admin menu wouldn't change language, after flushing the cache it works
  11. Hi @Rajiv I'm glad you like it I'm refactoring the code to have it more customizable and pluggable, so installation should be easier, too. Don't know when I can post the new version, though. Hopefully within the next days, as I need it anyway for a new project, too ;-)
  12. For future reference, only for front end though (as far as I'm aware of, because you output it slightly differently) there's field rendering template files https://processwire.com/blog/posts/more-repeaters-repeater-matrix-and-new-field-rendering/#processwire-3.0.5-introduces-field-rendering-with-template-files https://processwire.com/blog/posts/processwire-3.0.7-expands-field-rendering-page-path-history-and-more/#field-rendering-with-template-files they can be a nice alternative for textformatters at least front-end wise, and maybe easier for newcomers
  13. Finally pushed version 0.3.0 which includes your code snippets @kixe thanks for that and a button to remove the cookie for easier development.. Please tell me if all is clear, especially about the new selector, I added a little note on how to include tree parent using just the selector inputfield.. Let me know how you guys like it. Should I still keep both branches? master for legacy (without namespace) and devns for namespace?
  14. hmm not sure about the error right now but I'll look into it. I'm fine tuning the cke plugin at the moment and planning to make as much customizable as possible so class names will be changeable, too. Great that you could use the module as a starting point
  15. Nice thanks for this great module! Don't have a use right now but I remember that I wished something like that some time ago, will for sure come in handy sooner or later
  16. Oh, I'm sorry about the missing opening tags, added them to the gist The ready.php part was more thought to be added to an probably existing file rather then being a file, that's why I wrote "it's placed in my ready.php" and it's more like a boilerplate and not a proper module, so the post was mostly to see if people like it ;-) I'm currently using it with PW 3.0.39 and everything works fine what errors are you getting? maybe we can figure out the cause.. Hopefully I'll find some time to stuff all of it in a module or similar and make a proper repository and readme soon.. The cke additions are already in a custom cke plugin because the above code wouldn't work with TextareaLanguage, the plugin takes care of applying the contextmenu extensions to all cke instances of every language and handles insertion properly.. and actually I need to ensure it's working with single language cke, because right now the js selector are based on the language ids/classes okay I've just initiated a local repo, but I need to test things further and play around with a single language pw install to have it support both because selectors seem to differ and I still need to figure how to make it as easy to install as possible which dictates the structure and readme of the repo ;-)
  17. glad you like it @szabesz Right now I'm not using it productively but I'm planning to use it for a small site, too as it simplifies a lot because you can still fully use processwire/php dynamically
  18. For any one else needing infos on this, just check out /wire/modules/Fieldtype/FieldtypeComments/Comment.php you can even define things like stars, ratings and a parent comment
  19. a simple way of caching (nearly) everything using wirecache and 2 page render hooks in site/ready.php // the next ensures that the following code will only run on front end (otherwise back end would get cached, too which results in problems) // make sure to place anything you need in the backend before this line or change it to your needs.. if ((strpos($page->url, wire('config')->urls->admin) !== false) || ($page->id && $page->is('parent|has_parent=2'))) return; $cacheName = "prefix__$page->id-$page->template-{$user->language->name}"; if ($urlSegment1) $cacheName .= "-$urlSegment1"; if ($urlSegment2) $cacheName .= "-$urlSegment2"; if ($urlSegment3) $cacheName .= "-$urlSegment3"; if ($input->pageNum > 1) $cacheName .= "-page$input->pageNum"; // if already cached exit here printing cached content (only 1 db query) $wire->addHookBefore('Page::render', function() use($cache, $cacheName) { $cached = $cache->get($cacheName); if ($cached) { exit($cached); } }); // not cached so far, continue as usual but save generated content to cache $wire->addHookAfter('Page::render', function($event) use($cache, $cacheName) { $cached = $cache->get($cacheName); if (!$cached) { $cache->save($cacheName, $event->return); } unset($cached); }); of course not the same as a proper flat file cache like procache but at least saving many database queries make sure to adjust the $cacheName as needed, you can even cache query strings, almost everything you'd like and you could wrap everything in a condition to only run if no incoming post or query strings so form submits keep working example if (!count($input->get) && !count($input->post) && !$config->ajax) { // cache logic from above } have fun
  20. you still have to tell processwire what content to show, either by redirecting or rendering for redirection check out my post at the top of this page https://processwire.com/talk/topic/1799-routes-and-rewriting-urls/?do=findComment&comment=60856 for rendering you go a similar way by checking if there's a urlSegment present, if so render the requested page by urlSegment (shortlink) instead of the home page or blog page..depending on how you structure your shortlinks so if you shortlinks will look like domain.com/shorty then you're rendering instead of home page, if you url looks like domain.com/blog/shorty then rendering will replace blog template.. and where / how to place the code depends on how you set up your template files, are you using the delayed output using _init.php -> template file -> _main.php or are you including the head and foot in each template file? (could even be a totally different set up..)
  21. Can

    Deployer recipe

    interesting thanks for sharing I commented the deploy:shared task out the first time so everything got created, than copied the shared stuff and re-deployed with the deploy:shared task enabled ;-)
  22. Can

    Deployer recipe

    you're welcome buddy
  23. Can

    Deployer recipe

    Had them already on this server so just cp -r someDir/assets deployer/shared/site/assets
  24. Can

    Deployer recipe

    @arjen exactly, otherwise the deploy:shared task would throw errors
  25. Can

    Deployer recipe

    @arjen in this recipe situation you store the actual config.php and the assets folder there I'm doing it like this because I have all this excluded from the git repo, so they won't be deployed, that's because some people don't like to store credentials in git (sounded legit so I'm doing the same) and my assets folder is quiet huge already and I had it already on the server so I just copied it over to the shared folder of deployer then the recipe will symlink them to your current release when deploying if you don't like it you can just omit this recipe, include only common.php from deployer in your deploy.php and depending on your needs just define servers and the deploy task/chain and maybe add some custom tasks.. Let me know if you need help
×
×
  • Create New...