-
Posts
1,306 -
Joined
-
Last visited
-
Days Won
13
Everything posted by Juergen
-
Hello @ all, I have a general translation file with over 500 phrases. I want to change the file location to a subfolder (for better structuring). What is the best way to accomplish that without re-translating all the phrases again. For the moment I have copied all the files to the new translation file and I have changed the file path at the beginning of the json file, but this doesnt work.
-
Thanks adrian. So for lower PHP versions you have to write: $page->set('siteviews', ($page->siteviews)? 0: + 1); Is this correct?
-
This gives me an error: unknown ??
-
You are right. I use the InputfieldChosenSelect.module but it is used inside the fieldtype Page to render multiple selects. It doesnt matter if I use InputfieldChosenSelect, PageListSelect or another possibility of this fieldtype - the link text is always the same. Here is a sceenshot of another option of this fieldtype: This link is not part of AdminPageFieldEditLinks it is part of the fieldtype Page where you can choose if a link to create new pages should be visible or not.
-
OK I solved it: if($page->repeattype->value == "D"){ $step = "1"; $unit = "W"; } else { $step = $page->steps; //Number for the interval $unit = $page->repeattype->value; } If it is a daily repeat set the steps and the interval automatically to 1 and W. Otherwise take the values from the input fields.
-
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.