Jump to content

Pixrael

Members
  • Posts

    351
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Pixrael

  1. Alternative, if PHP 7.4+ you can use the null coalescing assignment operator: $browserVersion = $t[0] . "." . $t[1] . $t[2] ??= '';
  2. Are you using innoDB? read: https://processwire.com/blog/posts/using-innodb-with-processwire/
  3. 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
  4. 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/
  5. 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>
  6. 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.
  7. 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
  8. 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
  9. @kongondo This does not work, these new hook functions only work when the requested URLs are not mapped directly to a page and the home page is "always there". @Sebi Could it be possible to use the homepage template file to "wireIncludeFile" the routes file, or to directly pass the request to your module, ex. initialize a module static function with the input object? AppApi::Execute($input);
  10. @Sebi How to set the "API Endpoint" module configuration correctly? I need to create a website (subdomain) that is an API server only, no web pages will be served from there.. I test the parameter like "/" in order to works like: https://api.domain.com/users/ but this show a "404 Not Found".. I need the endpoint entry of the API in the "home" of the website
  11. $import_timestamp = time(); foreach($jsonData as $jsonDataItem) { // Search for the page $imported_page = $pages->findOne("template=import_page, title=$jsonDataItem->name"); // Check if the page exist if ($imported_page->id) { // update values $imported_page->setAndSave([ 'field_A' => $jsonDataItem->source_A, 'field_B' => $jsonDataItem->source_B, 'field_C' => $jsonDataItem->source_C ]); } else { // create new page $p = new Page(); $p->template = 'import_page'; $p->parent = $pages->get(xxxx); $p->title = $jsonDataItem->name; $p->save(); } } // use this because if the pages were not updated/created during this import it means they don't come in the json $old_imported_pages = $pages->findMany("template=import_page, modified<$import_timestamp"); // hide/delete all $old_imported_pages..
  12. You can use the urlSegments to choose which html code to output in the template file, it can be with the code directly or with file include. https://processwire.com/docs/front-end/how-to-use-url-segments/
  13. Have you already tried using the repeater field for that? https://processwire.com/modules/fieldtype-repeater/
  14. .. or you can use $input->get() check docs here: https://processwire.com/api/ref/wire-input/get/ if you want to learn how to use ulrSegments, read this: https://processwire.com/docs/front-end/how-to-use-url-segments/
  15. ProcessWire can be checked? https://www.zdnet.com/article/google-releases-new-open-source-security-software-program-scorecards/ https://github.com/ossf/scorecard
  16. I implemented that previously. In my experience, if you create a page for each event (using child pages or repeater) you will end up with hundreds of thousands of pages quickly, and in each one you will recorded only a minimum data. I think that is very inefficient. Maybe using ProTable is a better solution. I finally ended up using a textarea and saved one event in each line, when I was going to show the timeline I parsed it with regex, as well to update the tracking info this is very easy. Maybe if I do that again, I would avoid parsing every request for the tracking info by saving/reading/updating the events in JSON format.
  17. I think the "correct" way to do it, is how you have it implemented now: for each portfolio, you query the related user to obtain the additional data. It's true that if you are constantly making queries of this type (ex: inside a loop), that performance is not optimal. Maybe if you use some kind of page/template cache you can solve it. Another way could be to keep a copy of the user's data in a "user" field of the portfolio template (using a textarea field and save all user data in JSON, or use the new ProFields Combo field) and implement a synchronization system based on hooks, then in the users' Page Save hook, find the related portfolio and updates that JSON field. 🤷‍♂️
  18. I have been using exactly that workflow for a long time now, with total success in medium to complex projects. Additionally I add components and partials using wireRenderFile or wireIncludeFile and that's all I have needed. It's important to note that all my projects are one man projects.
  19. Check this: https://www.fastcomet.com/processwire-hosting I never try this Managed Processwire Hosting, but I used their regular hosting plans, and they comes with cpanel + softaculous, so you can install PW easily.. fast hosting
  20. https://processwire.com/api/ref/page/set-and-save/ // Not needed: $order->of(false); $order->setAndSave([ 'pad_user' => $u->id, 'expire_date' => $expireDate, ]);
×
×
  • Create New...