Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by ro-bo

  1. Thanks! That's exactly what I'm looking for ?
  2. Hello dear forum members! Is it actually possible to manipulate images that are in the file system and not stored within a field using the PW methods etc. (similar to the Methods for Pageimage)? I mean something like e.g. // $assetsImage is a File form e.g. urls('templates').'assets/artworks/logo.png' $assetsImage->size(200, 200) Probably there are already 1000 forum entries for this anyway but I probably didn't enter the correct search terms for my problem ... I would be happy if someone had a quick solution for this. Best regards, Robert
  3. @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
  4. By the way. Does anyone have a similar display problem in firefox and chrome regarding bolt icon for hookable methods? See the screenshot below.
  5. 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
  6. 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
  7. 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 ?
  8. 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
  9. 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
  10. 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/
  11. 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
  12. 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
  13. Hi Robin. As expected, the sorting works perfectly now! Thanks, Robert
  14. 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
  15. 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
  16. 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
  17. 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
  18. Hi Bernhard, read and try his: http://osvaldas.info/drop-down-navigation-responsive-and-touch-friendly In the lower section of this page you can download this code doubletaptogo. I use this code in almost every project where a flyout navigation occurs. Robert
  19. Hi everyone. I'm working on a site where only a few pages are multilingual. The default language is German. Some pages should be available in English. Only these pages have a language switcher, depending on whether the english language is activ in the settings for this page. Nearly everything works fine but if I switch from an page where English language is active to another page where only german language (default) is activated (by page settings) the URL and $user->language is still english although the page should only be available in German. I think that leads to double content in Search Engines and other problems in Page view (e.g. some fields in Template have English Content and others are only german). What's the best approach for this issue? I currently have it resolved like this: if (!$page->viewable($user->language)) { $user->language = $languages->get('default'); $session->redirect($page->url, false); } How would you do that? Just by the way: Would the HTTP 302 redirect be OK in this context or is it better to send a HTTP 301 redirect? Thanks in advance! Robert
  20. Wonderful! Thanks Ryan, thank you LostKobrakai!
  21. Hello LostKobrakai! Great, now it works fine. No DB-entries and no value! But then it is a bug in the "FieldtypeOptions" class, isn't it?
  22. Please help me on my way . Can anyone replicate it?
  23. Hi LostKobrakai. Thanks for your answer. Here is a step-by-step guide: 1. Download Processwire 2.6.1 Master from http://processwire.com/download/ 2. Upload PW with site-blank profile to Server 3. Install PW 4. Login to PW-Backen 5. Modules -> Core -> Select Options -> Install 6. Setup -> Fields -> Add New 7. Basics Tab -> Name: test -> Type: Options -> Label: testfield 8. Details Tab -> Select (Single Value) -> Selectable Options: test1 (new Line) test2 (new Line) test3 9. Actions Tab -> Add Field to Template "Home" 10. Save (Add Field after title) 11. Pages Tab -> Home -> edit 12. Choose test1 -> Save 13. Choose "blank" (no Value/Option) -> Save 14. Now I check the Database and there are 2 Entries for the same page_id 15. open home.php with an editor -> write "echo $page->test;" under "include("./basic-page.php");" -> Save and upload it to the server 16. Open the Home Page (Frontend) with browser -> the echo command outputs "1|3" means 1 for the first Entry and 3 for the last entry. If I add an Option (see step 8) e.g. test4 the echo command outputs "1|4" aso. I have not done anything else! Meantime I tested it on two different Servers (My Local Server and EDIS-Provider where some PW-Pages run successfully) and the phenomenon continues to exist. I think (and Ryan confirmed it in the poste further above) that it's unusual -> the echo command should output no value (blank) instead of "1|2" or "1|3" ... Best Regards Robert
  24. Hello again! Now I made a new/blank installation without "multi language" or any other modules except the "Select Options Field". I didn't make any new fields or templates beside an Option-Field called "testfield". Unfortunately with this new installation I can reproduce this issue too... In the attachment you can find some screenshots from database, PW-backend and frontend-output with <?php echo $page->testfield; ?>. I have already mentioned that this issue appears, when I firstly choose one option and save the page -> then I set it back to blank and save it again. Does anyone have any idea?
  25. Hello Ryan, thanks for your answer and I'm sorry for this late reply. It's strange... I don't have the "required" box chekced and I also don't have added a blank option. I don't understand why I get "1|2" aso. after choosing "Blank" and why there are 2 entries for the same page_id in DB. I think it's not the code how I'm checking the value (I'm familiar with PHP and MySQL), and my code is a little bit to extensive to post it here (it's splitted in many files with functions -> yes, I'm using wire('pages') instead of $pages...) ... sorry. There are a lot of option-fields in my project and I always get the same issue... Here is an example of my settings in the "what are the selectable options" textarea (3 different Languages): DE: 1=EZ 2=DZ 3=DZ/Familie 4=SUITE EN: 1=single 2=double 3=double/family 4=suite/family FR: 1=individuel 2=double 3=double/familiale 4=suite/familiale The "required" box isn't checked, and I'm using it as select-single value. I have to admit that I have installed and uninstalled a lot of Modules in the meantime - perhaps it's the reason why I have these problems...? Many thanks for PW!
  • Create New...