Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by flydev

  1. Hello, What @cwsoft said. Adding, for example, if you need using it in your own namespace, you can connect ProcessWire like this: <?php namespace Foo\App; use Foo\BarClass; use ProcessWire\Page; class PwConnector { public function init() { $this->bootstrapProcessWire(); } protected function bootstrapProcessWire() { $pw_dir = '/var/lib/www/pw'; // example, processwire is installed here if (!function_exists('\ProcessWire\wire')) include($pw_dir . '/index.php'); echo \ProcessWire\wire('pages')->get('/')->title; // echo home title } // ... } He will still benefit an easy API to use to access them by using the $database object, if stored externally.
  2. Hello @Roadwolf welcome here ! I will let other members giving you a better written introduction and greeting and I will most try to give some answers and thread links to confirm you ended on the right place. Your 18 years old website/blog deserve a good software to run on. Recently, a member posted about his website thats was not working (spoiler: we are talking about the backend side) where it turns out to be more of a "problem" with the hosting provider configuration. Just speaking about it, first because ProcessWire get updated every friday (this can be tracked on github and in the announcement section here in the forum), it let you being confident on how robust and secure the software is, secondly, we almost never seen an upgrade being problematic, even going from major version 2 to 3, assuming you have a small technical habits to follow basics steps. About multisite, I think yes, but I have never personally tried, so others will answer to it. Then you will love it 💯 Even GPT tends to throw a lot of confettis on this community, if you ask her, you will love it 💯x 2 😁 Interesting. The answer is no, at least there is no built-in solution, and from what I know, there is no module available for that. But it can be achieved really easily, thanks to ProcessWire freedom. The day you start to put your hands on it, do not hesitate to ping me, I have personally some experiences with NFTs, smart-contract and all this mess so I could give some help in this regard. Yo will find a lot of resources here on the forum, well explained, and do not be afraid if you see some tens years old junks of code, they will almost all still work 😄 , give a read to the nice blog posts, register to weekly.pw to receive the best of it each weekend for nice read while taking coffee. Enjoy your PW journey 🙂
  3. I was going to suggest it. Unfortunately, I don't own it I think as I have the very first version. I will take a look. But you could ask Ryan directly. Playing with InputfieldImage and InputfieldFile from frontend is not trivial, as is. If you do not get an answer, I will come back to this thread once I get my hand on the module source-code. Edit: Just in case, you can also implement a custom form for files (https://gist.github.com/jacmaes/6691946) and play with a bit of JS to render things dynamic. And to generate random links, you can take a look at this (I am still using it, even if the module is born almost ten years ago: https://github.com/plauclair/FieldGenerator)
  4. By using the api you should get almost any things you try to achieve, FormBuilder or not. What is the problem ? Please be more specific.
  5. You might like this module: https://processwire.com/modules/admin-help/
  6. Hi, Check utilities from @Robin S there is a lot of gems: https://github.com/Toutouwai/RepeaterImages And give a read on those articles: https://processwire.dev/processwire-responsive-images/ https://processwire.dev/building-display-options-processwire/ (Example 2) For the twig things, its easy to convert it to standard html markup.
  7. Hi, I think you can make it easier without dealing with 404 hook. You should give a read at this blog post about new URL hooks: https://processwire.com/blog/posts/pw-3.0.173/#new-type-of-hook-for-handling-request-urls
  8. But not the backend which give a 500 error. Anyway, you just have to throw a lot of confettis on @ryan . Read below. This piece of software look solid, love this quote so much 💙
  9. Hi, `$this->addHook()` give you the ability to define a custom method that can be available in the class object given as a parameter. $this->addHook('Page::summarize', $this, 'summarize'); | | | |- (name of the method defined in the current object (module, class..) | | | | | |- current object where the method is defined (module, class) | | | |- the name is mandatory, | you will call the method given as third param from the Page $page object ($page->summarize()). | |- the object where the new method will be added to In the example of the `summarize()` method you are talking about, it expect a method `summarize()` to be defined in an autoload module. But you are not required to write a module just to define a new method to an existing class. You can write it outside a class, for example, in the file `init.php` by writing the following: $this->addHook('Page::summarize', function ($event) { // the $event->object represents the object hooked (Page) $page = $event->object; // first argument is the optional max length $maxlen = $event->arguments(0); // if no $maxlen was present, we'll use a default of 200 if(!$maxlen) $maxlen = 200; // use sanitizer truncate method to create a summary $summary = $this->sanitizer->truncate($page->body, $maxlen); // populate $summary to $event->return, the return value $event->return = $summary; }); // or by defining the function... function summarize_2($event) { // the $event->object represents the object hooked (Page) $page = $event->object; // first argument is the optional max length $maxlen = $event->arguments(0); // if no $maxlen was present, we'll use a default of 200 if(!$maxlen) $maxlen = 200; // use sanitizer truncate method to create a summary $summary = wire()->sanitizer->truncate($page->body, $maxlen); // populate $summary to $event->return, the return value $event->return = $summary; }; // ... and giving the name of the function to the hook. // note the `null` parameter used to tell the hook we are not using it from a class object $this->addHook('Page::summarize_2', null, 'summarize_2'); You will be using a hook where `after` or `before` doesn't matter, to define a new method `summarize()` to the existing class `Page`. So in your template, eg. `home.php` or `basic-page.php`, you can then call both methods from the `$page` api variable. <?php namespace ProcessWire; // Template home.php // if the `body` field content is: "The body field of this page summarized in less than 200 characters, or it will be truncated." // calls of the new defined methods `summarize()` and `summarize_2()` will print the content of the `body` field. echo $page->summarize(); echo $page->summarize_2(); If you want to test it from a module, then is quite simple (note we replace the `null` param by `$this` to tell the hook we are using it from the current object class (themodule): class ExampleSummarize extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Example Summarize module', 'version' => 1, 'summary' => 'Add a new method `summarize()` to page object.', 'autoload' => true, ]; } function summarize($event) { // the $event->object represents the object hooked (Page) $page = $event->object; // first argument is the optional max length $maxlen = $event->arguments(0); // if no $maxlen was present, we'll use a default of 200 if(!$maxlen) $maxlen = 200; // use sanitizer truncate method to create a summary $summary = wire()->sanitizer->truncate($page->body, $maxlen); // populate $summary to $event->return, the return value $event->return = $summary; }; public function init() { $this->addHook('Page::summarize', $this, 'summarize'); } } If you write this code in a file `ExampleSummarize.module` and from the backend you refresh modules and install this module, the method `summarize()` will be available by calling `$page->summarize()` from where you want. You can also find more informations and lot of details there: https://processwire.com/docs/modules/hooks/
  10. Hi, Step #1 💡👉 The first step IS to make a backup of everything. 2. Connect to your host, and make a backup of the database, with PHPMyAdmin or any tool available on the hosting provider. You will find it in their documentation. 3. Download all the files of your website. By FTP or eventualy making a ZIP archive from the administration page of the hosting provider. 4. Triple check your backup Then if you follow the steps on the answer of the question of @Inxentas which he just linked above it should work. If you are worried, and as Ryan said, your frontend is working, so I suggest you giving a try on your own computer with a simple oneclick webserver. There is no dev steps involded. Please, again, make a backup of everything before doing any upgrade and do not hesitate to ask further help here.
  11. This 👍 « Just » make an offer on ddev.site and put the certificat on your setup 😁 Another solution is to make your own self signed certificate and add it to your OS certificates authority in order to trust it.
  12. Worth a ping @Claus he might have an idea on this subject.
  13. Made you a small screencast @bernhard to get an idea. This version works fine with php-8.1. Enregistrement #59.mp4 Enregistrement #60.mp4
  14. In wire shell no, but wirechief contain them and more, like pw:restore native:restore (mysqldump), duplicator:restore (working with packages), etc. My screenshot do not reflect the current version. Almost all commands contains subcommands depending on the arguments given. Too much to be listed here without spamming the thread. I dont use migrations everywhere and the cli tool allow, for example, to create templates, fields and assiging them in seconds, or installing pw and a specific profile from the terminal without writing any code, its time saver, like artisan. Keep in mind that the tools is born 8 years ago and abandoned since 4y.
  15. For those who was using wire shell in the past and will send PR to rockshell, there is some handy ideas.
  16. Some time ago, I forked wire shell and renamed it WireChief to avoid the ads made on the defunct domain name. It was designed primarily to create pw/vite applications (the latter is about to be released). Also, I haven't looked at @bernhard’s RockShell, but maybe I'll switch to it.
  17. Wouldn't the system be too slow with EFS? It's a network drive, isn't it? Curious to see how locks are managed with this setup. I read a bit about ElastiCache which support Memcached and Redis protocols you ( @teppo) suggested, it look like a great service, with almost no code modification needed.
  18. Ok, thanks for the information, I thought that you was talking about Azure Security Group which reminded me of the session handler issue (I missed the AWS details on one of your previous message). I understand now better about the logout issue you encounter with file handler and you should avoid it. I am not experienced with RDS, and maybe @nbcommunication could have a better insight regarding his scaling setup presented recently on the forum.
  19. HI, I am jumping in the thread. Just some questions. (By ASG did you mean Azure ?) - About the query SELECT GET_LOCK: What's is the database server version, model (MySQL or MariaDb) and the database server max_connection settings value ? - Using file system based sessions, ask the team details about: Value and permissions set of the php.session.save_path and the number of files in the target. Value of php.session.save_handler ? Edit: FI, I just checked on three setups using file system session with the bug-issue-1760, there is 4416, 7428 and 5651 session-files and growing without slowing down the system at this moment of writing. Edit2: @Nishant There is also an article that could be interesting and might help of tweaking the session database handling: https://processwire.com/blog/posts/pw-3.0.175/#read-only-and-db-driven-sessions
  20. To add informations on Steve suggestions, and avoid more troubleshooting than necessary, as you are running out of space, the second issue "SQLSTATE[08004] [1040] Too many connections" is certainly due to lack of disk space. The explanation is: lack of disk space make MySQL waiting before INSERT, UPDATE, etc, can complete and then increase the number of pending connections until the limit of `max_connection` is reached. For checking disk usage you might want to use a better tool like duf (muesli/duf/releases) to get a nice insight of disk usage (you will might not be able to install it due to the issue, just remove some log files to get a bit space, you require less than 900kb).
  21. Join the mission and have your name engraved on NASA’s Europa Clipper spacecraft as it travels 1.8 billion miles to explore Europa, an ocean world that may support life. Sign the message… get on board! https://europa.nasa.gov/message-in-a-bottle/sign-on/
  22. I really like it! I wanted to take a similar approach in terms of atmosphere. The shaders look great, good job 👏
  23. Personally, I am just ripping on React. About my own experience with all this JS mess, I had the same sentiment you described about the frustration, I was totally in, until webpack "disappeared". I then got interest on bundlers, studied the core of rollup and then vite to finally turning the pile of JS bricks living my brain into a solid wall. Writing chromium bindings for Pascal language helped a lot, as the goal was to build an alternative to Electron. Yes, Angular... I wanted to talk about the NestJS infra inspired by Angular. Anyway, another stack and breaking changes.. Missed this details, I thought you was using InertiaJS with ProcessWire 👍
  24. You can also generate desired image variations when you upload an image in the field: /** * // in ready.php * Image variations * Generate image variations on upload * Pageimage api ref: https://processwire.com/api/ref/pageimage/ */ $this->wire()->addHookAfter('InputfieldImage::fileAdded', function ($event) { $inputfield = $event->object; $image = $event->argumentsByName("pagefile"); // `image` field on `document` template if ($inputfield->hasField == 'image' && $inputfield->hasPage && $inputfield->hasPage->template->name == 'document') { // some custom options $defaultOptions = array( 'upscaling' => false, 'cropping' => false, 'quality' => 90, ); // generate image variations // See wire/config.php for $config->sizeName: https://github.com/processwire/processwire/blob/master/wire/config.php#L726-L789 $image->size('landscape'); // 16/9 defined size `landscape` from $config->sizeName $image->size(200, 250); // 4/3 thumbnails } }); For debugging => https://processwire.com/modules/tracy-debugger/
  • Create New...