Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/30/2018 in all areas

  1. A short update this week looking at ProcessWire 3.0.97 and a preview of coming attractions: https://processwire.com/blog/posts/processwire-3.0.97-core-updates/
    8 points
  2. Or you can steal one or two methods @ryan's code, stuff them into your little module, tweak a few lines and add even more fun to PW Attached is a quick & dirty little module (actually, two of them) that adds: $log->mailLog($your, $fields, $ending, $with, ..., $messagebody) [pass as many arguments as you like; the last one will always have white-space set to wrap] a special log viewer at Setup -> Mail Log that displays as many columns as you sent to mailLog() It uses some unlikely to naturally occur text patterns for newlines and field separators and fools ProcessLogger::executeView into thinking it is pointed to the mail log, and that way lets it do the heavy lifting. ProcessMailLogger.zip
    7 points
  3. EDIT: Demo version download here: Hello I've been looking for a way to give "editors" a little bit more freedom regarding the layout, without having to care about CSS, Fields, Templates etc. After playing with PageTable(-Extended) and Bootstrap, this is the (intermediate) result: http://theowp.bplaced.net/upload/prev.html It is just a proof of concept atm. Does anything like this already exist for PW?
    6 points
  4. It is visible only for superuser, for the guest user you should get 404 error by visiting links of diactivated languages
    4 points
  5. If you're looking to do an elaborate a page builder with ProcessWire and don't want to pull your hair out, I highly recommended viewing this video: A couple notes: with the css grid specification, you can assign multiple blocks to the same grid-area but they will overlap each other. I've "overcome" this by combining multiple blocks into a parent div and assigning that instead. pretty easy to do. i didn't demonstrate it, if your blocks have a grid structure within them (like built with flexbox), you can still assign that block to a grid-area. so if your blocks themselves have a grid structure, that's ok. for example, if your css grid layout is 6 columns, but you have a block that has a grid inside of it (built with like uikit's grid that's 5 columns), you can assign that block to the grid-area. with the css grid specification, the flow of the blocks does not have to match the flow of the grid-areas. this is insanely powerful. Enjoy.
    3 points
  6. @bernhard Have you seen this https://www.ag-grid.com/javascript-grid-reference-overview/#listening-to-events?
    3 points
  7. @theo this module is similar perhaps
    3 points
  8. Cool. Just optimise it with get() instead of find(). You could also use OR:groups selector. <?php $existing_name_check = $pages->get("name=$post_name"); $existing_email_check= $pages->get("submission_email=$email"); if (count($existing_name_check)) { $session->redirect("?alert=existing-submission"); } else if (count($existing_email_check)) { $session->redirect("?alert=existing-submission"); } else { // create page $session->redirect("?alert=form-success"); } // OR...make it shorter $exists = false; if($pages->get("name=$post_name")->id) $exists = true; elseif($pages->get("submission_email=$email")->id) $exists = true; if ($exists) { $session->redirect("?alert=existing-submission"); } else { // create page $session->redirect("?alert=form-success"); } // OR..make it even shorter (OR:groups) $exists = false; // @todo: you might want to check if page is in the trash here, i.e. parent.id!=7, etc if($pages->get("(name=$post_name),(email=$email)")->id) $exists = true; if ($exists) { $session->redirect("?alert=existing-submission"); } else { // create page $session->redirect("?alert=form-success"); }
    3 points
  9. I had this problem once and solved it with JSON. It is quick and simple. In your case $logmsg = array( 'Email' => $emailvalue, 'Betreff' => $subjectvalue, 'Nachricht' => $commentsvalue ); $log->save('contact-form', json_encode($logmsg));
    3 points
  10. You won't be able to use $log->save() for the reason @alxndre mentioned, and you won't be able to use the admin log viewer because a) it uses new lines to identify each log entry so therefore one entry cannot contain more than one line, and b) it entity encodes HTML for security reasons. But you can use PHP functions like error_log() or file_put_contents() to create your own log file (create the "custom-logs" folder first). $text = date("Y-m-d H:i:s") . "\nHello, how \nare you?\n\n"; // your text, include newlines if needed error_log($text, 3, $config->paths->assets . "custom-logs/mail.txt")
    3 points
  11. Those two things contradict each other somewhat. If you are creating a new custom fieldtype then there won't be any existing field data until you create your fieldtype module and start using it in pages. There is the Events fieldtype and inputfield which was created specifically as a proof-of-concept for developers to learn from. But it extends FieldtypeMulti (each field instance saves/shows multiple repeated items) so that might not suit what you are wanting to do. I don't think Ryan made a similar proof-of-concept for a straight Fieldtype. But in a way all the Fieldtype modules in the core and in the modules directory are a proof-of-concept - find a fieldtype that is broadly similar to what you want to do and check out (borrow from ) the code. Also, the documentation for the Fieldtype class will be useful. Perhaps if you describe exactly what you want the fieldtype/inputfield to do people can give you more suggestions.
    3 points
  12. ProcessWire shouldn't need 777 at all. You just need to make sure that the web server can write in site/assets, since this is where all dynamically changing data (caches, files, logs) is stored. You probably just need to give ownership to www-data (or whatever the webserver runs as) and can switch to 0750. If you're worried about security: the .htaccess file is quit strict in limiting access there.
    2 points
  13. @synapse To not log out you can test such things in the incognito mode
    2 points
  14. The method @LostKobrakai mentions above gives you a clue about how you can make a simple function for the purpose... // Get the page from a path which might include URL segments function getPage($path) { $page = wire('pages')->get("path=$path"); if($page->id) return $page; // If the path matches a page return that $pieces = explode('/', $path); // Break the path into pieces while(!$page->id) { // Until a page is matched... array_pop($pieces); // Pop off the last piece (a URL segment) $path = implode('/', $pieces); // Make a path from the remaining pieces $page = wire('pages')->get("path=$path"); // Try and get a page at that path } return $page; // Return a matching page or a NullPage if no match } If you wanted to get the URL segments from the path it would be easy to modify the function to return those also.
    2 points
  15. Browsing to the already selected item gets to be a pain, but thankfully the AdminOnSteroids module has an enhancement that lets you clear the selection more easily.
    2 points
  16. Just click on the "Change" button and hover over the currently selected page in the tree. The "unselect" button will pop out next to it. It's a bit hard to find, especially using the UIKit admin theme.
    2 points
  17. Could you double check the selector is ok?? I threw in some invented field names in the selector. (sorry to omit that) It seems to me that the $submitted is not throwing a truthsy value (maybe try $submitted->count() so it returns a number which evals to true except for 0 pages found) and it's trying to create a page with the same page name. (John Smith, will crate page john-smith), also for setting the page rather use the $sanitizer->pageName(). Also, reviewing the code, maybe it's more correct to do this: if(isset( $_POST['submit'])){ //Rather only get the first page $submitted = $pages->get("parent=/entries/, (submitter_name={$input->post->name}),(mail={$input->post->mail})"); //Checks for page id, if not it's NullPage object if($submitted->id){ //Code from before }else { $session->redirect("?alert=existing-submission"); } }else { $session->redirect("?alert=form-failure"); } Hope i didn't make this more confusing haha
    2 points
  18. Here the url should be add-new-recordal, so it gets read by the process module: $wire->addHookAfter("ProcessPageLister::execute", function($event) { if(wire('page')->id === 1413) { // the particular Lister instance page id $out = $event->return; $out .= ''; $btn = wire('modules')->get("InputfieldButton"); $btn->attr('data-href', "./add-new-recordal/"); $btn->addClass("pw-modal"); if(!$this->config->ajax) $out .= $btn->render(); $event->return = $out; } } I have done this in init.php but my wild guess is it should work on ready.php too: $wire->addHook("ProcessPageLister::executeAddNewRecordal", function($event) { // // Create new page and redirect to its edit section $p = new Page(); $p->template = '02_template'; $p->parent_id = 1040; $p->name = 'recordal_' . $pageRecordalsMicrotime; $p->title = 'Recordal_' . $pageRecordalsMicrotime; $p->created_users_id = $this->user->id; $p->of(false); $p->save(); $this->session->redirect(wire('config')->urls->admin."page/edit/?id={$p->id}&modal=1"); } From what I can see, the creation of the page and redirect is already performed in an iframe modal, so it will all happen in the iframe opened with the button you are rendering. Or maybe I'm missing a point here
    2 points
  19. Module for hiding pages for non-superusers. Download HidePages Requirements ProcessWire 3.x Changelog 1.0.1 (31 March 2018) Module renamed to prevent confusion 1.0.0 (30 March 2018) Initial release
    1 point
  20. Easiest, fastest, most reliable framework. Considering my workload this past weeks, I'm considering on switching. It supports a wide range of applications:
    1 point
  21. @mel47 Remove "&callback=initMap" from src and it should be ok.
    1 point
  22. Awesome!!! Thanks!! Thought I've read the whole docs and examples and googled for an hour but found nothing... now it will be a lot more fun working on this tomorrow Maybe I should change the topic title to "everybody who can rtfm better than me, raise your hands" ??
    1 point
  23. I get you now. You are not talking about ProcessWire /admin/child/....(i.e. children of Page with ID 2) but hidden pages in general. In that case, the module class name, title and description are misleading IMHO. Maybe change to something else?
    1 point
  24. @bernhard just curious, what code editor/IDE is that? looks pretty
    1 point
  25. very cool, like a wysiwyg for pages!
    1 point
  26. Very nice. Seems like a nice mix of the Repeater Matrix (Pro Fields Module) and Page Table Extended.
    1 point
  27. Thanks kongondo! I will give that shot this morning. Lat night, I did get it working using: $existing_name_check = $pages->find("name=$post_name"); $existing_email_check= $pages->find("submission_email=$email"); if (count($existing_name_check)) { $session->redirect("?alert=existing-submission"); } else if (count($existing_email_check)) { $session->redirect("?alert=existing-submission"); } else { // create page $session->redirect("?alert=form-success"); } I really appreciate everyones' help as well as patience with me!
    1 point
  28. Hello @Robin S, I've just noticed your initial post of this thread points to no longer available images, you might want to fix that. Also, I find it a bit strange you use the GitHub link in the module's info instead of this thread's or the module directory's, since in the README.dm there is no link to learn about the other two pages.
    1 point
  29. thanks everyone for clarification. It was obvious as it wasn't mentioned in the documentation but sometimes asking for help offer new implementation approaches :))
    1 point
  30. In the first post of my REST API tutorial I link to clsource's REST helper class. You could use that one or lend some code from it.
    1 point
  31. Thanks @Zeka. After I logged out the page was not visible any more ?.
    1 point
  32. Fixed issue #3 https://github.com/kixe/FieldtypeColor/issues/3 @flydev Thanks
    1 point
  33. Hey @tpr - would you mind enabling field edit links for the user template please? I expect it's just a matter of adding ProcessUser instead of just ProcessPageEdit Thank you!
    1 point
  34. I suspect that's the issue. According to Profields: Textarea docs, you have to search the entire field. Since you want to search for both $somePage->submissions->email and $somePage->submissions->name (assuming name is the name of one of the properties in your Profields: Textarea), based on the example in the Profields: Textarea docs, your get() query could be: $submitted = $pages->get("parent=/submissions/entries/, (submissions%={$post_name}),(submissions%={$email})");
    1 point
  35. I prefer the responsive embed method... ...and this applies a class to a containing div element.
    1 point
  36. What is submissions? e.g. submissions=$post_name. What sort of field is that? if($submitted->id) means you found an existing page, so you should redirect, and not create a new page in that condition block. Here's some pseudo-ish code based on @elabx's code since I don't know what submissions is. It assumes there is a parent with the path /submissions/ . That parent page has children which have an email field. In this code, we are looking for a child page whose name matches a submitted name and whose email matches a submitted email. I am assuming name here is ProcessWire's in-built name field and not some custom field. I have also used $input rather than $_POST. I have left your stripslashes in there since I don't know why exactly you are using them. if($post->submit){ $name = trim(stripslashes($post->firstname)) . trim(stripslashes($post->lastname)); $upper_name = trim(stripslashes($post->firstname)) . " " . trim(stripslashes($post->lastname)); $post_name = $sanitizer->pageName(strtolower($name));// I am assuming ProcessWire 'name' which is used to build the page URL $email = $sanitizer->email($post->email); $todaysdate = date("F j, Y H:i a"); // rather only get the first page // this is an OR:group selector $submitted = $pages->get("parent=/submissions/entries/, (name={$post_name}),(email={$email})"); // page with email and/or $post_name already exists, redirect if($submitted->id){ $session->redirect("?alert=existing-submission"); } // good to go, create new page else { $u = new Page(); $u->template = "submissions-entry"; $u->parent = '/submissions/entries/'; // some of these already sanitized above $u->name = $post_name; $u->title = $sanitizer->text($upper_name); $u->submissions->_date = $todaysdate; $u->submissions->full_name = $sanitizer->text($upper_name); $u->submissions->email = $email; $u->save(); //$u->setOutputFormatting(false);// @question: why do you need this? $session->redirect("?alert=form-success"); } } // show new form else { //$session->redirect("?alert=form-failure"); }
    1 point
  37. @horst You're like the gift that keeps giving. Now I know I can call a region directly! Nice...
    1 point
  38. @theoretic there is such a field type for color https://modules.processwire.com/modules/fieldtype-color/ and also a module for color picker https://modules.processwire.com/modules/fieldtype-color-picker/ if they don't solve your request, you can inspect their code and see how to do it hope this helps
    1 point
  39. I always use pages to log mails... just use a ckeditor field and you can see your html content. Or why exactly do you want to use logfiles?
    1 point
  40. if(isset( $_POST['submit'])){ $submitted = $pages->find("parent=/entries/, (submitter_name={$input->post->name}),(mail={$input->post->mail})"); if($submitted){ $u = new Page(); $u->template = "entries"; $u->parent = $pages->get("/entries/"); $u->name = $sanitizer->text($post_name); $u->title = $sanitizer->text($upper_name); $u->save(); $u->setOutputFormatting(false); $session->redirect("?alert=form-success"); }else { $session->redirect("?alert=existing-submission"); } }else { $session->redirect("?alert=form-failure"); } This check is first_name OR mail exists already (and checks for exact value! maybe for name you want: name%=$input->post->name).
    1 point
  41. You can simply do this : Form submit => POST request => verify($input->name, $input->email); Then in the verify function, you parse the name and check if it already exist in your system. If it exist, your return an error, else you create an new entry. Which difficulty are you encountering ?
    1 point
  42. yep, and if you are doing any custom routing, you can write your own function to get the real page, my theme engine module includes a getVirtualPage() method that can find real pages based on conditions of the segment(s), which templates exist at each segment level, using name matching combined with template; this doesnt help if you are rendering real virtual pages like tag, category or archive filters, or feeds etc. /** * Given an array of expected templates used at each segment index, return the page we are on * @param array $segmentTpls [plain array of template names used for segments] * @return [Page] */ public function getVirtualPage(array $segmentTpls) { $pages = wire('pages'); $sanitizer = wire('sanitizer'); $input = wire('input'); $maxSegs = count($segmentTpls); $segsCount = count($input->urlSegments); if($segsCount > $maxSegs) return false; if($segsCount) { $lastSeg = $input->urlSegments[$segsCount]; $segPlate = $segmentTpls[$segsCount - 1]; $pageName = $sanitizer->pageName($lastSeg); $vPage = $pages->get("template=$segPlate, name=$pageName"); return $vPage; } }
    1 point
  43. @manuel1981 not sure if this would solve your problem, but i have a 3.x site that uses this module, and i do know that I changed line 389 https://github.com/Da-Fecto/TextformatterImageInterceptor/blob/master/TextformatterImageInterceptor.module#L389 from $class['align'] . " " to this: isset($class['align']) ? $class['align'] . " " : '', i'm not sure if that would be the cause of an error, but i was getting tracy log errors with this module before i changed it. Also, speaking of Tracy, you should have that installed so you can detect what if any errors this module may be generating in your setup...
    1 point
  44. Really, really nice! What do you think of packing this into a fieldtype? Would be nice to have all the logic, files and fields packed into a module and to only have to add your field in the template editor I'm also working on a site with matrix content builder and using field rendering makes the code very clean: My matrix field is called "content" and all my items are included via WireRenderfile(). Then it's as easy as placing a file with the markup in /templates/matrix (here 2columnlayout.php).
    1 point
  45. This is awesome, @Jonathan Lahijani!!! Great work!! For those eager to learn CSS Grid, I recommend this excellent (and free) course by Web Bos: https://cssgrid.io
    1 point
  46. https://www.blue-tomato.com/blue-world/ Everything under /blue-world/ is from Processwire
    1 point
  47. Toolbar : Extra plugins : PS: A small suggestion @benbyf, you could include in the first post a) a small "howto customize" the ckeditor and/or b) a list of forum links where people can find useful information on "howto customize" the ckeditor (I remember that sometime I need to look at the javascript source-code of the plugin to find the right button-code to include in the ckeditor settings).
    1 point
  48. Not at all, appreciate your help. I think I've found what I'm looking for: <?php function treeMenu(Page $page = null, Page $rootPage = null) { if(is_null($page)) $page = wire('page'); if(is_null($rootPage)) $rootPage = wire('pages')->get('/'); $out = "\n<ul>"; $parents = $page->parents; foreach($rootPage->children as $child) { $class = "level-" . count($child->parents); $s = ''; if($child->numChildren && $parents->has($child)) { $class .= " on_parent"; $s = str_replace("\n", "\n\t\t", treeMenu($page, $child)); } else if($child === $page) { $class .= " on_page"; if($page->numChildren) $s = str_replace("\n", "\n\t\t", treeMenu($page, $page)); } $class = " class='$class'"; $out .= "\n\t<li>\n\t\t<a$class href='{$child->url}'>{$child->title}</a>$s\n\t</li>"; } $out .= "\n</ul>"; return $out; } echo treeMenu($page, $page->rootParent);
    1 point
×
×
  • Create New...