Leaderboard
Popular Content
Showing content with the highest reputation on 01/10/2022 in all areas
-
7 points
-
Hi @Malinda. Welcome to the forums and ProcessWire. We have a jobs board here, in case you need it in future: https://processwire.com/talk/forum/22-jobs/ Yes. That is to be expected. For YouTube, you have three options at least: 1. Tell CKEditor to stop stripping your iframe, as explained here: 2. Use Hanna Code. An example can be found here: There are simple Hanna Code examples but I cannot find them at the moment. 3. Use one of the available Video embed modules: https://processwire.com/search/?q=video&t=Modules You would need to be a superuser (the higher up level [highest in fact]) to be able to access ProcessWire templates. However, the files that go with the templates (template files) and styles are stored in your directory/folders where your ProcessWire installation files are stored (on your webhost / server). Access to them is usually via FTP or a CPanel-like dashboard. The template files will be under /site/templates/. The location of styles is a matter of choice for your developer but the usual locations are /site/templates/styles/ or /site/templates/css/ or similar. By head area I assume you mean the <head></head> of a template file or an auto-appended file like _main.php (/site/templates/_main.php). The JavaScript would be picked up, yes. However, the code does not (shouldn't even, I would argue) go into CKEditor. It would be stripped out anyway by CKEditor. I am not sure what you mean by code in this case as well. Usually, that code would go into your /site/templates/scripts/main.js or /site/templates/js/main.js. The main.js is usually a custom file created/amended by your developer so it could be named something else, even scripts.js. I hope this helps. It would be helpful to know the what version of ProcessWire you are using. All the best ?.5 points
-
Assumes "categories" is a multiple Page Reference field and that you have a hex colour defined on each category page: $wire->addHookAfter('ProcessPageListRender::getPageLabel', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'accommodation') { $out = ''; foreach($page->categories as $category) { $out .= "<span class='uk-label' style='background-color:$category->hex_colour'>$category->title</span> "; } $out .= $page->title; $event->return = $out; } });3 points
-
I published a generic module with some examples at https://github.com/gebeer/CustomPageTypes Happy visual learning ?3 points
-
This week we have ProcessWire 3.0.192 on the dev branch. This is about 20 commits ahead of the previous version and contains 11 issue fixes and 5 pull requests, along with various other updates. PR code contributors in this version including Daun, MrSnoozles, Radon8472, BernhardBaumrock and Tyde. Thanks! For more details see the dev branch commit log. In addition to core updates, in recent weeks I've also been working on a new module similar to the PageAutosave (developed for the admin) except that it is for front-end forms. It works with any front-end form (whether home brewed or from something like FormBuilder) and remembers the entered form values every time a field is changed. If the user doesn't submit the form, they get an email with a link to finish filling out the form after a configurable period of time. This is especially nice for order and reservation forms. Accompanying the module is a separate Process module that lets you view all the forms in progress in the admin. Each form entry has its own unique URL, making them easy for users to return to, from any device. Once the user submits the form, the data gets removed from the pending submissions database. This is something I've been meaning to develop for awhile, and with the admin PageAutosave module still fresh on my mind, I thought now was a good time to do it. Thanks for reading, Happy New Year and have a great weekend!2 points
-
This is totally freaking awesome! Can't give enough thumbs up. Any plans to release this? Wannahave ? That would just be such a great help for keeping things in sync.2 points
-
Hi @Stefanowitsch, Very quick response. There is no best practice really. ProcessWire is blocking access to form-submit.php because it is not a template file. There are different approaches to handling ajax requests, including: Creating a dedicated page (it doesn't have to be visible) and calling that Home page to handle all requests. You can then include your form-submit.php and let it deal with the response and send it back to your home template. Same page the form was called in (1-3 are similar). Using the new URL Hooks.2 points
-
/site/modules/MyModule /site/modules/MyModule/classes /site/modules/MyModule/classes/MyPageClassOne.php /site/modules/MyModule/classes/MyPageClassTwo.php /site/modules/MyModule/MyModule.module.php The module: <?php namespace ProcessWire; class MyModule extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'MyModule', 'version' => '0.0.1', 'summary' => 'Your module description', 'autoload' => true, 'singular' => true, 'icon' => 'smile-o', 'requires' => [], 'installs' => [], ]; } public function init() { $this->rm()->initClasses(__DIR__."/classes"); } /** * @return RockMigrations */ public function rm() { return $this->wire->modules->get('RockMigrations'); } } The class: <?php namespace ProcessWire; class MyPageClassOne extends Page { public function init() { $this->wire->addHookAfter("Pages::saveReady", $this, "onCreate"); } public function onCreate(HookEvent $event) { $page = $event->arguments(0); if(!$page instanceof self) return; if($page->id) return; $page->status = 1; // auto-publish this page $this->message('Auto-published page '.$page->path); } } initClasses() will not only load your custom page classes but also trigger the init() method once. That makes it possible to attach all kinds of hooks that belong to the custom page class where they belong: Into the page classe's php file. You avoid hook-hell in ready.php like this. It will load one instance of your page class on every request though. You can also use custom namespaces easily: // in the module: $this->rm()->initClasses(__DIR__."/classes", "MyNameSpace"); // your page class: <?php namespace MyNameSpace; use ProcessWire\Page; class MyPageClassOne extends Page { ... } You don't need to use RockMigrations for that. You can have a look what initClasses() does. You could also just set the page class on the template. I don't know if that can be done manually but using RockMigrations it is just setting one property of the template: 'my_template' => [ 'fields' => [...], 'pageClass' => ..., ]2 points
-
Thanks a lot @teppoand a Happy New Year to you and the community! I will try out version 1.5.0 of the module soon but I am pretty sure it will rock anyways. To my second point about the missing stylings I also started to think it may is another problem not related to your module at all.1 point
-
Hi @Krlos You can do it by hooking ProcessPageListRender::getPageLabel like here https://github.com/FlipZoomMedia/PageHitCounter/blob/master/PageHitCounter.module#L460 https://github.com/FlipZoomMedia/PageHitCounter/blob/master/PageHitCounter.module#L9501 point
-
$toJSON = $list->explode(function ($item) { return [ 'title' => $item->title, 'id' => $item->id, 'tags' => $item->tags->explode(function($subitem) use($item) { return [ 'id' => $subitem->id, 'title' => $subitem->title, 'parent_title' => $item->title, 'sub_page' => $subitem->page_field->explode(['id', 'title']) ] }) ]; }); You can get more info about explode, each and implode function here https://processwire.com/talk/topic/5098-new-wirearray-api-additions-on-dev/1 point
-
@ngrmm By the way, you can try to use $pages->findRaw https://processwire.com/api/ref/pages/find-raw/, like wireEncodeJSON($pages->findRaw('template=some-template, parent=1234,', ['id', 'title', 'tags' => ['id', 'title']);1 point
-
$list = $pages->get(1234)->children; $toJSON = $list->explode(function ($item) { return [ 'title' => $item->title, 'id' => $item->id, 'tags' => $item->tags->explode(['id', 'name', 'title']) ]; });1 point
-
Hi @ngrmm $list = $pages->get(1234)->children; $toJSON = $list->explode(function ($item) { return [ 'title' => $item->title, 'id' => $item->id, 'tags' => [ 'ids' => $item->page_field->explode('id') ] ]; }); wireEncodeJSON($toJSON);1 point
-
Hi @johnstephens Did you check your browser console for errors?1 point
-
Hi, Have you had a look at one/some of these PageList modules ? There's also many discussions in the forum related to your query : You may also want to have a look into the ProcessWire hooks system. Hope this helps1 point
-
Hi. Great module, however found a small bug: When trying to set "Backup name" in the module settings and using curly brackets "{}" to insert $user variables as per instructions - the field doesn't allow the curly brackets to be used. The validation pattern is missing them. Fixed for myself by adding to the module code temporarily at line 442.1 point
-
1 point
-
Thanks for your replies. I think I will stick to this solution: 1. Crate a Template for the Ajax Page 2. Create a Page with that template and call it via Ajax1 point
-
Thx @rjgamer It is shipped now with the core: https://processwire.com/blog/posts/pw-3.0.179/ Or you install and use AdminStyleRock which makes it possible to select the primary color via inputfield on latest dev:1 point
-
TracyDebugger shows all the available options, so you don't have to remember them already. But you have to write them down manually at the moment. I guess it would be possible to create that yaml file on the fly. If tracy knows all the settings and can write them to the panel I'm quite sure it is possible to write them to a yaml file as well. Maybe @adrian can tell us something about that?1 point
-
Howdy @Stefanowitsch, Have a look at this topic. Maybe it will help.1 point
-
Hi @Krlos that's not an easy question and depends a lot on the use case. What are the circumstances that make the decision hard? I can't give any advice without any knowledge about the situation... Tricky? For whom? For the developer? For the person managing content? Counter question: Wouldn't it be tricky to reorganize hundreds of pages once a single thing in your project setup changes? See https://github.com/processwire/processwire-issues/issues/1459 for a recent issue... Unlimited possibilities using a hook ? I'm often using http://tabulator.info/ for displaying data and I have a module for that, so for me this is no issue. But you can also use ListerPro or the regular page finder I guess. If you don't have those tools it might be easier to stick with the page tree... But having business logic in the page tree is - in my experience - not a good idea for projects that need to scale in some extent, might change in the future or have have custom logic and calculations (for example I've built a survey tool where answers have been pages and the parent defined where the answers belonged to. That sounded great and easy on first glance, but the longer the project went and the more feature/change requests the client came up with, the more i regretted the decision and I think it would have been a lot easier to save all those answers under one parent and add a page field to save a reference to the related survey). But your setup looks like you want to show the items to website visitors under an existing urls, so probably having them where users can visit them makes sense (site.com/lodging/hotels/hotel-a)1 point
-
Please do, I'd be very interested to read that! It seems like this should be doable via a module in PW. I have a work-in-progress module that does something like this. It's not complete and haven't looked at it a while but it seemed like a promising avenue at the time. I think if the concept could be illustrated in a module then Ryan might see the benefits and then hopefully incorporate the features into the core. Seeing as you've clearly spent some time thinking about these issues, would you mind writing up a wishlist of what things you think PW should handle via files for the sake of version control? Fields and templates are the obvious things but you also mentioned translations which I wouldn't have thought of (I only work on single language websites) so it would be great to have a comprehensive list of problem areas for version control. Thanks in advance! ?1 point
-
Version 1.5.0 of the module adds support for selecting users by selector. This should help here. Alternatively it's possible to hook into Snippets::isApplicable() and programmatically define if a specific snippet should be applied. Note that I've also added a warning about page caching: in case (page) content is cached for authenticated users, snippet content may also get cached, which in turn may end up displaying the snippet to even those users it was not intended for. This is not an issue unless you're caching authenticated requests — something that is generally speaking not recommended either way. When you say "default admin uikit styles", do you mean that this button is only loaded in the admin? Usually admin styles wouldn't be loaded on the front-end of your site at all. If this occurs in admin, it might be some kind of issue with permissions / loaded modules. Very hard to say without understanding the full context here. Anyway, I would definitely check for JS errors and missing styles first. From what I can tell at this point, this does not sound like an issue with the Snippets module, but rather something else on your site.1 point
-
The Admin Actions module lets you do this (assuming the fields are not used by a template). It has some pretty helpful features including cleaning up unused fields and templates.1 point