Jump to content

ngrmm

Members
  • Posts

    421
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by ngrmm

  1. Looking for someone to link a website to an (AWS) S3 server to get videos via presigned URLs.
    The website is an archive and each archive item (page) is linked to a video.

    Things to do:

    1. You will get VPN-connections  to the website and the S3-server
    2. Setup a Bucket on the Server
    3. Uplaod a Test-File (mp4 file)
    4. Link video page to the mp4 test file on S3-server via AWS SDK for PHP


     

    • Like 1
  2. On 10/5/2016 at 3:19 PM, Bacelo said:

    Actually I can't unistall the module "TemplateEngineFactory" as the template relies on this :(
    I'll continue having a deeper look into and try to cut it down.

    @Bacelo did you find any solution back then?


     @Roope I'm using PW 3.0.200 and it looks like the module is stuck somewhere in the process.
    Script is not added automatically. When I add it manually it does not find anything in the document.
    So with script added manually and using $sanitizer->emo($string) it find the email and replace it completly with a noscript tag.

     

    • Thanks 1
  3. On 8/4/2022 at 6:01 PM, teppo said:

    Thanks for reporting the issue, @ngrmm. This should be fixed in SE 0.35.1.

    I wasn't able to reproduce this issue myself, so please let me know if the problem still persists and I'll be happy to take a closer look ?

    yes, your update fixes the issue, thanks!

    • Like 1
  4. @teppo I get this error when I add a repaterMatrix field to indexed fields

     

    TracyDebugger:
    
    TypeError
    
    SearchEngine\IndexValue::__construct(): Argument #1 ($value) must be of type string, null given, called in /…/htdocs/domain.com/_NEW/site/modules/SearchEngine/lib/Indexer.php on line 297 search►
    
    ––––
    
    File: .../domain.com/_NEW/site/modules/SearchEngine/lib/IndexValue.php:33
    
    23:         *
    24:         * @var array
    25:         */
    26:        protected $meta = [];
    27:    
    28:        /**
    29:         * Constructor
    30:         *
    31:         * @param string $value
    32:         */
    33:        public function __construct(string $value = '') {
    34:            $this->value = $value;
    35:        }
    36:    
    37:        /**

    using pw 3.0.200 © 2022, search engine 0.35.0  and php 8

    • Like 1
  5. @joshua does privacywire log user clicks?
    As far as I understood you must have a „consent log“.
    „… By default, consents collected through the Cookie Notice banner and/or the Privacy Notice link are automatically logged so that you can access the information at any time. Your consent log is basically a list of users who interact with the banner by either consenting or declining to the use of their information.“

    CookieBot for example does this:
    „Cookiebot CMP stores the user's selection for 12 months, after which the banner automatically reopens to renew the user's consent. …

    All user consents are automatically logged in anonymized form and encrypted. A data processing contract (DSGVO) is not required. The consent log can be downloaded from the manager and used for documentation.“

    or cookiehub: https://www.cookiehub.com/de/produkt/premium/einwilligungsprotokoll

  6. I have a page which imports external json-feed into pages and would like to run this page every day. The Problem is that the import take 10–20 seconds.

    Is there a way to trigger this import from any other page and let in run in the background? I would like to avoid slow pageloads of other pages, even if it's once a day.

  7. I use the explode function to generate a json-feed like this

    $list = $pages->get(1234)->children;
    $toJSON = $list->explode(function ($item) {			
    			return [
    				'title' => $item->title,
    				'id'    => $item->id,
    				'start' => $item->summary, 
    			]
    		  }

    But i would like to use the sanitizer on the summary field. Like this:
    Obviously this can not work. But how can sanitize the summary before the output?

    $list = $pages->get(1234)->children;
    $toJSON = $list->explode(function ($item) {
    
    		// $itemSummary = $sanitizer->truncate($item->summary, [
            //     'type' => 'punctuation',
            //    'maxLength' => 155,
            //    'visible' => true,
            //    'more' => '…'
            // ]);
    
    			return [
    				'title' => $item->title,
    				'id'    => $item->id,
    				'start' => $itemSummary, 
    			]
    		  }

     

     

  8. 1 hour ago, FireWire said:

    I haven't experienced that. I don't often use tables and can't remember if I've seen that.  Fluency wouldn't be able to change how a field is rendered. 

    Looks like it's not possible. It says:

    • settingsField: Specify a PW field that uses CKEditor to use for the settings of this column. Note that inline mode is always used, regardless of field settings.
    • …

     

  9. 10 minutes ago, Zeka said:

    @ngrmm

    By the way, you can try to use $pages->findRaw https://processwire.com/api/ref/pages/find-raw/, like 

    wireEncodeJSON($pages->findRaw('template=some-template, parent=1234,', ['id', 'title', 'tags' => ['id', 'title']);

     

    Actually this is perfect, as I don't need all the page data. But unfortunately it outputs the page ID as key, what don't want to have.
    Maybe there will be some options in the future to change this default behaviour.

    Thanks @Zeka anyway, the other solution works perfectly!

  10. 14 minutes ago, Zeka said:
    $list = $pages->get(1234)->children;
    $toJSON = $list->explode(function ($item) {
    	return [
    		'title' => $item->title,
    		'id'    => $item->id,
    		'tags'  => $item->tags->explode(['id', 'name', 'title'])
    	];
    });

     

    wow much easier than i thought. And what is the correct syntax to go more levels deeper? Let's say one my tags has also page-reference-field itself.
     

  11. 7 minutes ago, Zeka said:

    Hi @ngrmm

    $list = $pages->get(1234)->children;
    $toJSON = $list->explode(function ($item) {
    	return [
    		'title' => $item->title,
    		'id'    => $item->id,
    		'tags'  => [
    			'ids' => $item->page_field->explode('id')
    		]
    	];
    });
    
    wireEncodeJSON($toJSON);

     

    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?

  12. 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;

     

  13. 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!
     

     

    • Like 6
  14. On 12/21/2021 at 6:26 AM, dadish said:

    Hi @ngrmm. I suggest you to start debugging the request from your template. Depending on how you are sending the request, first try to simply echo it. In your template, simply echo back the graphql request. Could look something like this.

    <?php
    
    echo $input->post('query');
    
    // Or:
    // echo $_POST['query']
    
    // Or:
    // $rawBody     = file_get_contents('php://input');
    // $requestData = json_decode($rawBody ?: '', true);
    // echo $requestData['query']

    @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);
    		}
    	);

     

  15. {"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');

  16. 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)




     

  17. @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?

  18. 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
    // …

     

×
×
  • Create New...