-
Posts
158 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Karl_T
-
I experienced the same issue. My case was about permission issue. Adding the SSH user to apache group fixed the issue.
-
Template for API endpoint - Remove the language part in URL
Karl_T replied to Karl_T's topic in API & Templates
I found the solution. By amending this line in LanguageSupportPageNames module, we can set any template to bypass the language segment of the URL. It would be great if this can be editable in the module setting. Right now, we can just copy the module to /site/ and override the module inside /wire/. Hope this help somebody looking for the same api approach for multilingual sites. -
Template for API endpoint - Remove the language part in URL
Karl_T replied to Karl_T's topic in API & Templates
I want multiple api endpoint setups and have their own templates. I want to use them by some custom modules, each having their own endpoint under /api/. And I don't want to mess with other templates. Thanks for your suggestion! -
Template for API endpoint - Remove the language part in URL
Karl_T posted a topic in API & Templates
I would like to make a template for API Endpoint, i.e. www.domain.com/api/. The issue is that most of my sites are multi-lang. The URL will become like www.domain.com/en/api/ or www.domain.com/de/api/, which make some issues when calling ajax from the frontend. What I want to achieve is to remove the language part of the URL, which is exactly the www.domain.com/processwire/ looks like. The admin URL does not contain the language part. I look into the Admin's edit (The admin root), it does have the language name enabled, but its children, e.g. Admin>Pages, all the language names are showing /processwire/pages, instead of /en/processwire/pages/. I want to replicate this to /api/ and its children pages, which are also api endpoint like /api/login/. I have tried to disable the template multi-language support, but, unfortunately, the /en/ part is still there. -
If you want to cache-busting the image, you may add the following to ready.php $wire->addHookAfter('Pagefile::url', 'addTimeStamp'); $wire->addHookAfter('Pagefile::httpUrl', 'addTimeStamp'); function addTimeStamp($event){ if($event->page->template == 'admin') return; $modified = $event->object->modified; $event->return = $event->return . "?v=$modified"; }
-
Thanks for pointing me to this. I was using the wrong keyword(modal, popup) to search for this feature. This is the thing I am looking for. Let me back-link your tutorial here for people like me.
-
Hi @arjen. Thanks for joining the discussion. I suggest to use modal, as it is decoupled with the UI. In this way, it can be used anywhere inside the admin, not limited to particular modules. ListerPro is one of the best demonstration to this issue, but not limited to it. A more general approach could benefit more Processwire users imho. Some core modules use an approach that redirect to a confirmation page. This happens when we are removing template fields. Comparing with the extra confirmation page approach, I think modal is a better way. We can copy the button's href and form data to the modal, which is easier than changing the button's href to the confirmation page while keeping the action.
-
Clients occasionally request to have a confirmation for actions such as save pages, delete(trash) pages. This is an extra layer of confirmation that can prevent fault click and add more information of the action. This can also benefit module development as modules may contain some destructive actions or batch actions that may cause troubles once the action executed mistakenly. Here is my personal experience. I use the action feature in ListerPro and developed some actions for batch executions such as sending email and SMS. If the user was using the catch send action and forgot to filter the list, they would turn out sending all emails and SMS, which is a disaster. However, modules like ListerPro has their own user interface, which not every developer is capable of making changes to, like the way AOS do. If we have the confirmation layer, the story could be quite different. After clicking proceed button, a modal will popup telling how much email/SMS they are actually sending. They can then confirm that the action is going the way they want. The implementation could be like the way pw-modal do, adding a pw-confim-modal class to the button. In the module side, developer can make changes to button inputfield so that they can enable confirmation modal and set wanted markup to it. Existing module can make a hookable method for button creation. So other developers can choose to hook to add the markup they want for confirmation modal. I believe this feature should be included in core, with a standardized implementation for everyone to follow.
-
Yes, I will use this approach first. Thank you for your time.?
-
Thanks @dragan. I don't want to off topic much too. I am actually forking the module you mentioned to make it a more robust one. I would share the module once it is completed. It will be working silently and seamlessly with other modules. As Croppable Image 3 is my must use module, I just seek any chance that I can make the integration better.?(trying to relate Croppable Image 3 more)
-
Yes. I have tried this module. It is working great with normal file, but using this would lose the image inputfiled editor, and the feature of Croppable Image 3, which I am using in my every project.?
-
For webapp and e-commerce shops, high availability is critical. To achieve this, one of the approaches is using multiple stateless web servers running in parallel, by keeping all assets and database away from the web servers. In this way, we can add or remove as many web server as we need. Assets can be kept safe and synchronized across all web servers. I use AWS's Elastic Beanstalk to achieve this infrastructure. The ec2 servers controlled by Elastic Beanstalk will be terminated and rebuilt from time to time, so stateless servers are needed to use this kind of service or infrastructure.
-
Thanks for your suggestion. I have tried what you have suggested before. The problem of this approach is that checking remote asset availability needs an extra round trip and that increases the page loading time a lot. If there are many images in a page, every PageImage call would have to check if the remote image is available or not. This is not feasible. Please correct me if I am wrong. I think of a workaround for handling this module. As page editor will save the page, most likely, after adding new crop, I can hook to page save to sync with AWS S3, although the module does not require hitting save to make changes.
-
Yes of course. When the module is cropping an image, a variation image is created in /assets/files/id by CroppableImage3Helpers::renderImage method. I want to hook to the method like this to have treatments on the newly created image. Right now it is not hookable. My use case is to upload the image to AWS S3 if I want to make a stateless webserver. I have made the same request to processwire-request for your information. I think there can be more use cases. One of them always on my mind is generating a small placeholder image for lazy loading.
-
Hi @horst, is it possible to have a hookable method that for creation of variation image? I would like to hook it to upload the newly created variation image to somewhere else.
-
Hi @Tom.. I remember that you were developing an eCommerce module a year before. Why would you turn out to be using Woocommerce? Could you share any difficulties? I actually developed an eCommerce module for my company and I am now developing the second eshop with it. It is far from perfect, but I would like to see any chance I can make it open source later, because I think Processwire do deserve an open source eCommerce system. I wish we can have a decent eCommerce system in any way. I believe this can attract more talents to join us.
-
Thank @dadish for this great module. I liked this post long time ago. I just have a chance to get my hand dirty on it. It turns Processwire to a powerful headless CMS with no pain! I am going to use this in my next project with Vue.js or Nuxt.js. ? One noob question. Could this module query and mutate session data? I have modules that read/write user, including the unsigned guests, session data. I have no idea how to make it happen using only a GraphQL end point.
-
Hi @adrian, I have found an issue regarding page reference field. If the template does not contain title field and the page reference field is listed at the top, i.e. first template field, the module would fail to add/replace the correct value and show empty for that page reference field, while other position is working fine.
-
I remember that $this->halt() appears somewhere in the forum too. Just check. This works as well. Thank you!
-
Thanks @gebeer! It works with your method. I am using markup region by the way. I thought this variable was some kind of core API.
-
All solutions I found were using $useMain. It seems that Processwire is no longer supporting $useMain. How can I achieve the same as $useMain did? That is disabling the append and prepend _init.php and _main.php by API. I tried using die or exit(), but that would make TracyDebugger fail to work(not showing ajax information).
-
I have encountered an issue for Duplicator ver 1.2.9. I am moving a site from localhost(windows 10) to Amazon Linux. I use RDS, which is a standalone server for database, so the dbHost is not localhost. The issue happened in the installation process after entering the database data and proceed. There's an error telling config file cannot be found. Then I go to config.php, there are at least 4 places are using old information. They are dbHost, dbName, dbUser, dbPass and httpHosts. I think for some reasons the config.php did not update at all after the installation complete. After I manually update the fields, the site works fine now. This means database import is working fine. I wonder if it is the dbHost matters. It is a long URL ended with xxx.rds.amazonaws.com.
-
I did some trials and find that the original crop(cropper js) is able to do the job. Most codes sit inside a core module called ProcessPageEditImageSelect. Zoom can be enabled by setting zoomable to true in ProcessPageEditImageSelect.js, but it only allows zoom-in (scale >=1). For making some extra white space for the image, I need the zoom-out function. Then, I update cropper.js to the latest version(from v.0.7.8 to v4.0.0). It works after I fix some broken codes("done" method is not working). Then I stuck when I try to crop images. If I zoom-out, I get error message like this: Missing or wrong param x=-84 for ImageSizer-cropExtra! Array ( [0] => -84 [1] => -58 [2] => 620 [3] => 380 ), while zoom-in works just fine. I check the ImageSizer.php and ImageSizerEngine.php. I found that negative x value is throwing the exception. This explains why I cannot zoom-out. https://fengyuanchen.github.io/cropper/ In case you are interested, this demo can demonstrate the negative X value when zoom-out(scroll down the mousewheel). I think the negative value should be filled by white space by php. I have no idea how to implement this into ImageSizer.php and ImageSizerEngine.php yet. Welcome any ideas. Thanks!
-
https://php-download.com/ You may use this to get rid of composer, but I don't know how legit it is.
-
Windows 10 and php-7.1.6-Win32-V14-x64 I didn't try Windows to Windows yet. EDIT: I just create a package and install it with no error.