Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

17 Good

About LAPS

  • Rank
    Sr. Member

Recent Profile Visitors

664 profile views
  1. I have a similar problem too: sending the email sometime does work and sometime it doesn't. In Admin > Setup > Logs > Wiremailsmtp_errors I get: Error in hnsmtp::send : 550 5.1.0 lpSZ2001L2kwbrt01pSZZZ invalid domain But in Admin > Modules > Wire Mail SMTP the test settings appear to work correctly. What could the problem be?
  2. SOLVED: // Attempt X $result = $pages->find("template=template_children_name, field_children_name=$page->id, parent=[field_parent_name=1], sort=-parent.field_parent_sort_name"); A minus sign to put in front of parent at the first attempt: sort=-parent.field_parent_sort_name
  3. Hi, I find pages by using something as like the following: $result = $pages->find("template=template_children_name, field_children_name=$page->id, parent=[field_parent_name=1]"); I would like to sort the result by a parent field, say field_parent_sort_name, to output an ordered list. I tried the following without success: // Attempt 1 $result = $pages->find("template=template_children_name, field_children_name=$page->id, parent=[field_parent_name=1], sort=parent.-field_parent_sort_name"); // Attempt 2 $result = $pages->find("template=template_children_name, field_children_name=$page->id, parent=[field_parent_name=1], sort=-field_parent_sort_name"); // Attempt 3 $result = $pages->find("template=template_children_name, field_children_name=$page->id, parent=[field_parent_name=1, sort=-field_parent_sort_name]"); // Attempt 4 $parents = $pages->find("template=template_parent_name, template_children_name.field_children_name=$page->id, field_parent_name=1, sort=-field_parent_sort_name"); // $parents are sorted // Attempt 4.1 $result = $pages->find("template=template_children_name, parent=$parents"); // Not sorted as $parents // Attempt 4.2 $result = $pages->find("template=template_children_name, parent=$parents, sort=parent.-field_parent_sort_name"); // Not sorted as $parents // And some other attempts ... What's the issue? How can I sort result by the parent field?
  4. Any news on the @dragan approach? I also created a dedicated topic.
  5. Hi, I'm using $config->pagefileSecure = true and I'm still looking for the best solution to allow guests to access protected page's assets (in my case some images) since the @BitPoet solution/approach seems to cause a lot of loading when rendering the front-end. So, based on the @dragan answer, I would like to try his solution/approach to temporarily add permission to access protected page's images. The question is: how to temporarily add permission to access protected page's images?
  6. Hi, in my template file I state the following code: // File: template_name.php $files->include('path/to/filename', array( 'key1' => "Some text value 1", // e.g. $page->title 'key2' => "Some text value 2", // e.g. $page->getLanguageValue('default', 'title') 'keyN' => "Some text value N" )); In path/to/file_name.php I state the following code: // File: path/to/file_name.php $key1 = $vars['key1'] | "Default1"; $key2 = $vars['key2'] | "Default2"; $keyN = $vars['keyN'] | "DefaultN"; // ... echo $key1 . "<br>"; echo $key2 . "<br>"; echo $keyN . "<br>"; // ... When I render the above code in the front-end then I get the text values changed! That is, it outputs something like the following: Rdfs~{{ value1 GDdfgsd value2 dfd]~df value3 Am I doing something wrong? Update In path/to/file_name.php just use ?: instead of |, this way: // File: path/to/file_name.php $key1 = $vars['key1'] ?: "Default1"; $key2 = $vars['key2'] ?: "Default2"; $keyN = $vars['keyN'] ?: "DefaultN"; // ... echo $key1 . "<br>"; echo $key2 . "<br>"; echo $keyN . "<br>"; // ... PHP matters...
  7. First of all, thank you for your module. I'm using the PW FormBuilder module embedding forms in <iframe> HTML tags. When a user accesses for the first time the page that has an "iframed" form then the user sees two EU-Cookie-Law messages, one under the page (BTW I set the EU-Cookie-Law message position to bottom) and one under the form (BTW This causes the message to override the submit button). I'd like to do not show the EU-Cookie-Law message under the "iframed" form but only under the page. How can I make that (e.g. by using selectors for the "iframed" form-page)? Update Perhaps I found a solution: I think the first solution is better than the second one... but how will this affect the performance of the web site (if it will do)?
  8. Hi, I've a multi-language text field which label is overridden in the template to "Label English" and "Label Italian". I'd like to output the overridden Italian version when accessing the link http://www.website.com/it/. I tried the following without success: // output a blank value $page->text_field_name->label; $page->get('text_field_name')->label; // get the error: "Error: Call to a member function getLabel() on string" $page->text_field_name->getLabel(); $page->get('text_field_name')->getLabel(); // output the not overridden, translated value $page->fields->text_field_name->label; $page->fields->text_field_name->getLabel(); $page->fields->get('text_field_name')->label; $page->fields->get('text_field_name')->getLabel(); How can I output the label overridden in the template? Update I ended up using: $page->fields->getFieldContext('text_field_name')->getLabel(); Is it the correct way to get the overridden, translated label? Or is there some better?
  9. Hi, I've the function: function functionName(Page $item) { // function code } If in templates I use the code functionName($pages->get($id)); then in the logs I get the error "Argument 1 passed to functionName() must be an instance of Page, instance of ProcessWire\Page given, called in ...". However I don't get the error by removing the Page type from the function statement. Why does it happen?
  10. I enabled multi-language support in my website and I am looking for a easy way to output page values (e.g. throughout an entire .php file) in a desired language without using $page->getLanguageValue('default', 'title')everytime I need to output a page value. I thought of finding a page in a given language by using something like $pages->findOne($id, ['language' => 'italian']) or setting someway a "language context". What do you thing about? How can I make that?
  11. Hi, I'm translating my website (in particular, FormBuilder template files) using Code Internationalization (i18n). When I use this code: <?php echo sprintf(__('Some text and <a href="%1$s">link</a>'), 'http://www.link.com'; ?> then it outputs plain text: Some text and <a href="http://www.link.com">link</a> How can I output the above string this way (no plain text): Some text and link? Update I will use html_entity_decode(). What do you thing about?
  12. How do you translate the string? That is, where do you put English and (in my case) Italian strings (I see only the English one in file /site/translations.php)? What do you think about this solution?
  13. Hi, I've successfully installed and used Language Support & Co. and Functional Fields modules so that I can translate almost all the strings of my website in English (default) and Italian. Now, in my template files I've "See also" strings that I would like to translate globally (not per template by using Functional Fields). How should I make this? I read the doc and maybe what I need is to use the textdomain, but I didn't understand how to use it. That is, what text/code should be in the file? any example? Also, in the admin area I have the menu items Default and Italian under Setup > Languages. Once accessed one of them, there is the field "Site Translation Files" with the description: "Use this field for translations specific to your site (like files in /site/templates/ for example)". Should I use this field (instead of textdomains) to set globally translated strings? If so, what text/code should be in the file? any example?
  14. By using an array to define module configuration (PW new module configuration) I partly solved the issue of configuring the Page Reference field because data is not saved: array( 'name' => 'selectedPages', 'type' => 'page', 'label' => $this->_('Selected pages'), 'description' => $this->_('Selected pages description).'), 'inputfield' => 'InputfieldCheckboxes', 'derefAsPage' => 0, 'collapsed' => 0, 'optionColumns' => 0, 'labelFieldName' => '.', 'labelFieldFormat' => '{name}', 'findPagesSelector' => 'template=named-template, include=all', 'allowUnpub' => true, 'required' => true, 'defaultValue' => 1985, 'notes' => $this->_('Selected pages notes'), // I tryed to set value to '', [] and $this->selectedPages without success 'value' => ???, ) How should I configure the page checkboxes field to store data submitted from the module page? Update: I found a possible solution here.
  15. @bernhard, thank you for remembering me to use Tracy Debugger. 😉 Assuming the Tracy field settings and field code panels that you mentioned are in the "Request info" tab, when I expand the "Field List & Values" link in it, then it doesn't list the Page Reference field that in my case is not working (the field shows the error message above). In fact, only 'title' and 'process' fields are shown.
  • Create New...