Jump to content

Pixrael

Members
  • Posts

    395
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Pixrael

  1. I think in pages that need this paragraph changes you can use different fields for each region, and render the field according to the current region. Ex. body_america, body_europe, etc. You can create a function that determines to which region it belongs according to the country. If you have a license for ProFields you can use Textareas field type to handle that more easily. Pseudo code: $http = new WireHttp(); $country = $http->getJson("http://ip-api.com/json/{$session->getIP()}?fields=countryCode"); $region = getRegion($country); echo $page->body_$region; function getRegion($country) { // Set a default $output (europe) // Using an in_array, switch, etc. find the current related region to override it (america, asia, africa, etc.) return $output; }
  2. hum.. looks like the second call uses POST too: secondAJAXXHR.open('POST', '', true); do you fill the $action variable in the "some logic" code? // some logic $response['action'] = $action; if not, will be empty for a GET request
  3. class Test extends \Wireframe\Controller { public $var; ...... etc } maybe?
  4. Not really, but what I wanted is to help you to have material, to review, because it's difficult to have an idea of future needs ahead of time. You could discard the ones that don't make sense of course
  5. @bernhard check this custom filters for PW, maybe you wan to add this to your module: https://github.com/rolandtoth/TemplateLatteReplace/wiki/Additional-filters
  6. That template engine is great, in my beginnings with Processwire I was testing with this excellent module developed by @tpr it's very complete, with many additions and filters to extend it. But I finally ended up using Markup Regions when it came out around the same time. I wasn't that ready yet for that "advanced" PHP. I'll keep an eye on your module, maybe I'll try again with Latte ?
  7. @wbmnfktr That would be fine, but sometimes we can change the name of the page (ex. by SEO criteria) or change the location of the page, however if a universal identification of that page is maintained, there will be no problems with the maintenance or updating of the project. and furthermore, it would not be necessary to reproduce the design of the site's navigation structure in a folder tree.
  8. Problem: As the page ID is currently used for the creation of the page folder, does not allow the pages to be imported correctly when they are Exported/Imported in the admin. Example: Having a website in production generating new content constantly, and in my development copy I add some categories, pages and other content that includes images, logos, etc. When I upload the local folders to the server, and export/import that pages, the relationship between them is lost, because the exported IDs are already used in production on other pages and PW generates new IDs. Another consequence is that the contents of the local folders are mixed in the folders of the online pages that share that ID. Solution: Would be to add a new internal parameter to each page based on some kind of uuid, which serves as a unalterable reference for naming and accessing the folder related to that page.
  9. @virtualgadjo check this, it may also be useful in your project: https://processwire.com/modules/connect-page-fields/
  10. I know your feelings now, I've been there. In my experience PW is great for creation, but very bad for maintenance. The fact that the entire site configuration is dynamic based on the database tables is a big deal. One piece of advice, if you are going to use the Export/Import pages option, never think of using the ID of the pages in functions and logic in general.
  11. Could this be a solution? https://mediamanager.kongondo.com/
  12. To make a POST request using the Fetch API, you need to pass the 'method: POST' to the fetch() method as the second parameter: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch | https://reqbin.com/code/javascript/ricgaie0/javascript-fetch-api-example fetch('https://domain.com/api', { method: 'POST' }) .then(resp => resp.json()) .then(json => console.log(json))
  13. If you still want to review your code, you can also use regular php code in your Processwire projects. Check google for options: https://www.google.com/search?q=php+malware+code+scanner
  14. This error is related to Processwire, not to the module. Check the documentation for the Repeater field in the section "Using the API to add or remove repeater items": https://processwire.com/docs/fields/repeaters/ You can also check this post that talks about the same problem: https://processwire.com/talk/topic/16276-remove-repeater-item-by-page-id-rather-than-item-id/
  15. Alternative, if PHP 7.4+ you can use the null coalescing assignment operator: $browserVersion = $t[0] . "." . $t[1] . $t[2] ??= '';
  16. Are you using innoDB? read: https://processwire.com/blog/posts/using-innodb-with-processwire/
  17. Me too, I always try to import the data using the Ryan module https://processwire.com/modules/import-pages-csv/ .. if not fit the case, then I write some code to create the pages
  18. I'm sorry. Since you said you were a user of Form Builder, which is a licensed product, I assumed you had access to the forum section for users of registered products. In order to see the post I published here, you must register with your purchased copy of Form Builder to access this section: https://processwire.com/talk/forum/27-vip-support/ you can manage your purchases here: https://processwire.com/talk/clients/purchases/
  19. I think in this case PW will generate all that code because the element in the "optional" section is not actually empty. For the region definition, I always use the pw-region tag (placeholder region) instead of the html tags, because the pw-region tags are always removed from the final output. I would do the following: in _main.php <pw-region id="section2"></pw-region> in templatefile.php <pw-region id="section2"> <?php if($content1): ?> <section class="section"> <div class="container is-fluid"> <div id="content2"> <?php echo $content1; ?> </div> </div> </section> <?php endif; ?> </pw-region> .. But there are many ways to do this .. thanks to Ryan ? ..for pw-optional option should be like this in the template file: <section id="section2" class="section" pw-optional> <?php if($content1): ?> <div class="container is-fluid"> <div id="content2"> <?php echo $content1; ?> </div> </div> <?php endif; ?> </section>
  20. I had already suggested to @kongondo that he could use Omnipay Library as part of the Padloper module. But I don't know if this Library is a good choice, since no one here in Processwire has ever implemented it as a module.
  21. What if… Visual Studio Code became the editor of in-browser Developer Tools? www.youtube.com/watch?v=77qEmDlFtzg https://www.youtube.com/watch?v=g_TpkkmYzXs
  22. Yes, it works with this three lines in the home template file, but you must enable the urlSegments in the home template.. now the AppApi configuration still have the "domain.com/api/users" as endpoint but "domain.com/users/" works too.. if you try "domain.com/foo/" the api respond with a 404 json response
×
×
  • Create New...