-
Posts
1,419 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Juergen
-
Thanks! After trying some different changes it seems that the problem is situated in the interval date calculation and not in the array. $daysarray = array( "", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" ); for ($i = 1; $i < 8; $i++) { if (${"dow$i"}) { ${"dow$i"} = $daysarray[$i]; //get checked days name ${"start$i"} = new DateTime($startdate); //create start dates for every weekday ${"start$i"}->modify(${"dow$i"}); //get the first occurence of each day ${"interval$i"} = new DateInterval("P{$step}{$unit}"); //create intervals for each weekday ${"period$i"} = new DatePeriod(${"start$i"}, ${"interval$i"}, $end); //create periods for each weekday foreach (${"period$i"} as $date) { $date = $date->format('Y-m-d H:i'); $starttime = strtotime($eventstarttime); //add time in seconds to date $date = (strtotime($date)) + $eventstartseconds; ${"array$i"}[] = $date; } } else { ${"array$i"}[] = ""; } } This line of code seems to make the problems. ${"interval$i"} = new DateInterval("P{$step}{$unit}"); //create intervals for each weekday If the DateInterval is "P1D" (daily) I get the error message, if it is for example "P1W" (weekly) everthing works. It seems that the daily repeat interval makes troubles.
-
Hello @ all, I have created a module which creates pages of dates depending of your choice (event calendar like). Today I am struggeling with problem concerning the manual creation of an options fieldtype array. My options fieldtype is called weekdaysevent and it is set to multiple - so you can check one or more. It contains 7 options (for every weekday one) In the backend you can choose between different repeating types (daily, weekly, monthly, yearly) If "daily" is selected all days should be in the fieldtype array, if all others are selected only the selected one should be in the array. I have tried it the following way: if($page->repeattype->value == "D"){ //D is for the daily repeat $page->weekdaysevent = array(1,2,3,4,5,6,7); } $weekdays = $page->weekdaysevent; If daily is choosen, then all days (1-7) are in the array. If anotherone (fe. monthly) is choosen, then get the weekdays directly from the field. Unfortunately this doesnt work. I always get the following error message after pressing the save button: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'probe-termin-2016-10-04-5664' for key 'name_parent_id' This only happens if I choose daily and $page->weekdaysevent will be taken from inside the if statement. If I choose monthly or another all is working fine. I dont know why the if statement should be responsible for a dublicate entry. Can someone help me out?
-
@Robin S, many thanks. That works as expected! Great!!!!!!!!
-
Ok thanks! I will hide it with jquery.
-
Unfortunately this doesnt work. Method InputfieldPageTable::getPage does not exist or is not callable in this context 21 secs
-
Hello @ all, I am struggeling with a problem to run a hook under a certain condition. I have used a code from Soma which removes the add button from a pagetable field. public function init() { $this->buttonHook = null; $this->addHookBefore("InputfieldPageTable::render", $this, "renderPageTable"); $this->addHookAfter("InputfieldPageTable::render", $this, "renderPageTableAfter"); } public function renderPageTable(HookEvent $event){ // get the table field $table = $event->object; // make sure this is our field if($table->name !== "mypagetable") return; // if there's 2+ rows add another hook to remove returned markup string // rendered by InputfieldButton::render if(count($table->attr("value")) > 1) { $this->buttonHook = $this->addHookAfter("InputfieldButton::render", null, function(HookEvent $event){ // overwrite/remove button markup $event->return = ''; }); } } This works so far, but I need to run the code only under a certain condition. In my case: if(($page->template == "events") AND ($page->eventkindchooser == "1")) The problem in this case is how to define the page variable ($page) because the event object is used as $table = $event->object; I have tried to define the page variable as $page = $event->arguments[0]; like in other cases but this does not work. How can I define the page variable in this scenario so I am able to use the if condition? Best regards
-
Hello adrian, forget what I have written. After I have updated to the latest version this error message was gone. So everthing works fine.
-
After activating the version panel I got the following error message: Call to undefined function apache_get_version() in ......./web/site/assets/cache/FileCompiler/site/modules/TracyDebugger/ProcesswireInfoPanel.inc on line 408 Edit: Its still there after disabling the version list, so its maybe a problem with the latest version.
-
Thanks at all, I have solved it like this: <?php namespace ProcessWire; use \DateTime; and then $end = new \DateTime($enddate);
-
Hello @ all, I have created a module which works with dates. I have the following 2 lines of code in my module: 268: $enddate = '2006-12-12'; 269: $end = new DateTime($enddate); If I check the module with Tracy it gives me always the following error: I dont know why the new DateTime class will not be found because it is a standard PHP class. I have added the PW namespace at the top of the module, but it doesnt make any difference whether I add it or not. I am not a PHP pro, so can somebody give me a hint why this leads to an error message? I need this to create time intervals afterwards. Best regards
-
Positive sideeffect ! Great!
-
Hi adrian, it works now as expected!!!! Thanks!!
-
Hello adrian, thanks for your response. I am sure that it should be the limit. For testing the site with guest access I have adust my settings to show the toolbar also for non logged in users (especially for testing some features which are also reachable without being logged in). In this case you will reach the limit quite fast. I will turn this back and I will see how it behave. It is not a real problem. As for the tracy-debub divs I can say that they were not validated in the panel. This behaviour is only by clicking the link directly. I will test it for a while without showing the toolbar on frontend for non logged in users and post the result here afterwards.
-
I dont know! If I click the link directly I can open the validator page. Could there be a maximum of queries responsible for this behaviour. It also shows me the Tracy toolbar divs as error if I click the link manually.
-
Hello adrian, I have discovered a problem with the HTML-validator: I always get this message if I try to validate a page. I use the latest PW(3.0.33) and the latest TracyDebugger. I have added this panel permantently and my pages are always reachable. Can you confirm this behaviour? Best regards
-
Yes, of course. I always like it if there is a clean directory structure. So I have a folder for CSS, JS, widgets, inc and so on. It makes life easier too.
-
One thing to mention. I would add an inputfield for the cke.js and cke.css path, so everyone can write the path to those files in a custom way. In this case you are able to put the css and js files in a subfolder of your choice instead of directly in the templates folder where all the template files are located.
-
I really enjoy the CKEaddons. Till now I have always installed the addons manually but AOS makes my life much easier from now on. Thanks!!
-
These are all required fields. I know that yellow is not the best color. I have only tested it to make required fields more visible for the author. Non required fields are with no colored background.
-
Another usage example: I use it for an event calendar. On the left side is all information about the event as text. In the right column are all settings for the event (single or recurring event, start, end, price,...)
-
Great work @tpr One thing to mention: It is possible to add 1 column break field to a template. But it is not possible to add it fe to tab1 and tab 2 if they are present, because only one field will be created, right? Best regards
-
Works fine now! Thanks!
-
Hello Adrian, I have got the following error message after trying to add a child page. Can you check this please. PW 3.0.33, latest PageRename Module version, the child page is excluded in this case. Thanks
-
Maybe the reason was that I have put the search fields into a string. $downloadfields = "downloadrepeater.downloadfiledesc|downloadrepeater.downloadfieldtitle"; After that I have added this variable to the search tag and then I got the errors. "$downloadfields~=$q" Now I have added it manually to the search string and now everything works fine. "downloadrepeater.downloadfiledesc|downloadrepeater.downloadfieldtitle~=$q"
-
I have tried to include a repeater field called "downloadrepeater" with the included fields "downloadtitle" and "downloaddesc", but including these fields leads to an error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? (in /home/.sites/24/site1275/web/wire/core/Selectors.php line 307) I have included these fields like that: "downloadrepeater.downloadfieldtitle|downloadrepeater.downloadfiledesc~=$q" After removing these fields from the search query everthing works fine again.