-
Posts
6,312 -
Joined
-
Last visited
-
Days Won
318
Everything posted by bernhard
-
RockFinder3 - Combine the power of ProcessWire selectors and SQL
bernhard replied to bernhard's topic in Modules/Plugins
addPath() needs the PagePath module to be installed! Does it work if you install it? Why do you need the path? How many pages do you have? -
RockFinder3 - Combine the power of ProcessWire selectors and SQL
bernhard replied to bernhard's topic in Modules/Plugins
Did you install the Page Paths module? -
RockFinder3 - Combine the power of ProcessWire selectors and SQL
bernhard replied to bernhard's topic in Modules/Plugins
What happens if you put that selector in a regular $pages->find() ? -
RockFinder3 - Combine the power of ProcessWire selectors and SQL
bernhard replied to bernhard's topic in Modules/Plugins
Does it work if you change that to modules()->get('RockFinder3Master'); ? -
It works, thank you very much!! ? What about this? I think it looks a bit cleaner then the original... You have a typo here anyhow: Cookies >,< & Modules Refresh
-
Hi @adrian that thx meant "It's late here in Austria and I'm on mobile in a train. Thx for your reply I'll look into that tomorrow" ? I've just tried that on a fresh and clean installation and the menu is only updating when I refresh modules + clear cookies/session I can't reliably say that. I've never ever needed to clear session+cookies other than making the manu catch up changes that I've made to process modules... I do think that a modules refresh should not be a problem though. I'm fine with the wording of the two options we already have. There's probably no need for explicitly stating that a "clear session&cookies" does already do a modules refresh behind the scenes. Thx for working on that request, will be much appreciated and save me from a lot of unnecessary clicks! ?
-
Hey @adrian any comment on my request from here? https://processwire.com/talk/topic/24932-feature-requests/?do=findComment&comment=213302 I'm developing a process module again and need far too many clicks all the time for simply refreshing the menu ?
-
IMHO migrations are the key feature needed for version controlling your site. A recorder and importer is added benefit for people that are too lazy to write any lines of code (which is actually copy and paste and much preferable - think of $rm->renameField('from', 'to') instead of delete old field and create new field when using a config like mentioned above). But I got that nobody wants to hear that ? Ever tried Lostkobrakai's migrations module? I'm out of this discussion...
-
You can create a textformatter that adds the <span> to all your links
-
Looping through finding ProcessWire Pages with an array
bernhard replied to Sarnoc's topic in General Support
I can't look into that in detail but maybe RockFinder can help you: https://github.com/baumrock/rockfinder3#example-group-by-date -
RockMigrations simply creates the fields and templates first and after that populates their settings. That makes it possible to use things like parent child relationships in one single migrate() call. I have thought about that a lot (meaning years) and still have not found a way how one could reliably record and then migrate stuff without writing code and without telling ProcessWire what to do exactly. Writing the setup to files is one thing (that's basically as easy as a foreach + export()), but migrating those setups is another. I know such recorders are tempting, but everybody that has ever used the excel macro recorder knows what I'm afraid of... If you have good ideas how to solve that please let me know.
-
The latter one. The very first two versions used the former option, but it turned out it is hard to maintain and even harder to grasp. Using config based migrations it's simply copy&pasting field config data from tracy to a migration file and you instantly see what the migration does (and you get a diff view via git). Correct Where does this array come from? This sounds a bit like you are starting to understand RockMigrations... ? It would be nice if you could provide more details on that point. What did you do? How did you do it? What did you try to do? etc
-
Thx for the feedback. I guess many who are having your painpoint are missing RockMigrations because of this reason... I've updated the first post of RockMigrations with an easy step-by-step guide:
-
I've built a similar module today because I didn't know about this one...
-
TextformatterRockHeadlineIDs Textformatter that applies id attributes to all headlines (h1-h6) in the markup field. // input <h1>This is my headline</h1> // output <h1 id='this-is-my-headline'>This is my headline</h1> Download & Docs: https://processwire.com/modules/textformatter-rock-headline-ids/ https://github.com/baumrock/TextformatterRockHeadlineIDs PS: There is a similar module I didn't know about before:
-
Ever tried RockMigrations?
-
MarkupSEO - The all-in-one SEO solution for ProcessWire.
bernhard replied to Nico Knoll's topic in Modules/Plugins
RockSeo is really not meant to be used already ? Just didn't make it private for easy preview sharing... -
-
yeeha!! ? <?php /** * Center Buttons * @return Buttons */ public function getButtonsCenter() { $buttons = parent::getButtonsCenter(); $buttons->add([ 'name' => 'markClaimed', 'icon' => 'check', 'tooltip' => 'Mark selected items as claimed', 'hidden' => '!selected', 'appendMarkup' => '<div id=markClaimedConfirm hidden>...</div>', 'callback' => [ 'name' => 'sendIDs', 'confirmmarkup' => '#markClaimedConfirm', 'loading' => 'Saving items...', 'reload' => true, 'execute' => function($input, self $grid) { $ids = $this->wire->sanitizer->intArray($input->ids); $note = $this->wire->sanitizer->text($input->note); foreach($this->wire->pages->findMany(["id" => $ids]) as $p) { $p->setAndSave(Effort::field_claimed, 1); $p->setAndSave(Effort::field_claimedwith, $note); $grid->sse("Saved page $p"); sleep(1); // just for the screencast } $grid->sseDone(); return ['success' => true]; }, ], ]); return $buttons; }
-
Ok I did some more testing and found out that using str_pad is the most reliable solution. At least in the environments I tested (laragon, DDEV, ubuntu+apache). So I can't say anything about ob_implicit_flush()
-
A user in another forum found a solution!!! <?php header("Cache-Control: no-cache"); header("Content-Type: text/event-stream"); $i = 0; while(true) { $i++; echo "data: value of i = $i\n\n"; echo str_pad('',8186)."\n"; flush(); if(connection_aborted()) break; sleep(1); } Reading the manual about flush() finally broucht me to the correct settings for my setup: <?php header("Cache-Control: no-cache"); header("Content-Type: text/event-stream"); @apache_setenv('no-gzip', 1); @ini_set('zlib.output_compression', 0); @ini_set('implicit_flush', 1); ob_implicit_flush(1); $i = 0; while(true) { $i++; echo "data: value of i = $i\n\n"; flush(); if(connection_aborted()) break; sleep(1); } I've tried several settings before regarding gzip, but nothing worked. For me the ob_implicit_flush(1) made the difference ? https://www.php.net/manual/de/function.flush.php
-
data: value of i = 1 array(1) { [0]=> array(7) { ["name"]=> string(22) "default output handler" ["type"]=> int(0) ["flags"]=> int(112) ["level"]=> int(0) ["chunk_size"]=> int(4096) ["buffer_size"]=> int(8192) ["buffer_used"]=> int(22) } } data: value of i = 2 array(0) { } data: value of i = 3 array(0) { } data: value of i = 4 array(0) { } data: value of i = 5 array(0) { } data: value of i = 6 array(0) { } data: value of i = 7 array(0) { } data: value of i = 8 array(0) { } data: value of i = 9 array(0) { }
-
Hi @3fingers thx but I think the problem is my server setup and I'm not good at debugging network stuff. See http://sse.baumrock.com/sse3.html where I have this code: <?php date_default_timezone_set("America/New_York"); header("Content-Type: text/event-stream"); $i = 0; while(true) { $i++; // manual limit of 10 runs for development if($i>=10) return; echo "data: value of i = $i\n\n"; while (ob_get_level() > 0) ob_end_flush(); flush(); if(connection_aborted()) break; sleep(1); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <h1>Open DevTools Console + Network Tab!</h1> <script> const evtSource = new EventSource("sse.php", { withCredentials: true } ); evtSource.onmessage = function(event) { console.log(event.data); } </script> </body> </html> It works locally: https://calip.io/HkCWbYAB#ueAgNM5v But it does not work on my server: https://calip.io/DzhmJQo2#4mfu1aP6 I bet this has something to do with gzip but I can't make it work ? I thought maybe you guys know more about networking and http/tcp stuff and can help me debugging or making it work...
-
Thx @netcarver sorry I've quoted @kongondo and linked you in the same sentence ? http://sse.baumrock.com/sse2.html --> the event is received every 10s which is wrong as far as I understood how SSE should work. I'd expect a console.log() happen each second and have one open stream as long as I click on "close the connection"
-
Hi community, last week I've tried to get PHP SSE working. Unfortunately without success. When using laragon it works, but on my DDEV setup and also on my live server it does not. I think there is some kind of compression and/or proxying going on, but I don't know how to debug or disable that. @kongondo and @netcarver have mentioned SSE is "is so simple it is unbelievable at first." Maybe you can help me? This is what I've tried: <?php header("Cache-Control: no-cache"); header("Content-Type: text/event-stream"); $i = 0; while(++$i<=10) { echo "event: ping\n"; $curDate = date(DATE_ISO8601); echo 'data: {"time": "' . $curDate . '"}'; echo "\n\n"; file_put_contents(__DIR__."/dump.txt", "triggered@$curDate\n", FILE_APPEND); ob_end_flush(); flush(); if ( connection_aborted() ) break; sleep(1); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <script> const evtSource = new EventSource("sse.php", { withCredentials: true } ); evtSource.onmessage = function(event) { console.log(event.data); } </script> </body> </html> The file_put_contents works as expected, just the javascript does not get the messages from SSE: The eventstream is sent after 10 seconds at once and not on each event: Then the request is sent again and the same process starts from the beginning... You can try the example here: http://sse.baumrock.com/sse.html I'd be very happy if anybody could help me making this work ?