Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 10/16/2019 in all areas

  1. 7 points
    Hi! I've created a small Inputfield module called InputfieldFloatRange which allows you to use an HTML5 <input type="range" ../> slider as an InputField. I needed something like this for a project where the client needs to be able to tweak this value more based on 'a feeling' than just entering a boring old number. Maybe more people can use this so I'm hereby releasing it into the wild. EDIT: You can now install it directly from the Modules directory: http://modules.processwire.com/modules/inputfield-float-range/ What is it? The missing range slider Inputfield for Processwire. What does it do? This module extends InputfieldFloat and allows you to use HTML5 range sliders for number fields in your templates. It includes a visible and editable value field, to override/tweak the value if required. Features Min/max values Precision (number of decimals) Optional step value (Read more) Optional manual override of the selected value (will still adhere to the rules above) Configurable rounding of manually entered values (floor, round, ceil, disable) Usage Clone / zip repo Install FieldtypeFloatRange, this automatically installs the Inputfield Create new field of type `Float (range)` or convert an existing `Float`, `Integer` or `Text` field. To render the field's value simply echo `$page->field` Demo A field with Min=0, Max=1, Step=0.2, Precision=2 Field with settings Min=0, Max=200, Step=0.25, Precision=2 Todo Make the display-field's size configurable (will use the Input Size field setting) Hopefully become redundant Changelog 005 (current version) - Fix bug where the Inputfield would not work properly within repeaters / repeater matrices 004 - Make rounding of manually entered values configurable (floor, round, ceil or disable) - Fix small JS bug when the value-display field was not displayed - Update README 003 - Code cleanup, add some ModuleInfo data & LICENSE - Submit to PW Modules directory (http://modules.processwire.com/modules/inputfield-float-range/) 002 - Fix issue where setting the step value to an empty value created problem with validation - Make the display-field optional 001 - Initial release Thanks!
  2. 4 points
    To be honest I didn't check out that module in a long time, and had even forgotten it existed.. 😅 But the major differences would be FieldtypeRangeSlider is a full-fledged module with its own API, depends on jQueryUI, and.. has not been updated in 5 years. The one I created is much simpler and light-weight: it's really just a basic HTML5 <input type='range'> with some styling, feedback and validation. As such, it is just another way to use the regular Float/Integer inputfields.
  3. 3 points
    Hey Guys, thanks a lot for your replies. Back after work, I have just checked your answers and I'm closely suprised. It is the indication of the absolute path that the image outputs immediately. Bernhards snippet - an excerpt, I took again. Then I only changed one line as in the code-snippet below, that solved the problem. . $mpdf->WriteHTML('<div>Showing image ' . $img->filename . '</div>'); As in the Screenshot beside, the seond Path(last line) is the right one. Thank you bernhard, horst and jens - your all commitment is just great!
  4. 2 points
    You need to use the disk path instead of the URL foreach ($this->page->getUnformatted($fieldName) as $img) { echo "<img src='{$img->filename}'>"; }
  5. 2 points
    I think you need to pass the full (absolute) filename to the mpdf->image() method, not a relative one and not(!) a URL. $filename = "/absolute/filepath/to/the/image.jpg"; // or when using PWs pageimage $filename = $image->filename; // do a test in your script for debugging: if(!is_readable($filename)) die('Missing file'); $mpdf->AddPage('L'); $mpdf->Image($filename, 0, 0, 210, 297, 'jpg', ...
  6. 1 point
    ... and those have to be children of body, not html :-) How do you include this list in your main template? regular include() ? In that case, you don't output anything in that partial, just build a string with PHP that you then echo() in your main template. You should definitely look into some beginner tutorials and docs - templating in PW really isn't hard to grasp. For the above list, you could use PHP's heredoc syntax. btw, for your last two fields you would need slightly more, since these are probably file/image fields (like $page->images->first()->url or whatever you need)
  7. 1 point
    Well, yeah, I am using path because of different reasons. Because my images are not available via URL (or only if logged in) as I use pagefileSecure in my config. So the process mPDF has no access to the images, and therefore I use the path.
  8. 1 point
    I'm using ->url in several spots in my projects and it works. Maybe he messed up something else or maybe our setups are just different. The screenshot looks like he is already using a full disc path /var/www/... and not an url site/assets/... @August Make sure the file exists on your server and then just try different paths/urls and see which one works for you. Start doing it manually without using pw variables and once you have one working example expand on that one.
  9. 1 point
    Hi @eelkenet, thx for sharing 🙂 Did https://modules.processwire.com/modules/range-slider/ not work for you or did you need other features? Would be nice to see the differences between your modules. We also have this one:
  10. 1 point
    Hi, No need to concatenate your output which means no need to use <?php $content .= page()->your field; ?>. Just do this: <?php echo page()->your field; ?> Gideon
  11. 1 point
    $img = $pages->get(1)->images->first(); // adjust to your setup $pdf = $modules->get('RockPdf'); $mpdf = $pdf->mpdf; $mpdf->WriteHTML('Hello World ' . date('H:i:s')); $mpdf->WriteHTML('<div>Showing image ' . $img->url . '</div>'); $mpdf->WriteHTML('<img src="' . $img->url . '">'); $pdf->save(); Does this work?
  12. 1 point
    Hello folks, I want to save the information which user uploaded a file and also a date in the PW admin. I thought I could use the description field for this information, but how do I set it via a hook and how do I prevent users from editing the description? I tried the following hook which does not set the content of the description field (seems to be not a property of the InputfieldFile, but an individual field). /** * if this is a fachbereich or abteilung add a hook to prevent file deletion * @param HookEvent $event */ public function hookPageFile(HookEvent $event) { // if ($this->user->isSuperuser() || $this->user->hasRole('restricted-admin')) { // return; // } $page = $event->object->getPage(); // Only use on pages with the raum template if (($page->template == 'fachbereich' || $page->template == 'abteilung') && !$page->isTrash()) { $this->addHookAfter('InputfieldFile::processInputFile', function(HookEvent $event) { // Get the object the event occurred on, if needed $InputfieldFile = $event->object; $InputfieldFile->description="no description"; bd($InputfieldFile, "processInputFile"); }); $this->addHookBefore('InputfieldFile::processInputDeleteFile', $this, 'preventFileDelete'); } } The hook should also be only executed on pages with a specific template, so that's why I use $this->addHookBefore('ProcessPageEdit::buildForm', $this, 'hookPageFile'); Is this even possible, or should I take a completely different route? Maybe save the inputfield_id, filename and created_user in a separate database table? But this would complicate things, because on the output side I have to query the custom database instead of using just the description field. Maybe I can use the just added custom fields for files/imags in ProcessWire 3.0.142 for this? But how do I set the values in the admin for them and prevent changing them by the user? Think I have to test this out. EDIT: Found a solution with the help of the nice guys in this forum. You can find it here: https://processwire.com/talk/topic/22411-how-to-add-user-and-date-to-an-uploaded-file-help-urgently-needed/?do=findComment&comment=192363
  13. 1 point
    I tried this: fresh 3.0.123 installation multilanguage profile PHP 7.2 latest Pages2PDF module At first I saw no changes at all because I changed the wrong templates in /site/modules/Pages2PDF/default_templates/ and not those in /site/templates/pages2pdf/. Right now... all I can say is: it's working as expected. Sure... there is no custom code in my page templates or anythings. Just the basic stuff. My recommendation: try it with a simple basic template without anything else in it. Maybe even blindtext. Maybe the reason for your errors are at a different place than the module itself. Update: just saw in your post that you ARE in the wrong folder with the wrong templates.
  14. 1 point
    Just to get the records straight... ProcessWire version? Multilanguage profile or another profile made multilanguage? How many languages? Does it work in any of the languages? PHP version? Module version? How do you generate the PDFs? Code snippet would be great Where do you create the PDFs - frontend or backend? Templates: page or PDF? Template location? Template strategy - delayed, direct, regions?
  15. 1 point
    Words of encouragement from the Pub's amateur psychiatrist (Read best in a soft spoken, German accent) Ah, you are here because you have been reading things in this forum about pages that have left you confused, disorientated, befuddled. You thought you knew what a page was - you have been thumbing through them, folding them, studying them, wrapping things up in them and scrolling up and down them for most of your life! A page is this solid item - this great lump of data stuffed with things. But now you have come to Processwire, and everything you thought was true, simply isn't any more. For in Processwire pages are completely different - they are not great gulps of information, but tiny little things, nothing more than a link to the more interesting world of fields and templates; just a little blip of data in your huge fascinating database. Pages in Processwire are used for all kinds of things. They can be used as a marker in your pages list. They can be used as a group parent for other pages. They can be used as categories, tags or lists or users. And they can even be used for simple drop-down selects - just to supply a label and value. It can seem crazy to use such an iconic thing like a page for such a mundane and trivial task! But don't worry and fret, don't lose sleep or pace the floor as you think the reputation of the noble page is being crushed! In Processwire, they are fulfilling their duty to the full - and the more slight the task, the more they bound up to the wall and jump up and down shouting "use me, use me!" And, as a bonus, they can even be used for content - for all that stuff you thought was a page, but in Processwire isn't! So, don't be put off by the Processwire page - use it for everything! it is much smaller than you think, takes up hardly any space at all, is well behaved and only will do its thing when it is called. In fact it is hardly a page at all .... and then again, it is also so much more!! Better now? Joss Freud
  16. 1 point
    Netcarver beat me An alternative: <?php if ($page->matches('id!=1021|1105')) { echo 'do stuff'; }
×
×
  • Create New...