Liam88 Posted September 27, 2022 Author Share Posted September 27, 2022 21 minutes ago, flydev ?? said: I am used to use the Delayed Output Strat so I can't tell you right now what's going on for real Yeah I'll have to search if there are any other threads for markup regions strat. Getting the same output with the suggestion above so did a bit of searching and found this - https://processwire.com/blog/posts/processwire-2.6.8-brings-new-version-of-reno-admin-theme-and-more/#new-this-gt-halt-method-for-use-in-template-files Adding $this->halt to the end of each case prevents the continued render when using it within _init.php (the prepended file). This does not work if just adding to _main.php. This is the action area now - <?php if($config->ajax && $input->post->bookmark){ bd($input->post->bookmark); // debug with tracy, uncomment if you have it $bookmarkid = $sanitizer->int($input->post->bookmark); $action = $sanitizer->name($input->post->action); $bookmarks = $user->getUnformatted('bookmarks'); switch($action) { case 'save': // save logic if(!$bookmarks->has($bookmarkid /* this was bookmark, now bookmarkid */)) { // add bookmark $bookmarks->add($bookmarkid /* same change here */); $user->setAndSave('bookmarks', $bookmarks); $message = 'Borat saved bookmark "'. $bookmark->id .'" ?'; $this->halt(); } else { $message = 'Nothing done'; } $success = true; break; case 'remove': // remove logic if($bookmarks->has($bookmarkid)) { $bookmarks->remove($bookmarkid); $user->setAndSave('bookmarks', $bookmarks); $message = 'Borat removed bookmark "'. $bookmark->id .'" ❌'; $this->halt(); } else { $message = 'Nothing done'; } $success = true; break; default: $message = 'error'; $success = false; } $json = array( 'id' => $bookmarkid, 'action' => $action, 'message' => $message, 'success' => $success ); header('Content-Type: text/json; charset=utf-8'); echo json_encode($json); return; } ?> Now I get this within preview: and FINALLY it now saves into the user area. A huge thank you @flydev ??. Learnt so much through this thread and hoping it helps others! I'll even keep in borat in recognition of your input. 1 Link to comment Share on other sites More sharing options...
flydev Posted September 27, 2022 Share Posted September 27, 2022 Cool, so its green ! Great success ?? Link to comment Share on other sites More sharing options...
flydev Posted September 27, 2022 Share Posted September 27, 2022 20 minutes ago, Liam88 said: Getting the same output with the suggestion above so did a bit of searching and found this - https://processwire.com/blog/posts/processwire-2.6.8-brings-new-version-of-reno-admin-theme-and-more/#new-this-gt-halt-method-for-use-in-template-files Adding $this->halt to the end of each case prevents the continued render when using it within _init.php (the prepended file). great perseverance from you, learning new things from each others as always. @szabesz given the answer too there : 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now