Jump to content

ro-bo

Members
  • Content Count

    41
  • Joined

  • Last visited

Community Reputation

10 Good

1 Follower

About ro-bo

  • Rank
    Jr. Member

Contact Methods

  • Website URL
    http://www.weissgrad.at

Profile Information

  • Gender
    Male
  • Location
    Austria

Recent Profile Visitors

1,712 profile views
  1. @bernhard ProcessWire has a feature to track changes. If there are no changes unneeded hooks do not get fired ... of course that makes sense! Silly me, it was because I wasn't making changes to the repeater when testing, there for it wasn't firing saveReady... Of course i missed the very last sentence down there! Thanks a lot for the help! Robert
  2. By the way. Does anyone have a similar display problem in firefox and chrome regarding bolt icon for hookable methods? See the screenshot below.
  3. Hello and thanks a lot for your answers. I already knew some of the posts, but I could not solve my special problem with the solutions there. I have tried a lot now and noticed that field values with Pages::saveReady seem to change only if you actually make an entry in the PW backend and save the page. Existing field values which already exist before the hook is included (and remain "untouched" in the backend) are not changed when the page is saved. ProcessPageEdit::buildForm also works if the field input already exists and has not been changed by PW backend before saving. That's why I thought this didn't work. Something similar I've written here : Please let me know if this is total nonsense what i am writing here. I am not really familiar with hooks. Robert
  4. I had a similar problem. The following didn't work in my case: If there are already incorrect values in a repeater field (e.g. from previous entries), the hook Pages :: saveReady doesn't seem to work. Pages :: saveReady changes the repeater field only if the input is changed via backend and then saved. In other words: existing field values are apparently not checked or changed changed with Pages :: saveReady, unless the filed value is also changed in the backend. ProcessPageEdit :: buildForm also works with existing field values (contaminated areas 🙂) See this entry: Maybe I could be of some help here. Or maybe I'm completely wrong. Robert
  5. Thanks for your input. But unfortunately that doesn't work either ... I've already tried it. Somehow I think that couldn't work because the field to be saved is the repeater and not only a field in the repeater itselfe. My next assumption is that it would have to work very differently than my current approach, since repeaters are saved as templates in the database. In my example above as temlate 'repeater_my_repeater'. Unfortunately, I don't know how to store the fields value within the repeater via API / hook. Therefore I still ask for your help or at least a hint 🙂
  6. Hello androbey! Thanks for your answer. Unfortunately nothing happens. The only error message is my own WireException. The goal is that the field (represented by the variable $dateEnd) with the wrong input should be empty after saving the page in PW. I've already tried that: ... $repeater = $page->my_repeater; ... if ( $dateStart && $dateEnd && $dateStart >= $dateEnd ) { $page->of(false); // and of course 'true' too :-) $repeater->save(); throw new WireException('start date must be earlier than end date'); }//endif ... Robert
  7. Hi there! I am unfortunately unable to change (empty) the entry of a repeater field via a hook in ready.php. wire()->addHookAfter("Pages::saveReady", function (HookEvent $event) { $page = $event->arguments("page"); if ( $page->hasField('my_repeater') ) { $repeater = $page->my_repeater; foreach ( $repeater as $item ) { $dateStart = $item->date_start; $dateEnd = $item->date_end; if ( $dateStart && $dateEnd && $dateStart >= $dateEnd ) { // $page->of(true); // that doesn't help either $dateEnd = ''; // !!!! that dosen't work !!!! throw new WireException('start date must be earlier than end date'); }//endif }//endforeach }//endif }); What am I doing wrong? I've tried so much, read the documentation, searched the forum and google, but I can't find a solution. Please help me 🙂 Robert
  8. Thanks, that's it!☺️ Now of course I've found that too ... https://processwire.com/talk/topic/22516-when-using-js-fetch-it-seems-config-ajax-is-ignored/
  9. Hi there. I have an annoying problem with a page where I load content dynamically with AJAX. (ProcessWire 3.0.148) I'm using MarkupRegions with the following code fragments: PHP template-files // +++ _main.php +++ if( !$useMain || $config->ajax ) return; ... // +++ page with the dynamic AJAX content +++ ... if ($config->ajax) { wireIncludeFile('./_includes/wine.inc.php', $arrOut); return $this->halt(); }//endif ... JS file // +++ main.js (function(){ var dynamicModals = document.querySelectorAll('[data-toggle="ajaxModal"]'); if (!dynamicModals.length) return; for (var i = 0, len = DynamicModals.length; i < len; i++) { dynamicModals[i].addEventListener('click', function(e) { e.preventDefault(); var url = this.getAttribute('href'); var ajaxModal = document.getElementById('ajaxModal'); if( ajaxModal ) { var modalDiv = AjaxModal; } else { // +++ modal var modalDiv = document.createElement('div'); modalDiv.id = 'ajaxModal'; modalDiv.setAttribute('data-uk-modal', ''); modalDiv.classList.add('uk-modal-center', 'uk-flex-top', 'uk-modal'); document.body.appendChild(modalDiv); }//end if var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var modal = document.getElementById(modalDiv.id); var data = this.responseText; var html = '<div class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical">'; html += '<button class="uk-modal-close-full uk-close-large" type="button" data-uk-close></button>'; html += data; html += '</div>'; modal.innerHTML = html; UIkit.modal(modal).show(); } }; xhttp.open('GET', url + '?q=notUsed', true); xhttp.send(); }); }//endforeach })(); The problem is that sometimes the $config->ajax does not work or is ignored and the entire _main.php template file is loaded with AJAX-request. No error is displayed in the browser console. The content is also shown in the modal box, only sometimes with the data of _main.php. I've tried so much, but nothing helps! Does anyone have a similar problem??? Robert
  10. Hi. I have a problem with the "link field" and PW 3.0.96 . When I try to select a page (page tree) the "Choose" button disappears. Unfortunately it is no longer possible to make a selection. Does anyone have the same problem or a quick solution for it? I think the error is not the module, but the file "ProcessPageList.js" Thanks, Robert
  11. Hi Robin. As expected, the sorting works perfectly now! Thanks, Robert
  12. Hi Robin, thanks for your reply. I think it‘s exactly what I‘m looking for. I will try it in the next few days... Thanks, Robert
  13. Hi, Is there an easy way to change the sorting of the template-selection when adding pages (Page Add Process)? It would be nice if sorting in the select-field is by template-title instead of template-name... E.g: 01 - Templatetitle 1 02 - Templatetitle 2 ... Thanks
  14. Hi, in my new project there are some pages which are only included in an overview page by $page->render($options) and can not be shown as an independent page, I'll call them "sections". I'm using the limit-selector string and the pagination... Now I would like to refer to special sections which are split by a pagination--> e.g. RSS-link should look like this: domain.tld/sub/page3 Actually I solved it this way: rss.php template foreach ($items as $item) { $item_parent = $item->parent; if ($item->template == 'my-section-template') { $limit = 3; $children = $item_parent->children('sort=sort'); $item_pos = $children->getItemKey($item) + 1; $pagination_nr = ceil($item_pos / $limit); $item->httpURL_mod_wg = $item->parent->httpURL . 'page' . $pagination_nr; }//end if } module modification (the bad way, I know): protected function renderItem(Page $page) { .... if(!$page->httpURL_mod_wg) $page->httpURL_mod_wg = $page->httpUrl; // inserted by WG $out = "\t<item>\n" . "\t\t<title>$title</title>\n" . "\t\t<description><![CDATA[$description]]></description>\n" . $pubDate . $author . "\t\t<link>{$page->httpURL_mod_wg}</link>\n" . // $page->httpUrl modified to $page->httpURL_mod_wg "\n\t<guid>{$page->httpURL_mod_wg}</guid>\n" . // $page->httpUrl modified to $page->httpURL_mod_wg "\t</item>\n"; return $out; } It would be nice if there was a way to modify the <link> and <guide> urls for each Feed Item! Or maybe someone has a simple solution for this? Thanks Robert
  15. Hi tpr, The actual JQuery version has 94,8 KB. I think that shouldn't be a problem today (pictures are usually much larger). Only an inefficient way of using JQuery could be a problem in some cases... Robert
×
×
  • Create New...