Jump to content

bernhard

Members
  • Posts

    6,674
  • Joined

  • Last visited

  • Days Won

    367

Everything posted by bernhard

  1. hi sirhc, you could create a page reference field on your photo-template and when a user clicks on like you can add this user to the pagefield. if you have lots of users (likes) that could cause some problems on the page edit screen i guess, but if you set the field to hidden it should work. like count is as easy as counting referenced pages (users). show all liked photos would be an easy selector like "template=photo,likes=youruserid" most likes this week... hmmm... that's not possible with the setup above. then maybe it's better to create 2 new templates: 1) likes (just the parent for all likes) 2) like (pagefield referencing the photo, user that liked) then you can create a new "like" page whenever a user likes a photo and then you can also count all likes of that week: $pages->count("template=like,photo=yourphotoid,created>xxx,created<yyy"); and counting all likes for one photo would be even easier: $pages->count("template=like,photo=yourphotoid");
  2. does that help?
  3. i don't know what the code does exactly, so if you also don't understand it in detail you have 3 options wait and hope that somebody else helps you you invest some time, learn something about REGEX and try to find a way that prevents the module of minifying your comments buy procache for 49$ and be happy (for 1 site) and benefit of a lot more options and improvements that it offers (or pay 169$ for unlimited sites)
  4. Nice site! Maybe i should also try to start using the uikit admin theme... @last screenshot: Gallerie should be Galerie
  5. nice one, thanks for sharing!
  6. https://github.com/FlipZoomMedia/ProcessWire-AIOM-All-In-One-Minify/blob/AIOM%2B/AllInOneMinify.module#L993-L1014
  7. hi @AndZyk and thank you for your feedback Yes, you are right in both points. I'll add this on my todo-List. The streched team images are on iOs i guess? If yes, then we are already working on that.
  8. @pandaman i've never used magento but i've used one approach in other projects that could maybe also be interesting for you: the project was a step-by-step move from joomla to processwire and we changed only one part to processwire and had the joomla site running side-by-side. not sure if something similar could work in your scenario but that's what i did: my pw site did a request to the joomla site and fetched its HTML. this way all the html + design came from the joomla site and i could manage the menu etc from within the joomla admin. i then used something like http://simplehtmldom.sourceforge.net/ and replaced the content dom element by the pw-content. so basically the wrapper came from joomla and the content from PW. of course the html fetching was cached, because otherwise that would be terribly slow. also the script and image paths can be tricky. but maybe it's something you want to consider... said that, i admit that this can be a quite hacky solution. but sometimes quick hacks are not the worst solution
  9. hi tires, if you are looking for better performance i would highly recommend you take a look at procache: https://processwire.com/api/modules/procache/#procache-html-minification you have lots of options regarding html minification there that would solve your problem.
  10. hi alf and welcome to the forum did you read the docs of mpdf regarding svg? https://mpdf.github.io/what-else-can-i-do/images.html maybe there is some helpful information..
  11. https://www.baumrock.com/portfolio/hr-diamonds.com/ I built this website for my client hrdiamonds.com - a great HR company based in Vienna, Austria. They were totally unhappy with the result of the former agency so it was easier to rebuild the website from scratch than adopting the old CMS (that was actually only 2 years young!)... Design by @lokomotivan built with UiKit Highlights: Frontend-Editing barba.js for smooth page transitions ProCache, of course Favourite client quote of the CEO: Happy to hear your feedback
  12. i'm not sure but i think hannacode does not support the if statements like [myifstatement]this is shown only to superusers for example[/myifstatement] second, hannacode is a textformatter module that works only as a formatter for fields. i use my module to replace tags in emails and pdfs (ok that would also be possible with the textformatter and i'm thinking of adding a textformatter to call all my replacements, but i just wanted to have my own way of doing it...). and third, i prefer to define things with single files and not to write code into some field's config field. you can then use git for version control. next on the roadmap is to support else-statements like this: [superuser] access [else] sorry, only for superusers :) [/superuser]
  13. Didn't know that, of course that's a perfect solution! Thanks Sorry for this rtfm
  14. one more complex example: in the pdf creating module: $mpdf->WriteHTML(modules('RockReplacer')->replace($block->body, ['report' => $this->report])); the users edit-screen: the users help-section: the resulting pdf: and the replacementfile: <?php namespace RockReplacer; class dataoverview extends Replacer { public function desc() { return $this->_('Fügt eine Tabelle mit einer Zusammenfassung über alle Feedbacks + Rollen ein'); } public function replace($vars) { $report = $vars['report']; $project = $report->closest('template=project'); $fn = $report->fn; ob_start(); ?> <div class="dataoverview"> <h3><?= $this->_('Feedbackübersicht'); ?></h3> <table class="size-psmall striped"> <tr> <th class="text-center"><?= $this->_('Rolle'); ?></th> <th class="text-center"><?= $this->_('Eingeladen'); ?></th> <th class="text-center"><?= $this->_('Abgegeben'); ?></th> <th class="text-center"><?= $this->_('Rücklaufquote'); ?></th> </tr> <?php foreach($report->getRoles() as $role): ?> <tr> <td><?= $role->title ?></td> <td class="text-center"> <?php $invited = $this->wire->pages->count( "template=feedback". ",has_parent=$project". ",fn=$fn". ",fbrole=$role" ); echo $invited; ?> </td> <td class="text-center"> <?php $done = $this->wire->pages->count( "template=feedback". ",has_parent=$project". ",fn=$fn". ",fbrole=$role". ",fbdone=1" ); echo $done; ?> </td> <td class="text-center"><?= $invited ? round(($done/$invited)*100, 0) : 0 ?>%</td> </tr> <?php endforeach; ?> </table> [...] </div> <?php return ob_get_clean(); } }
  15. I built this module because I needed a versatile solution to replace tags and simple if-blocks in some E-Mails and PDF documents. If you only need to replace static tags (no if-conditions), then you can use default PW api and need no module: $str = "My favourite color is {color}."; $texttools = $sanitizer->getTextTools(); echo $texttools->populatePlaceholders($str, ['color' => 'red']); // output: My favourite color is red. Usage: See the two example Files in the folder /replacements Methods: replacementsTable() Renders an overview of all available replacements (see the example in the Module's config file: Create new Replacements: Simply copy the sample file and adopt to your needs. Download: https://gitlab.com/baumrock/RockReplacer
  16. also fine
  17. @adrian, what do you think of changing the "clear results" button in the console to a "don't clear results checkbox" meaning that every console submit clears the log unless the checkbox is checked. i find myself having to clean the console a lot while developing those days...
  18. yeah, i also went with ajax for now. but it's strange that it worked before... and it seems more complicated now than necessary and with pw that's usually the feeling when something is wrong
  19. and we also had this one recently:
  20. so what changed since your example here? and how could i detect clicks on buttons?
  21. no, thats not the reason. i don't know why, but $input seems to work! i was also expecting it NOT to work without $this, but it works for $input->get... <?php namespace ProcessWire; $out = ''; bd($input->get); bd($this->input->get); bd($this->wire->input->get); bd($input->post); bd($this->input->post); bd($this->wire->input->post); return; the one on the top is the $post and the one on the bottom the $get. I tried it also on a different install. Same behaviour. Really strange... no idea whats going on
  22. Hi kongondo, I'm sorry that I have to say that, but I still don't like the solution. It took me some time to understand all the settings, read the instructions carefully, paste in some file paths, ended up with some errors (I pasted the old paths with different root from the autofill for this field)... I ended up putting this replace hook in my site/ready.php - i guess this will save me, and you, and maybe some others some time... /** * replacement for the original runtimemarkup render method */ $wire->addHookBefore('InputfieldRuntimeMarkup::render', function($event) { $event->replace = true; $field = $event->object; //so that $page and $pages are locally scoped to the eval $process = $this->wire('process'); if($process && $process->className() == 'ProcessPageEdit') $page = $process->getPage(); $pages = $this->wire('pages'); // render files that are related to this field $root = rtrim($this->wire->config->paths->root,'/'); $path = '/site/modules/FieldtypeRuntimeMarkup/fields/'; $file = $root.$path.$field->name; if(is_file($file.'.php')) { // we found a file in the modules /fields folder, so render it $str = wireRenderFile($file, [ 'page' => $page, 'pages' => $pages, ]); } else { // no early reaturn because we load assets later if(!$this->runtimeFields) $str = ''; else $str = eval($this->runtimeFields); } // load assets related to this field if(is_file($file.'.js')) $this->wire->config->scripts->add($path . $field->name . '.js'); if(is_file($file.'.css')) $this->wire->config->styles->add($path . $field->name . '.css'); //since we are dealing with custom PHP code but also want to make sure that only markup is returned //if eval() returns anything other than a string or an integer, we throw an error (e.g. if an object or array is returned) $event->return = "Place your files here: $path<a>{$field->name}.php|css|js</a>"; if (is_string($str) || is_int($str)) $event->return = $str; else $this->error($this->_('Only strings and integers should be returned by your custom code! Check if your code is valid.')); }); With that method the setup is as simple as it can get. no clicking around, no pasting in wrong filenames, no error messages if there is no file... create a new field place it in your template place your files to /fields/myfield.php|css|js ---- another question that cost me quite some time already do you have any idea why this simple code does not work? if($input->post->submit_save) echo 'saved!'; else echo 'not saved'; using tracy i see that $input->post has no data while $input->get has the url params... also your example from here does not work any more: help would be highly appreciated
  23. hi tpr, seems that the move up/down icons overlap the delete icon making it impossible to click on it. do you need more information to reproduce this? aos 1.5.0 and pw 3.0.68
  24. making progress on this but there's still a lot to do until it is releasable as a module (proper documentation mostly)... sneak peak what's easily doable: a todo-app definition is as easy as that: /** * show table of todos */ public function executeTodos() { // create form $form = modules('InputfieldForm'); $form->action = './'; // add new project $b = modules('InputfieldButton'); $b->attr("id+name", "addTodo"); $b->addClass("ui-priority-primary pw-panel pw-panel-reload"); $b->value = __("Neues Todo"); $b->attr('data-href', pages(2)->url . 'page/add/?parent_id=' . pages('template=todos')); $b->icon = "plus"; $f = modules('InputfieldMarkup'); $f->value = $b->render(); $form->add($f); // table $t = modules('InputfieldRockDatatables'); $t->attr('id+name', 'manageTodos'); $t->rows = pages('template=todo'); // define the table's source rows with one selector $t->ajax = 1; // set table mode to ajax loading making it possible to reload data via a simple $table.ajax.reload(); [...] // remaining $col = new dtCol; $col->name = "remaining"; $col->title = 'Tage'; $col->className = 'minwidth'; $col->data = function($page) { if(!$page->deadline) return ''; $now = new \DateTime('now'); $then = new \DateTime(); $then->setTimestamp($page->deadline); $days = $now->diff($then)->format('%R%a'); $color = config()->colors->lightred; if($days > 0) $color = config()->colors->lightorange; if($days > 7) $color = config()->colors->lightgreen; $obj = new \stdClass(); $obj->display = $days; $obj->colorBars = [ [1, $color] ]; return $obj; }; $t->cols->add($col); [...] // add field to form $f = modules('InputfieldMarkup'); $f->value = $t->render(); $form->add($f); $out = $form->render(); return $out; }
  25. looks fine to me. try it with an empty pdf and the most simple headers & texts possible. maybe your header is just too large and it cannot shrink it (because it's not intended). mpdf is often trial&error
×
×
  • Create New...