Jump to content

Pixrael

Members
  • Posts

    395
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Pixrael

  1. This happened to me once and the problem was a non writable folder, check this comment:
  2. Hi, I am trying to organize a new project (admin UI style) and the urls structure should be as follows: /products/ Products list /products/discontinued Products list filtered /products/draft Products list filtered /products/new New product form /products/edit/P0123456789 Edit product form /products/inventory Inventory page /products/P0123456789 Product detail view I am analyzing that if I implement the page relationships in the regular Processwire way for routing, I will end up having something unwanted like this: home - products -- new -- P0123456789 -- edit -- P0123456788 -- P0123456787 -- inventory -- P0123456786 I was thinking in a page structure that contains "static" pages in a "visual" tree and keep constantly growing pages/data in a separate Tree node, then use urlSegments to load/display them, it will be something like this: home - products -- new -- edit -- inventory - data -- products -- P0123456789 -- P0123456788 -- P0123456787 -- shipments -- S0123456789 -- S0123456788 -- S0123456787 -- orders -- D0123456789 Having activated URLSegments in the Products list template I can do the following: /products/ ("list-products.php" all products) /products/discontinued ("list-products.php" filter products with urlSegment) /products/draft ("list-products.php" filter products with urlSegment) But for the Product details view case, I have Four possible scenarios here: 1st. The product node (in the "data" nodes) will have the template file "detail-product.php" assigned to it. The "list-products.php" will use urlSegment to render the requested product page instead of rendering its own "list-products.php" markup. ex: /products/0123456789 2nd. A "item" node with template file "detail-product.php" assigned, will use urlSegments to load product info from "data" product nodes. In this case product nodes do not have template file associated, they only store information. If the url "/products/items/" is requested without segment, it will redirect to parent "/products/". ex: /products/item/0123456789 The "static" page structure will ending like this: home - products -- new -- edit -- item -- inventory 3rd. Following the 2nd scenario, have the product pages directly in the "item" node (the natural processwire structure, no urlSegment implemented). ex: /products/item/0123456789 The page structure will ending like this: home - products -- new -- edit -- item -- P0123456789 -- P0123456788 -- P0123456787 -- inventory 4th. Is the inverse solution to 1st. scenario. Have the product pages directly in the products list node (the PW way), and use the urlSegments in Product list page for the other operations. For ex. New, Edit, Inventory, etc. will be rendered instead the Product list page. The markup of this pages should be placed in other hidden nodes or can be placed only in the file system. The page structure will ending like this: home - products -- P0123456789 -- P0123456788 -- P0123456787 What do you think? Which option is better: the first or the second? Do you think there is another way to organize this? PS: I know that it's a bit heavy to be asking about this again, but is an important decision for a complex project.. and maybe the answers here will serve in the future for someone else in the same situation. Thanks
  3. @szabesz your Tampermonkey script should looks like this: // ==UserScript== // @name New Userscript // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match http://domain.test/pw/module/edit?name=TracyDebugger // @icon https://www.google.com/s2/favicons?domain=domain.test // @require https://cdnjs.cloudflare.com/ajax/libs/jets/0.14.1/jets.min.js // @grant none // ==/UserScript== (function() { 'use strict'; $("#ModuleEditForm").prepend('<input type="search" id="jetsSearch">'); var jets = new Jets({ searchTag: '#jetsSearch', contentTag: '.Inputfields' }); })(); the @match parameter is the URL where the script will run each time your browser visit it.. then you will see a small form input before the Module Information Fieldset
  4. Yes, you should use the pin icon to keep the extension visible
  5. It should work because it adds a custom data-jets tag to elements with all the text inside them, regardless of whether it is visible or not
  6. Hi @adrian, Is it possible to use this javascript library on your module? https://jets.js.org/ I use it in my apps UI and it works wonderfully. This script filters in realtime all the elements of the page and shows only those related to the search query. @adrian If you want to do a quick test, you can install Tampermonkey extension in your browser and create a new script while you are on the Tracy Module config page. In that new script add the following lines: // @require https://cdnjs.cloudflare.com/ajax/libs/jets/0.14.1/jets.min.js then put the following code on the script part: (function() { 'use strict'; $("#ModuleEditForm").prepend('<input type="search" id="jetsSearch">'); // this line is only for testing var jets = new Jets({ searchTag: '#jetsSearch', contentTag: '.Inputfields' }); })(); Then save the script and reload the Module page, enter the parameter you want to access in the new input that appear on top of the page, ex: snippets, or scream, or suffix.. or any parameter you want to find PS: I use jquery to add the input field to the admin UI only for testing purposes, this search input element should be added by the module itself to the page rendering Please let me know if works on your end, here is working ok
  7. I always use: <pw-region id="content">...<pw-region> ..works like a charm
  8. It depends on the specific case, some examples $tpl = file_get_contents($config->paths->templates . 'html/my-file.html'); //ex: <p>This is a test: {foo}, and this is another test: {bar}</p> ..or.. $tpl2 = "<p>This is a test: {foo}, and this is another test: {bar}</p>"; $vars = [ 'foo' => 'FOO!', 'bar' => $pages->get('/')->title, ]; // Sometime later echo wirePopulateStringTags($tpl2, $vars); ..or you can use PHP heredoc $testing123 = "123"; $html = <<<HTML <div class='something'> <ul class='mylist'> <li>FOO!</li> <li>{$pages->get('/')->title}</li> <li>$testing123</li> </ul> </div> HTML; // Sometime later echo $html;
  9. I use Profield Table in my sites, I think this component is not for this specific case
  10. But for that only, you have the Children tab by default in each page, it have pagination and ajax loading
  11. Yes, thank you very much @dragan, I actually ended up using the findIDs call, but that's to querying the database .. my question refers to WireArray, because I supposed it would be faster to request the pages once to DB and then do the search operations on that array.
  12. Today I found out that querying WireArray is a lot slower than querying the database. First I implemented the first piece of code, and after that I wanted to optimize it thinking that consulting the database only once and then searching in the Wirearray will be better, but I discover that this is not an optimization, instead it's slower 2/3 times! $today = strtotime('today'); $month = strtotime('first day of this month'); /* DATABASE QUERY = FASTER */ $shipments_active = count($pages->find("template=page-shipment,ship_status=1")); $shipments_today = count($pages->find("template=page-shipment,created>$today")); $shipments_month = count($pages->find("template=page-shipment,created>$month")); /* WIREARRAY QUERY = SLOWER */ $shipments = $pages->find("template=page-shipment"); $shipments_active = $shipments->find("ship_status=1")->count(); $shipments_today = $shipments->find("created>$today")->count(); $shipments_month = $shipments->find("created>$month")->count(); Is this normal? Is there something I'm doing wrong?
  13. Check here: https://www.gethalfmoon.com
  14. Free Postman alternative: https://chrome.google.com/webstore/detail/apidebug-http-test/ieoejemkppmjcdfbnfphhpbfmallhfnc https://chrome.google.com/webstore/detail/postwoman-http接口调试插件/hoeapaidnfedjfbdghipliboclcighij PS: same extension, different name
  15. Looks interesting: https://pinegrow.com/tailwind-visual-editor
  16. I have this implemented as a REST service and not as a script. I just tested the task scheduler on the server by calling the endpoint and it worked perfectly, the app did not freeze. I have read that this happens when you make the curl call (I use wirehttp) from the browser. I was testing the app using a Chrome extension very similar to Postman, perhaps it is the cause of the problem.
  17. Hi @androbey and @Craig thanks for your support! I finally found the bottleneck and it's not in the database itself. So I'll rollback to MyISAM, because I can't limit the system to search in the DB using the customers email. Already tested write speeds on both engines and it's very similar, at least in the order of the 100s of pages. The problem really is PHP, specifically curl, fopen, etc. when you execute a http request, these commands block php until it receives a response. Additionally, some of the web services that I use have a rate limit, which sometimes slows down the service responses. This really doesn't worry me if it happens in the background, because I don't need to have the data in real time. But when you join curl limitations and the rate limit together, the entire app stops, sometimes up to 30 sec! that is inadmissible. I will look for a solution, and I will let you know here. I think PHP should improve this if it wants to remain as an application development option. It must be updated to the new times, now almost everything is based on third-party services and the iterations between platforms, and everything flows through http calls.
  18. Laragon said: mysql-5.7.24 and Adminer said on Table: field_page_information: PRIMARY pages_id INDEX data(250) FULLTEXT data
  19. Tested, do not works.. I fixed your code here: $value = $sanitizer->selectorValue($search); //instead $email Thanks
  20. https://bugs.mysql.com/bug.php?id=74042 https://stackoverflow.com/questions/25088183/mysql-fulltext-search-with-symbol-produces-error-syntax-error-unexpected https://stackoverflow.com/questions/8961148/mysql-match-against-when-searching-e-mail-addresses You found a solution? @ryan this is a comment from the second link: I fixed this same issue, (not a syntax error either - only occurs when string has '@' in it) and i fixed by changing to NATURAL LANGUAGE MODE instead of BOOLEAN MODE
  21. I checked other parts of the app and everything looks good, only that template file have the problems, this is the code in the file: $data = $page->page_information; // this is a YAML field // more code here $warranties = $pages->find("template=page-warranty, page_information*=customer_email: {$data->customer->email}"); That working before on MyISAM version.. here I want to find product warranties related to the current email address
  22. This is the query string that Tracy show: queryString => "SELECT pages.id,pages.parent_id,pages.templates_id,MATCH(field_page_information.data) AGAINST('customer_email: user@domain.com') AS _score_field_pa ... " This email is a parameter I asked for, to find other related pages, I just discovered that the error is not on saving is when I try to show the page on the front-end
  23. I'm in big trouble, I'm almost finished a big project (about whole year of work) and now when I'm preparing it for production, I find that if I create a lot of pages in bulk, the site hangs until the transactions are finished. This is a webservice that imports information in background from third parties. I had always done the tests with little information, but now in real use it's a big problem because every time the script runs the whole site halt. The problem is when I start the project I leave the database Engine in MyISAM default setting without predicting the problem and now I need to change it to InnoDB, I already converted all the tables using the mysql ALTER TABLE command and add $config->dbEngine = 'InnoDB'; In site/config.php .. Now the site loads perfectly and the administration also, but when I try to save a new page occur an error of type: SQLSTATE [42000]: Syntax error or access violation: 1064 syntax error, unexpected '@', expecting $end .. inside the function "execute" in WireDatabasePDO.php What can I do to solve this? I really need to use InnoDB to be able to write to the DB without blocking the users!
×
×
  • Create New...