Jump to content

michelangelo

Members
  • Content Count

    15
  • Joined

  • Last visited

Everything posted by michelangelo

  1. Hello everybody! Thank you for your responses! @BitPoet that's a great tip, I didn't try it but I disabled the AJAX on the repeater as I don't have a lot of content and it works perfectly. @teppo sorry for the misunderstanding and thanks for moving it.
  2. Hello guys, very simple question about repeaters from the Core Modules. I have used them before without issues. This one concerns a weird behaviour which I am not sure whether it's caused by me not using it correctly or a bug. The problem is that when I add content, save it, refresh the page and return to the page, I cannot unfold the repeater. I made a video so you can see the behaviour (below) I tried re-initiating the repeater field, but still doesn't work... Looking forward to your advice! Thanks! repeater-problem.mp4
  3. Hello lads, I know there is some AJAX threads, but my question is super basic. How do I connect and use AJAX within PW? For now I am creating a request and sending it to my template which I want to do some search with PW's find() for me and return what I need as JSON eventually. let xhttp = new XMLHttpRequest(); if (option == undefined) { return; } else { if (option.name == 'options-sorting') { optSorting = option.value; } if (option.name == 'options-filtering') { optFiltering = option.value; } xhttp.onreadystatechange = function () { console.log(this.status); if (this.readyState == 4 && this.status == 200) { console.log(this.responseText); } }; xhttp.open( 'GET', 'site/templates/includes/archive-list-render.php?q=' + optFiltering + ',' + optSorting, true ); //Send the proper header information along with the request xhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhttp.send(); This code gives me 403, as PW doesn't allow me to access my archive-list-render.php. What should I do? I read some stuff about creating separate AJAX templates, is that really necessary in this simple case? On the php side I am thinking of something like this: $q = $_REQUEST["q"]; $options = explode(",", $q); // Some logic to define exactly what my query is going to be, e.g. sort=nk-artist $songs = $pages->findMany("template=nk-song, sort=$options"); Then I should get an array of objects that I can render little by little, because the expected results are about 8000 pages. Thank you!
  4. Wow, super nice! The more you know... Thank you!
  5. Thank you @MoritzLost! It's brilliant! It took me a few tries as my server was timing out, but it seems to work flawlessly.
  6. Hello guys, I have made a small website that has a few thousand pages with several fields. It all works fine, but when I change my language they don't show up... I found out in the depths of the forum that they need to be activated. Is there any way to do it as a batch process instead of doing in by hand? Just to clarify, what I need to change is in the Settings of each page, not a field in my template. This 'Active?' button needs to be ticked on every page. I thought maybe Lister might do the trick, but I can't seem to find a way to affect this Name field. Thank you! p.s I am using ImportCSV module to load them up, which works great but I don't think it can apply this setting for me.
  7. @teppo thank you so much for the comment 🙏 I actually really enjoyed the module, I spoke too soon because I am a bit levitating between options at the moment. Now with your suggestions in mind, hopefully I can manage it better. I imagine that I can do a query like this, for example? $pages->find('template=song, year>1990, year<=2020, search_index~=my_query_string')
  8. Hey @Sergio Search Engine and Meilisearch sound amazing, but they always render a form in a particular way. My design is simple, but quite specific and I want to render the results right away (imagine Google Image search or YouTube video search). Those intermediate "results page" are in the way for my project. I can try again Search Engine but it was a bit hard for me... Also because I just starting getting into PW PageArrays and those kind of data structures and Seach Engine gives me some JSON that I have to render 😝
  9. Thank you, @billH! That's sounds like a good plan! I think I get how PW selectors like find() works. I also tried direct SQL search, but I don't know where to direct my search to as the architecture of PW is not clear to me. Usually you select a table from the database and extract certain column or row, etc. but PW creates some crazy relations that really mess up my understanding.
  10. Update on my process, @elabx I am trying to use RockFinder3 but I can't make it work. It seems like it's great for visualising results, but what I need is just an array or PageArray of my results which I can visualise. Also the SQL queries didn't work the way I intended... It's just too unclear to me how to use the module.
  11. Thank you lads, sounds great. Now I got a better understanding. @Alexander yeah, 1000 divs is not the best :| I will make use of the template caching and just save the output of this page. And I maybe misrepresented the concept. It's just a list of all the 1000s of songs I have in my db. So technically it's more like a div with 1000s of spans or a's. Thanks for the ajax idea :)) Does the cache option on the templates relate to the $cache()? I enabled it for my templates and it seems to make everything faster, but I am randomly picking options (e.g. saving it for 1 hour!? ) and I am not sure how to continue...
  12. Hi @elabx, this looks great! I will see if I can implement it, it seems like just the right thing I need. Do I understand correctly that PW find() is not a similar to an SQL query? Thank you, @horst for the suggestion, my design doesn't really take pagination into account. I am thinking of something more like Instagram scrolling, just simple results after each other. And the caching... I am really overwhelmed how to use this. Do I cache every possible search result so it can be served quickly :D ? I really cannot understand what caching does. If it is a static page, I imagine that the server renders it and it saves it so it can serve it easily, but if I don't have a 'fixed' search result, how do I use caching? ProCache seems like a great tool, but I don't want to purchase it if I cannot make it work. What workflow would that entail?
  13. Hello guys, I am building a sort of an archive. Relatively simple, although I have about 8000 records, each with 15 fields (text, int, images, url). I created a crude search system with a form (emulating the famous Skyscrapper example) to filter through the system. Everything works but it is quite slow... I have 2 questions which are related: 1. How can I search through the database? 2. What is a good practice to display many records like these? ----------------------------------------- 1. I am retrieving the results with $songs = $pages->findMany('template=nk-song'); Then I do a foreach to render them all. I am unsure if that is a good way. If I render all of them on the page, it creates thousands of divs with a bit of text, and this can take a while (10s-15s). 2. This one is even worse :D as every time I retrieve my desired records with something like this: $page->find("field_to_search_through~=my_query_string") I get between 20 and 200, but when I render them I am creating iframes with YouTube videos and that can take up to 10s to finish. I "solved" it by only loading the iframes if they are in view with IntersectionObserver on the client-side. But I feel there is a more precise PHP / ProcessWire approach. Just to clarify, I started doing all of this custom rendering and querying because tools like ElasticSearch or SearchEngine were a bit complicated and I needed a simple to retrieve information and then display it in my own way. Thank you!
  14. Hi @MoritzLost thank for your reply. That's exactly what I needed. The native lazy loading is new to me. I will definitely use that and leave AJAX for another project.
  15. Hello there, I am building my website, which has a dozen projects with 10 images each. Basically, I need a filtering system but built in the most efficient and user-friendly way. You can see below that the images flow sideways so being hidden, JS lazy loading was a good tool, but I just wanted to try AJAX. Is it fit for this purpose or it's more for dynamic content?
×
×
  • Create New...