Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/02/2021 in all areas

  1. $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..
    4 points
  2. And... you want to install HannaCodeDialog in order to make it easy for users to embed those snippets https://processwire.com/modules/hanna-code-dialog/
    2 points
  3. Friend or client... both don't wanna pay money for features like that. :D I'd go with a custom HannaCode here. There are patterns in the rumble embed which make it quite easy. Here is an example: !HannaCode:rumble:eyJuYW1lIjoicnVtYmxlIiwidHlwZSI6MiwiY29kZSI6IlwvKmhjX2F0dHJcbnZpZGVvaWQ9XCJ2bHBvaTZcIlxuaGNfYXR0cipcL1xuPD9waHAgbmFtZXNwYWNlIFByb2Nlc3NXaXJlOyA/PlxuXG48c2NyaXB0PiFmdW5jdGlvbihyLHUsbSxiLGwsZSl7ci5fUnVtYmxlPWIscltiXXx8KHJbYl09ZnVuY3Rpb24oKXsocltiXS5fPXJbYl0uX3x8W10pLnB1c2goYXJndW1lbnRzKTtpZihyW2JdLl8ubGVuZ3RoPT0xKXtsPXUuY3JlYXRlRWxlbWVudChtKSxlPXUuZ2V0RWxlbWVudHNCeVRhZ05hbWUobSlbMF0sbC5hc3luYz0xLGwuc3JjPVwiaHR0cHM6XC9cL3J1bWJsZS5jb21cL2VtYmVkSlNcL3U0XCIrKGFyZ3VtZW50c1sxXS52aWRlbz8nLicrYXJndW1lbnRzWzFdLnZpZGVvOicnKStcIlwvP3VybD1cIitlbmNvZGVVUklDb21wb25lbnQobG9jYXRpb24uaHJlZikrXCImYXJncz1cIitlbmNvZGVVUklDb21wb25lbnQoSlNPTi5zdHJpbmdpZnkoW10uc2xpY2UuYXBwbHkoYXJndW1lbnRzKSkpLGUucGFyZW50Tm9kZS5pbnNlcnRCZWZvcmUobCxlKX19KX0od2luZG93LCBkb2N1bWVudCwgXCJzY3JpcHRcIiwgXCJSdW1ibGVcIik7PFwvc2NyaXB0PlxuXG48ZGl2IGlkPVwicnVtYmxlXzw/cGhwIGVjaG8gJHZpZGVvaWQ7ID8+XCI+PFwvZGl2PlxuPHNjcmlwdD5cblJ1bWJsZShcInBsYXlcIiwge1widmlkZW9cIjpcIjw/cGhwIGVjaG8gJHZpZGVvaWQ7ID8+XCIsXCJkaXZcIjpcInJ1bWJsZV88P3BocCBlY2hvICR2aWRlb2lkOyA/PlwifSk7PFwvc2NyaXB0PiJ9/!HannaCode Just import that into HannaCode and maybe add a safe default video ID. BTW... this is the video ID:
    2 points
  4. Yes and no. In my first test I added an image from the global image field (in the template, not in the RepeaterMatrix) to a textarea. I copied that textarea over to another page and the image was referenced. I deleted the origin (master-repeater) and the image was removed on the second page as well. Not broken due to the clean-up process in my textareas. In my second test I created a new repeater type with an image field. Added one to a page. Copied it over to another on and the image was moved over to an all new repeater-page (first repeater had ID 8083, second had ID 8084).
    2 points
  5. Ladies and gentlemen. You have been waiting for a very long time. I am happy to say we are almost there. I am fixing a few loose ends in readiness for the launch. I will create a new thread outlining the way forward with alpha (early beta) testing later this week (barring any show stoppers) or next week at the latest. Thanks.
    2 points
  6. Like last week, this week, updates continued on the core and matrix repeater fields. Repeater and matrix fields can now be configured to use fewer pages. When set, it won't create placeholder pages for repeater items until at least one repeater item exists for a given page and field. This can drastically reduce the number of pages consumed by repeaters in your system, and even more so if you are nesting repeaters. Eventually, this will become the default setting, but for now we are playing it safe and making it optional with a new toggle that you'll find on the Details tab when editing a repeater or matrix field: After enabling the "Use fewer pages..." Setting, the "Find an optionally delete unnecessary pages" checkbox will take care of cleaning up anything that isn't necessary for existing repeaters already in the database. If you have a large site with a lot of repeaters, this could be deleting a lot of now irrelevant stuff, so just be aware of that and backup ahead of time to be safe. Thanks to @Jonathan Lahijani for the idea/suggestion. Also new this week is the ability to copy and paste repeater items, as well as to clone above or below existing items. It handles this by replacing the existing "clone" icon action with a dialog that now lets you choose among various related actions. Among them is the ability to copy/paste from the same page or between different pages. The only requirement is that the repeater (or matrix) items are from the same field. See the video below for an example of how this works: This works with either Repeater or Repeater Matrix fields. But if you want this feature in Repeater Matrix, you'll want to upgrade to ProcessWire 3.0.188 and download the new version posted today (v8 beta) in the ProFields download thread. The ability to copy/paste repeater items was an idea originally from @David Karich and a module he developed called Repeater Matrix Item Duplicator. Thanks for reading and have a great weekend!
    1 point
  7. Hello! I am new to PW and while I got a hand of working with .php and coding templates, I am completely lost to how to adjust the file structure from one project to another? The files that we copied from the server were stored like this: While I have a very basic set-up that comes automatically and my main code is all in processwire/site/templates: As I understand, when you launch a project it looks for index.php and then for config.php, and of course it breaks if I just copy the structure in the folder (websites/processwire). Basically, what I need is: - all templates and fields - the pages tree itself (so not only the templates and fields, but also the tree structure using those templates and fields) - all the data from inside the fields But I do not know how to transfer this from the copied files and not get an error. And maybe my question is where does PW store the table with all the field types/ pages/ how data correlates the pages etc and can I copy it and just paste into my project? If you could guide me to options, I'll be very grateful! NOTE: I do not have access to the server with all the data, thats why we just copied the whole thing to adjust.
    1 point
  8. @Pixrael thanks a lot! Great Idea to find out the outdated pages with the timestamp! I learned a lot!
    1 point
  9. If you're trying to duplicate a site, and don't have access to mySQL, then there are couple of modules that may be helpful. https://processwire.com/modules/process-database-backups/ This one can be helpful if you have an existing ProcessWire installation that's working, but need to restore data from a backup. https://processwire.com/modules/process-export-profile/ This one is useful if you're starting a completely new install of ProcessWire and you want to recreate an existing site structure during the install process. This will include templates, site modules, and page structure. You need to copy the exported profile to the new site profiles directory before you install, so that it allows you to select the profile during the install process. This will recreate the database structure. You will need to be able to set up a blank mySQL (or MariaDB) database and assign a database user with full access to it. There are other migration modules if you have a development site and a live site, and you only want to transfer changes.
    1 point
  10. Out of curiosity, for file/image fields, are the copied values going to point to the originating pagefile URL, or is it creating a completely new physical copy of the source items on the page where the repeater is pasted?
    1 point
  11. Hi! ProcessWire stores all its data in a MySQL database. You don't seem to mention that in your post so I'll give a wild guess that it's a part that might be missing. Is the copy of the project running locally or on a server?
    1 point
  12. I created a Real Estate CRM that runs with 4 languages. All my clients are okay with PW 3.0.184 but since I updated one to 3.0.185 the multi-language support for pagination names stopped working. Since 2 of those languages Español and Catalá use "pagina" instead of "page" for pagination, the system wasn't recognizing it and reset to "page2" without the get vars of the search query. I fixed it setting all to "page" but I need it working as it was. Here the fixed example and also a working example with PW 3.0.184 of a new client I'm implementing these days. Pagination working with "page" for all languages: https://www.zonahabitable.com/inmuebles/?buscar=1&orden=&operacion=1247&pais=1197&provincias[]=1204&preciomin=&preciomax=&habitaciones=&banios=&metros=&layout=list Pagination working with pagina and page for different languages: https://web.brosrealestate.com/ca/immobles/?buscar=1&layout=list&operacion=venda&tipo=1117&provincia=&localidad= https://web.brosrealestate.com/ca/immobles/pagina2?buscar=1&orden=&operacion=&pais=0&provincia=0&localidad=0&tipo=1117&preciomin=&preciomax=&habitaciones=&banios=&metros=&layout=list Any idea? Thank you!
    1 point
  13. Hi @Crowdland Technology There has been a lot of changes in 3.0.185 that relative to ML support and other part of request handling so it's better to stay for some time on the stable 3.0.184. There is already an opened issue https://github.com/processwire/processwire-issues/issues/1447 So you can describe your case there
    1 point
  14. https://returntrue.win/ have fun ?
    1 point
  15. Thanks, that's one way if i can't hook something. It'd be nice to have a default field though.
    1 point
  16. actually this is in the core, all you need to do is add these to your toolbar (you don't need to add any plugins): so where your first line would look like this out of the box: Format, Bold, Italic, -, RemoveFormat you can change it to be like this: Format, Bold, Italic, Underline, -, RemoveFormat, -, TextColor, BGColor
    1 point
×
×
  • Create New...