kreativmonkey
Members-
Posts
56 -
Joined
-
Last visited
kreativmonkey's Achievements
-
Leraje started following kreativmonkey
-
kreativmonkey started following Change date by API issues and Code problems after update 2.6 to 3.0.4
-
Code problems after update 2.6 to 3.0.4
kreativmonkey replied to kreativmonkey's topic in General Support
Yes if i use normal if/else the code will accepted. But why dose the code never work with the new PW? Hi @adrian, i updateted to the 3.0.42 sorry for the confusion! I use the new ProcessWire Core (Master). @gebeer, i don't know if the PHP namespace solve my issue, it is a lot of work to include it on all template files and i think it is not the best practice, right? -
Code problems after update 2.6 to 3.0.4
kreativmonkey replied to kreativmonkey's topic in General Support
@gebeer no i don't add some lines to my code i only update processwire to 3.x not more. I don't touch my code between the update and the code works for me for 2 years.... When i add the namespace i must change some of my code right? I add the line to the function.php and this happened: Fatal error: Uncaught Error: Call to undefined function renderSidebar() in processwire/dev/site/assets/cache/FileCompiler/site/templates/home.php:75 Stack trace: #0 processwire/dev/wire/core/TemplateFile.php(268): require() #1 [internal function]: ProcessWire\TemplateFile->___render() #2 processwire/dev/wire/core/Wire.php(374): call_user_func_array(Array, Array) #3 processwire/dev/wire/core/WireHooks.php(549): ProcessWire\Wire->_callMethod('___render', Array) #4 processwire/dev/wire/core/Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #5 processwire/dev/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array) #6 [internal function]: ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent)) #7 processwire/dev/wire/core/Wire.php(374): call_user_func_array(Array, Array) #8 / in processwire/www.mta-r.de/dev/site/assets/cache/FileCompiler/site/templates/home.php on line 75 -
I have some code in my template that works fine for my. Now i upgrade to 3.0.4 and i've got this error: Parse error: syntax error, unexpected ':', expecting ',' or ')' in processwire/dev/site/assets/cache/FileCompiler/site/templates/_function.inc on line 106 The code on my _function.php is a short if else: $template = $small ? new TemplateFile($config->paths->templates . "markup/events.inc") : new TemplateFile($config->paths->templates . "markup/event.inc"); PHP Version: 5.6 and 7 shows the same issue. On my productive installation the code works fine with the same PHP Versions (Processwire 2.6.0). What has changed that the code no longer works?
-
thanks for your answere. So i'm looking to do other logic for my module, thanks.
-
I'm working on a notification Module that hooks into Page::saveReady . Then i will check if a page is New, Changed or Deleted to notify with different text and filter the right template. I'm working on a notification Module that hooks into Page::saveReady . Then i will check if a page is New, Changed or Deleted to notify with different text and filter the right template. public function hookPageSave(HookEvent $event){ $page = $event->arguments[0]; $template = $page->template; $templates = $this->notificationChange; // if page have no id => return if(!$page->id || !$page->title) return; // Check if page is Deleted if($page->isTrash()){ if(!in_array($template->name, $this->notificationDelete)) return; $this->log->save('debug', "Page is Deleted: $page->title"); //$this->hookPageDelete($event); return; } if($page->isNew()){ if(!in_array($template->name, $this->notificationPublish)) return; $this->log->save('debug', "New Page: $page->title"); return; } // Check if page is Changed if($page->isChanged() && !$page->isNew()){ if(!in_array($template->name, $this->notificationChange)) return; $this->log->save('debug', "Page Changed: $page->title"); //$this->hookPageChange($event); return; } i create a new post and if i publish this post i've got false on the $page->isNew() call. I worked around a little bit but i don't know how i can find out if a page is new ore just changed. For trigger changes i must change the hook to Page::saveReady (from Page::saved) but what do i need to trigger if the page is new?
-
Need help to create my own Fieldtype
kreativmonkey replied to kreativmonkey's topic in Module/Plugin Development
@flydev, that is exactly what i have done now. For a few minutes my module works and stores data on the table but now i have an issue and i don't find out what happens. I'll finish the job for now and see what tomorrow brings @Craig A Rodway, this is exactly what i'm doing currently. I have a field for each information on my router page but i think its much better for performance to bring this information in one database table. The second Idea is to publish my work for other communitys who want to do the same. At the moment i have a module that calls an external server and get a json with lot of data. I filter this data and store the information for each router/node in the page. That works fine and now i would like to complete my work and add one field for this information. -
Need help to create my own Fieldtype
kreativmonkey replied to kreativmonkey's topic in Module/Plugin Development
Hi Robin, thanks for your answer. Sorry for my bad english it is not so easy to express my situation. The Code is really well commanded but i have problems to filter out the core parts that i need. On my page (it's a page for a unsalaried project) i need to save data for a page in a lot of text fields, no repeat, no multiple only 1 field for 1 information but this information are from the same group. I'll try to explain. On the project we have a list of nodes (routers), each router are a page and now i get information to each node from a external api. This informations are all "nodeinfo" and contains IP addr, Lat, Long, Hardware, Firmware, Connection time.... At the moment each information is stored on a separate text field and in a separate database table. I think that it is much more efficient when i store this information on one database table, is it? I don't want to use profield ore get a job done. I ask for a learning exercise. I find it easier to read a manual as to analyse only the code. For constructing modules there are many such introductions like this: http://processwire.com/api/modules/ ore this: -
First thanks of all the answer! That is the solution i'm searching for! Without checking the creadetUser and session user ;-). Thank you!
-
I use the page-edit-created Permission for the blog that users can only edit there own post. At the front end i've displayed a pencil in the user Menu for all pages where the user can edit. I started with ``wire('user')->hasPermission('page-edit', $page)`` that works fine for all pages where the user has permission to edit but not at the blog! At the Blog the pencil will shown to booth, article from the user and article from other users. When the user click this link, he got the message that he hasn't access to edit this post. I think that ``wire('user')->hasPermission('page-edit', $page)`` should check if user has permission to edit THIS page. Wrong? Is there another way i don't know? To check the author (created User) ID is no option because on other templates the user has permission to all pages!
-
Hi there, my problem is to understand how i can create my own fieldtype. I look into the Events Fieldtype Topic but i don't find any tutorial like creating Processwire Modules. A look into the code dose not help me. The field i want to create stores multiple informations like a address field. "IP, Connection, Hardware, Firmware, Lat, Long" For this i need a FieldtypeNode.module and ImputfieldNode.module right? But what do i need insight this two modules? Where to set the database schema? Much things are so easy in ProcessWire but this let me stuck.
-
ok, i think i found the issue but now i got the same problem again and i don't know why! i loop thorw pages and want to set the expire_date to a new timestamp $changeDate = wire("pages")->find(....); foreach($changeDate as $p){ $p->of(false); // Add 60 days to the publish date and store it to expire_date $p->expire_date = strtotime('+60 days', $p->publish_date); $p->save(); $p->of(true); } but the first page in the loop will always store the wrong time: 30 Nov, -0001 00:00 (timestamp: -62169987208). edit: i echo the output directly after save and of(true) and it is correct, but when I open the page ore output the field after reload, the wrong time is saved. It's always the first page, tested with different pages. I don't know what i make wrong!
- 2 replies
-
- date field
- date
-
(and 1 more)
Tagged with:
-
Damn, i have found the issue! i have set the time on two points and the second point was wrong! it's to late, i go to bad and do all the rest tomorrow. Sorry for the disorder.
- 2 replies
-
- date field
- date
-
(and 1 more)
Tagged with:
-
Hi, i want to set a date field value by api but i have problems to do so. I think this should be work: $page->of(false); $page->expire_date = time(); $page->save(); $page->of(true); but when i look into the field i get not the saved time. The output is always: 30 Nov, -0001 00:00 (timestamp: -62169987208). when i echo the time directly after the $page->of(true); than i get the current time but avter reload and output the time bevor $page->of(false); i get the time above! do you have any idea whats the problem?
- 2 replies
-
- date field
- date
-
(and 1 more)
Tagged with:
-
Hi Ryan, can you make the "chackNewComment" function hookable that more people can create spam filter for your comments module?
-
Comment spam filtering alternatives
kreativmonkey replied to Robert Zelník's topic in Wishlist & Roadmap
For everybody how is interested on a separate spam filter, i'm creating a spam filter for the Comments Field without using any external services. You can find the Thread: https://processwire.com/talk/topic/12872-module-comment-filter-antispam-guard/