Jump to content

bernhard

Members
  • Posts

    6,264
  • Joined

  • Last visited

  • Days Won

    314

Everything posted by bernhard

  1. Are you talking about something like this?
  2. I don't know of a built in way but I'm happy to learn ? Not sure if that's the best way to do it but it works: $i = 0; $prev = new PageArray(); $next = new PageArray(); $p = $n = $page; while($i++ < 5) { if($p and $p = $p->prev and $p->id) $prev->add($p); if($n and $n = $n->next and $n->id) $next->add($n); } db($prev, "prev"); db($next, "next");
  3. v2.15.1 ignores module migrate files if the corresponding module is not installed ? And it will trigger the migratefile right after the module has been installed! Thx for your input and feedback guys! Keep up bringing good suggestions ?
  4. Sorry of course it's not ?field... on page edit, because you have ?id=... there, so you need to append that url parameter via &field[s]=...
  5. Appending ?field=yourfieldname to the URL should be enough. ?fields=foo,bar would also work.
  6. @wbmnfktr is anything wrong with outline? It sounds so simple and obvious to me but obviously you are far more experienced with css than me, so I'd be interested in the reasons for your recommendation as it looks a little complicated to me ?
  7. Of course, it's ProcessWire ?? Just kidding - happy if it was helpful! ?
  8. I think what you are looking for is "outline: 1px solid black;" instead of "border" ?
  9. Hey @Kiwi Chris I've created a WIKI page about the watch feature: https://github.com/baumrock/RockMigrations/wiki/The-WATCH-feature Is that understandable? Also while writing I've been wondering... Maybe it's really better to just run the MyModule.migrate.php if the module is installed. I think that's what everybody would expect. Also I don't see any downsides as it should trigger the migrations immediately after installation. What do you think? I don't see any situation where one would want to have the MyModule.migrate.php run migrations on a non-installed module. If you want to install the module via RockMigrations then you'd have a Site.module.php anyhow (at least that's what I'm always recommending) or you simply put $rm->installModule() in /site/migrate.php
  10. Yeah @Kiwi Chris I think that's the best solution, because then everybody can decide wether he/she wants migrations to run or not. I could disable watching of Module.migrate.php files if the module is not installed, but then you'd have to manually trigger that migrations if you wanted them to be executed and that's harder to do than adding an early exit to the file. I'll add a page to the wiki that describes that behaviour, thx!
  11. $session->foo = 'Foo!'; $wire->addHookBefore("Page::render", function ($event) { bd('hook fired'); bd($this->wire->session->foo); bd($this->wire()->session->foo); bd($event->wire->session->foo); bd($event->wire()->session->foo); bd($event->session->foo); bd($event->session->get('foo')); bd(wire()->session->foo); }); Choose whatever you like bist ? I prefer $this->wire->session->foo
  12. Hi @Kiwi Chris thx for the report! Yes and no. I've just tried and I think it works as expected. I added TestModule.module.php and TestModule.migrate.php to my site. RockMigrations recognized the new migrate file and - as expected - ran it. As the migrate file was empty, nothing happened and so also the TestModule kept uninstalled. So I guess you have something in your migrate file that installs the module, do you?
  13. Thx for sharing. Screenshots would be nice for all that can not transform code into pictures on the fly in their brain (me included) ?
  14. Yep. I've added support for custom tags via hook: Custom tags You can add custom replacements easily via hook in /site/ready.php $wire->addHookAfter("TextformatterRockDown::replace", function ($event) { $str = $event->arguments(0); $start = $event->arguments(1); $end = $event->arguments(2); $str = preg_replace("/$start@(.*?)@$end/", "$1<span style=\"color:red;\">$2</span>$3", $str); $event->return = $str; });
  15. Ok finally we understand each other I guess ? I didn't want a markdown textformatter - I wanted a WhatsApp style formatter. I knew that we have markdown support in PW (https://processwire.com/api/ref/sanitizer/entities-markdown/) even though I forgot about the markdown textformatter. But fullblown markdown support is not what I want for headlines ? From your question I thought that the "markdown" extra was some kind of special markdown formatter that did the same as my module... Yeah it depends on the project I guess. I think I'll also not use the title field and use a headline field instead. So I can use the title field in menus and the headline field for page titles. Still strip_tags or https://processwire.com/api/ref/sanitizer/textarea/ will be handy.
  16. @Stefanowitsch yeah that's what I often did as well. I just stripped down all the options of CKE to only show the bold button. But that's a lot of work for a very simple and common need. That's why I finally built the formatter ? Yes, it's a simple preg_replace that finds *bold* and replaces it with <strong>bold</strong> $start = "(^| )"; // allowed start $end = "($|\W)"; // allowed ending whitespace $str = preg_replace("/$start\*(.*?)\*$end/", "$1<strong>$2</strong>$3", $str); $str = preg_replace("/$start\_(.*?)_$end/", "$1<em>$2</em>$3", $str); $str = preg_replace("/$start~(.*?)~$end/", "$1<s>$2</s>$3", $str); $str = preg_replace("/$start```(.*?)```$end/", "$1<tt>$2</tt>$3", $str); $str = preg_replace("/$start#(.*?)#$end/", "$1<tt>$2</tt>$3", $str); You can do that with CSS, or am I missing something?
  17. I don't and I didn't find any docs. Could you please let me know? Does that mean you can insert links with the core module? I don't want that in headlines ? Yeah I've used another field today so I don't have this problem but I thought a simple strip_tags should be enough, no?
  18. Thx - that's why I found no link and no docs ? The main difference that I see: I can point my clients to the readme of my module and it is instantly clear what it does: https://github.com/baumrock/TextformatterRockWhatsApp Markdown/Parsedown: I don't know exactly what it does and I did not find it with a quick research. Seems to be the same for you (as you where asking)? But I guess they are very similar. Also my module is super simple and does not need any other libraries. Easy to understand. Easy to maintain. It looks as if the core module supports lists and headlines. I don't want that in my markup as it's intended to be used for quick and easy headline styling and not for richtext. Maybe that's the main difference ? Thx for the question, didn't know about that core module!
  19. If you have a link for me I can answer your question ?
  20. TextformatterRockDown ProcessWire Textformatter for simple mardown-like text formatting ideal for headlines: *bold* _italic_ ~strike~ ```monospace``` #monospace# This module does intentionally not support full markdown syntax! It is intended to be used for simple formattings that you usually want to apply to headlines. Problem The title field is always available in ProcessWire and it is often used for page headlines. But unfortunately when using such a plain textfield it will not be possible to print some words in bold or italic font. One solution is to create a CKEditor/TinyMCE field, but it's a lot more tedious to setup. Also it's not easy to make it single-line-only. Solution Just apply this textformatter to your field and you'll get quick and easy headlines with bold and italic fonts that will also work with frontend editing. Backend Editing: Frontend Editing: Formatted: Custom tags You can add custom replacements easily via hook in /site/ready.php $wire->addHookAfter("TextformatterRockDown::replace", function ($event) { $str = $event->arguments(0); $start = $event->arguments(1); $end = $event->arguments(2); $str = preg_replace("/$start@(.*?)@$end/", "$1<span style=\"color:red;\">$2</span>$3", $str); $event->return = $str; }); Download https://github.com/baumrock/TextformatterRockDown https://processwire.com/modules/textformatter-rock-down/
  21. Hey @ryan thx for the additions! And thx @Jan Romero for the PR! I think a download button is a must have on image fields, so for my taste it should be default, but until then I've added a tweak to RockMigrations (v2.15.0) so the download buttons are just a checkbox away ?
  22. It works for me as expected. Do you have $config->prependTemplateFile = '_init.php'; in your config.php? Do you have a recent version?
  23. // home.php $session->event_number = 123; // other if($session->event_number) ... else $session->redirect('/');
×
×
  • Create New...