Jump to content

bernhard

Members
  • Posts

    6,671
  • Joined

  • Last visited

  • Days Won

    366

Everything posted by bernhard

  1. Nice site! Maybe i should also try to start using the uikit admin theme... @last screenshot: Gallerie should be Galerie
  2. nice one, thanks for sharing!
  3. https://github.com/FlipZoomMedia/ProcessWire-AIOM-All-In-One-Minify/blob/AIOM%2B/AllInOneMinify.module#L993-L1014
  4. 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.
  5. @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
  6. 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.
  7. 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..
  8. 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
  9. 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]
  10. Didn't know that, of course that's a perfect solution! Thanks Sorry for this rtfm
  11. 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(); } }
  12. 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
  13. also fine
  14. @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...
  15. 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
  16. and we also had this one recently:
  17. so what changed since your example here? and how could i detect clicks on buttons?
  18. 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
  19. 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
  20. 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
  21. 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; }
  22. 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
  23. you should just be careful when installing pw into a subdir because sometimes this can break paths... for example if there is any link pointing to the root ( "/" ) it would NOT point to the right direction, because it should actually point to "/api/" you could overcome this using a subdomain. if thats possible in your case i would recommend using api.yourdomain.com instead of yourdomain.com/api/
  24. see the docs and examples on that page: https://mpdf.github.io/reference/mpdf-functions/addpagebyarray.html $mpdf->AddPageByArray(array( 'orientation' => 'L', 'mgl' => '50', 'mgr' => '50', 'mgt' => '50', 'mgb' => '50', 'mgh' => '10', 'mgf' => '10', )); mgt = page margin from the top (where regular text starts, in the example it would start 50mm below the top) mgh = margin for the header (where the header text ends, in the example it would end 10mm from the top)
  25. looks like somebody starts liking the file option yes, that's what i want i try to explain what i was talking about in the last 2 postings: imagine you are working on a project with some runtime markup fields... it starts with easy markup, some html. you create your field, set the option to render a field in a specified folder and you're fine. lets say we store it in RM/fields/myfield.php; so far so good. imagine you continue working on your project... your project grows and your field needs some more styling. we need some easy CSS rules for that field. so what to do? option now: leave your IDE open just another browser tab go to the backend search the field go to the settings put in the path of the CSS create your css file (RM/fields/myfield.css) put in your rules my way how i did it with my render method for several fields: create your css file (we have a myfield.php, so create a myfield.css in the same folder) put in your rules that's A LOT easier and fool-proof imho. the problem with your "we have that option of including files with the same name already" is that it throws an error when the file is not present. imho that harms more than it helps, because the problem is that you can NOT choose this option while setting up the field at the moment, because it would always show the error as long as you don't have (don't need) a css/js file. i would really really vote for one global option: this setting could hide all other inputfields, you would not have to change any of your options and have a solution for everybody. hope that makes my point more clear now
×
×
  • Create New...