Jump to content

ngrmm

Members
  • Posts

    475
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by ngrmm

  1. thx @Zeka I got it working with a temporary loop inside my foreach-loop (see update on my post). Actually I needed the tags to be arrays themself. But your method looks better. Is there a way to output the tags as arrays themself with your method?
  2. I know there are some modules (pageQueryBoss, GraphQL, …) this. But non of them outputs exactly how i would like my json to be. So i tried to do it manually: $list = $pages->get(1234)->children; $list_array = array(); foreach($list as $listItem) { $list_array[] = array( 'title' => $listItem->title, 'id' => $listItem->id, 'tags' => array( 'ids' => $listItem->page-reference-field ) ); } $list_json = json_encode($list_array, true); echo $list_json; How do I loop through a page-reference-field inside an array? UPDATE: i think, thats the way to do it $list = $pages->get(1234)->children; $list_array = array(); foreach($list as $listItem) { $listItemTags = array(); foreach($listItem->tags as $tag) { $listItemTags[] = array( 'id' => $tag->id, 'title' => $tag->title, ); } $list_array[] = array( 'title' => $listItem->title, 'id' => $listItem->id, 'tags' => $listItemTags ); } $list_json = json_encode($list_array, true); echo $list_json;
  3. What ever lived before dinosaurs, I'm one of those ? I use Nova as Code Editor which has a FTP-client builtin. Most of the time I'm working on the live-server. ProCache takes care of my scss-files Modules: PrivacyWire, Jumplinks, ProtectedMode, lot of the ProModules, … ProfileSiteExporter for moving Sites I also do not offer hosting Even with a limited setup as mine, there is a lot possible with ProcessWire. What a great CMS and community. btw: Happy new year to you all!
  4. @dadish I tried the above code <?php namespace ProcessWire; echo $_POST['query']; and I'm getting this error in TracyDebugger PHP Notice: Undefined index: query in .../httpdocs/xxxxxxxxxxx/site/templates/graphql.php:3 My graphi template has the forward slash activated. Just to understand this, is it right that I first configure the output with the GraphiQL-tool. And this output is then shown on /graphql/ as json? UPDATE: seems it has something to do with my site-settings I tried it in JS and it works However when I use /graphql/ as URL i see an object in the console. When I use /processwire/setup/graphql/ I see a json in the console $.post( '/graphql/', { query: "{ eventsArticle { list { id } } }" }, function (res) { console.log(res); } );
  5. {"errors":[{"message":"Syntax Error: Unexpected \u003CEOF\u003E","extensions":{"category":"graphql"},"locations":[{"line":1,"column":1}]}]} I'm getting this error for the GraphQl page for domain.com/subfolder/graphql/ GraphiQl (domain.com/subfolder/graphiql/) is working fine. Also domain.com/subfolder/processwire/setup/graphql/ I assume this has something to do with my pw-installation inside a subfolder? I already saw that hint with the slash and also tried this in my graphql-template <?php namespace ProcessWire; header('Content-Type: application/json'); $ProcessGraphQL = $modules->get('ProcessGraphQL'); $ProcessGraphQL->GraphQLServerUrl = '/subfolder/graphql/'; echo json_encode($ProcessGraphQL->executeGraphQL(), true); In my htaccess i have RewriteBase /subfolder/ and in my config file I still have $config->httpHosts = array('domain.com', 'www.domain.com');
  6. I exported a profile and wanted to install it on another webspace. I've done this hundred times and it works always. But this time the install-process fails before the last step. The screen where you can enter admin name and password does not appear. The browser gives me an 200 Error for install.php I can not login into the backend (no user account set yet). At the frontend I get different errors. Looks like any functions linke css() (ProCache) and render() (Formbuilder) causes errors. The server is running php 7.4 and mysql 5.7 PW is the latest masterversion the install.sql in my exported has a 16.4mb filesize the phoinfo() says 120 max time for php executions. Could this be the problem? the first frontend errorlogs after installation fails: 2021-12-14 15:06:19 ? ? You must assign a template to the page before setting custom field values (name1062) [pageClass=ProcessWire\Page, template=] 2021-12-14 15:06:19 guest https://xxxxxxxxxx.com/_new2/ You must assign a template to the page before setting custom field values (name1062) [pageClass=ProcessWire\Page, template=] one after some refreshes in the browser 2021-12-14 15:21:50 guest https://xxxxxxx.com/_new2/ Fatal Error: Uncaught Error: Call to a member function css() on null in /homepages/21/d521107727/htdocs/xxxxxxx/_new2/site/templates/_inc/header.php:50 Stack trace: #0 /homepages/21/d521107727/htdocs/xxxxxxx/_new2/site/assets/cache/FileCompiler/site/templates/home.php(4): include() #1 /homepages/21/d521107727/htdocs/xxxxxxx/_new2/wire/core/TemplateFile.php(327): require('/homepages/21/d...') #2 /homepages/21/d521107727/htdocs/xxxxxxx/_new2/wire/core/Wire.php(414): ProcessWire\TemplateFile->___render() #3 /homepages/21/d521107727/htdocs/xxxxxxx/_new2/wire/core/WireHooks.php(951): ProcessWire\Wire->_callMethod('___render', Array) #4 /homepages/21/d521107727/htdocs/xxxxxxx/_new2/wire/core/Wire.php(485): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #5 /homepages/21/d521107727/htdocs/xxxxxxx/_new2/wire/modules/PageRender.module(554): ProcessWire\Wire->__call('render', Array) #6 /homepages/21/d521107727/htdocs/xxxxxxx/_new2/wire/core/Wire.php(417): ProcessWire\PageRender->___renderPage(Object(Proce (line 50 of /homepages/21/d521107727/htdocs/xxxxxxx/_new2/site/templates/_inc/header.php)
  7. maybe because of the 0 values for x and y? btw, do you do that?
  8. @joshua I'm using GoogleMapsApi on a page. And did this: <?php // allow button echo "<a class='privacywire-consent-button' data-consent-category='external_media'>allow cookies</a>"; $address = $content->map_address->address; $lat = $content->map_address->lat; $lng = $content->map_address->lng; echo "<script > var lat,lng,zoom; lat = $lat; lng = $lng; </script>"; // map stylung and render function echo "<script type='text/plain' data-type='text/javascript' data-category='external_media' data-src='{$templatesUrl}scripts/gmaps.js' class='require-consent'></script>"; // maps API echo "<script type='text/plain' data-type='text/javascript' data-category='external_media' data-src='https://maps.googleapis.com/maps/api/js?key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX&callback=initMap' class='require-consent'></script>"; // my map echo "<div id='map' class='wrapper'></div>"; When I click on the allow button, all content disappear and there is a error domain.com/:1 Uncaught (in promise) Qe {message: 'Map: Expected mapDiv of type HTMLElement but was passed null … However the cookies are allowed. So that if refresh the page, everything is fine (cookies allowed and map is shown). What am I missing?
  9. @Pixrael thanks a lot! Great Idea to find out the outdated pages with the timestamp! I learned a lot!
  10. I would like to create pages from a json feed. So i decode my json and create them via API. $jsonData = json_decode($jsonFromOtherWebsite); foreach($jsonData as $jsonDataItem) { $pageTitle = $jsonDataItem->name; $p = new Page(); $p->template = 'import_page'; $p->parent = $pages->get(xxxx); $p->title = $pageTitle; $p->save(); } Let's say the source (json) changes and i have to do another import. Then I want to compare the new json with the existing pages to see if there are new ones and if there some aren't there anymore. Is there a way to compare the new JsonData with my existing pw-pages with the API. Something like foreach($jsonData as $jsonDataItem) { // check if a page with this title exist if($pages->find("template=import_page, title=$jsonDataItem->name") { // update existing field values $getExistingPage = $pages->find("template=import_page, title=$jsonDataItem->name"); // update value $getExistingPage->setAndSave('field', $jsonDataItem->x); } else { // create new page $pageTitle = $jsonDataItem->name; $p = new Page(); $p->template = 'import_page'; $p->parent = $pages->get(xxxx); $p->title = $pageTitle; $p->save(); } } // search for pages wich are not anymore in the json and hide/delete them // …
  11. https://domain.com/_tmp/processwire/fluency/
  12. Thanks @FireWire Actually the folder is already showing up in the error message above. When i do your quick fix i get this: fluency_tools.js:60 POST https://domain.com/_temp/_temp/fluency/data/ 404 moduleRequest @ fluency_tools.js:60 (anonymous) @ fluency.js:579 load (async) (anonymous) @ fluency.js:576 VM752:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.xhr.onload (fluency_tools.js:53) xhr.onload @ fluency_tools.js:53 load (async) moduleRequest @ fluency_tools.js:52 (anonymous) @ fluency.js:579 load (async) (anonymous) @ fluency.js:576
  13. are there any known issues with pw-installations inside a folder? It works for me on a website like domain.com but not on pw-installation like domain.com/_temp/ I get this errors on a backend pageload fluency_tools.js:60 POST https://domain.com/_tmp/fluency/data/ 404 moduleRequest @ fluency_tools.js:60 (anonymous) @ fluency.js:579 load (async) (anonymous) @ fluency.js:576 VM287:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.xhr.onload (fluency_tools.js:53) xhr.onload @ fluency_tools.js:53 load (async) moduleRequest @ fluency_tools.js:52 (anonymous) @ fluency.js:579 load (async) (anonymous) @ fluency.js:576 @FireWire you hardcoded the paypalme-PNG-Url into FluencyConfig.php (line:365). It's broken. /Fluency/img/paypal_me.png > /Fluency-Translation-main/img/paypal_me.png
  14. thx @BitPoet I guess there is Typo in your Snippet. Missing closing }? However I get a 500 Error. So I tried this: <script type="text/javascript"> <?php $jsConfig = $config->js(); ?> var ProcessWire = {config: <?php echo json_encode($jsConfig); ?>}; var config = ProcessWire.config; </script> and $config->js('mySettings', [ 'foo' => 'bar', ]); but console.log(ProcessWire.config); outputs an empty array
  15. I would like to pass over a string from PHP to JS. I guess thats the way to go: https://processwire.com/api/ref/config/js/ However when i try it i get the error: Uncaught ReferenceError: ProcessWire is not defined at HTMLDocument. I think it's because of missing ProcessWire object in my js file. How do I import it?
  16. Hi @wbmnfktr, look here: https://dr-dsgvo.de/ist-mailjet-datenschutzkonform-nutzbar/ I don't know if this is a reliable source but sounds legit. And did it work for you with the WireMailMailgun?
  17. hey @benbyf, as you see above i had/have same problems. Back then i read something about issues with SSL preventing tracking.
  18. i would say the name on a profile page lacks a bit of contrast
  19. I found another solution and it works for me. First I loop through my pages and save the needed content into a helper-textarea-field. I added this helper-field into the indexed fields and this works. I guess this is not the best for the performance but it works for me. Thanks again
  20. ok, I'm a noob but I'll give it a try. I will use my loops and add the needed content to the searchindex. But where should i place this hook to run it after a page is saved in the backend?
  21. hi @teppo, thanks for the module. it's great! i have pages which are selected through a page reference field from inside a table which is inside a repeater which is inside a repeater matrix item (matrix_repeater) -> (matrix_repeater_item) -> (repeater) -> (table) -> (table column [page reference field]) -> title or text_field the search_index has already the title of those pages in it. is there an easy way to also get the other fields of the reference page inside the search_index. those selected pages have also a search_index.just to be sure you know where the pages are, here's the route i go on the frontend: foreach($page->matrix_repeater as $matrix_repeater_item) { if($matrix_repeater_item->type == 'xxxxx') { foreach($matrix_repeater_item->repeater as $repeaterItem) { foreach($repeaterItem->table as $tableRow) { $selectedPage = $tableRow->pageReference; $selectedPage->title; // this is automatically in the search_index $selectedPage->body // this should be added to the search_index } } } }
  22. wow! processWire is just amazing, thank you
  23. i need to search inside an table which is inside a repater which is inside a repeater matrix fiels so this is the structure: (matrix_repeater) -> (matrix_repeater_item) -> (repeater) -> (table) -> (table column [page reference field]) -> title or text_field $matches = $pages->find("matrix_repeater.matrix_repeater_item.repeater.table.table_page_reference.title%=$q"); is that even possible?
  24. Is there a way to search in a multilingual-site only through default language values? My selector for my other languages work like this: $selectorEn = "seo_description.data1032~=$q, limit=50, template!='pw_child'"; $selectorFr = "seo_description.data1031~=$q, limit=50, template!='pw_child'"; 1032 is english and 1031 ist french and my default language ID is 1021. However this does not work $selectorDe = "seo_description.data1021~=$q, limit=50, template!='pw_child'"; and this selector searches all languages $selectorDe = "seo_description~=$q, limit=50, template!='pw_child'"; What i want is to search and get the results in different languages and show those results in the different languages.
×
×
  • Create New...