Leaderboard
Popular Content
Showing content with the highest reputation on 01/17/2024 in all areas
-
FieldtypeGrapick The FieldtypeGrapick module for ProcessWire wraps the Grapick vanilla javascript gradient creation UI and extends the feature set to include settings beyond what the original library allowed for. The original javascript library was written by Artur Arseniev. Aside from requiring ProcessWire 3, the requirements are: PHP >= 7.2 or >= PHP 8.0 This module makes use of the Spectrum colorpicker library. Repeater and RepeaterMatrix items are supported. There is a gremlin in RepeaterPageArray iteration that causes warnings. I've created an issue for it. It does not impact performance. CssGradient Object The FieldtypeGrapick field value is a CssGradient object. $gradient = new CssGradient( $options=[] ); where $options is a list of properties: $options = [ 'style' => 'linear', 'stops' => 'FFFFFFFF^0|FF000000^100', 'angle' => '180', 'origin' => '', 'size' => '', ]; Properties The CssGradient style by default is linear, 180deg, with a white opaque stop at 0% and a black opaque stop at 100%. style $gradient->style: gives you the dropdown value of the style of gradient. Setting this automatically uses the correct settings for the css function and shape parameter as required. Possible values: 'linear' = Linear 'radial-circle' = Radial Circle 'radial-ellipse' = Radial Ellipse 'repeating-linear' = Repeating Linear 'repeating-radial-circle' = Repeating Circle 'repeating-radial-ellipse' = Repeating Ellipse 'conical' = Conical 'repeating-conical' = Repeating Conical Any other value defaults to linear. Depending on the type of gradient selected, origin, angle, and/or size will come into play. The stops are always used to determine the order of colors and their relative locations according to the limitations of each style. origin $gradient->origin: gives you the dropdown value of the origin of the gradient as it applies to radial and conical gradients. The format is X%_Y% if for some reason you want to set a custom X/Y origin. The dropdown values are typically what I find useful for most applications, but I am open to adding other presets. '-100%_-100%' = Far Top Left '50%_-100%' = Far Top Center '200%_-100%' = Far Top Right '-50%_-50%' = Near Top Left '50%_-50%' = Near Top Center '150%_-50%' = Near Top Right 'top_left' = Top Left 'top_center' = Top Center 'top_right' = Top Right '-100%_50%' = Far Middle Left '-50%_50%' = Near Middle Left 'center_left' = Middle Left 'center_center' = Center 'center_right' = Middle Right '150%_50%' = Near Middle Right '200%_50%' = Far Middle Right 'bottom_left' = Bottom Left 'bottom_center' = Bottom Center 'bottom_right' = Bottom Right '-50%_150%' = Near Bottom Left '50%_150%' = Near Bottom Center '150%_150%' = Near Bottom Right '-100%_200%' = Far Bottom Left '50%_200%' = Far Bottom Center '200%_200%' = Far Bottom Right angle $gradient->angle: gives you the angle in degrees of the gradient as it applies to conical and linear gradients. Should be a value between -360 and 360. Measured in degrees. size $gradient->size: gives you the size - of what depends on the type of gradient. For radial ellipse gradients, at applies a size of XX% YY% using the value. So 25 would represent a size of 25% width, 25% height of the container. For repeating linear, conical and radial gradients, the repeating gradient will apply the percentage stops as a percentage of this value. In the case of repeating linear gradients, if you have your stops at 0%, 10%, 50% and 100% and your size is 200, the stops in the calculated rule will be at 0px, 20px, 100px and 200px. For repeating ellipse and conical gradients, a similar calculation is performed, but the units are %, not px. You can get some crazy tartan backgrounds out of this if you stack your gradients up and are creative with transparencies. stops $gradient->stops: gives you the current stop settings in a AARRGGBB^%% format, with each stop separated by a '|' character on a single line. You can role your own gradient ruleset by modiying this property prior to getting the rule. When using the UI you can also reveal the Stops inputfield and change the stops manually, however you will need to save to see the changes in the UI. rule $gradient->rule: gives you the stored rule that is calculated prior to the field value being saved to the database from the UI. Of course, if you are ignoring the UI altogether and just using the class, you will probably ALWAYS want to call getRule() rather than use this property. If you render the field, it will return the rule as a string. Methods The CssGradient has a single public method that is mostly useful when manipulating an instance of the CssGradient class. getRule(string $delimiter) $gradient->getRule(): calculates the rule based on the properties or options you have set for the field. This automatically runs if you have set an $options array and populate the rule property, but if you decide later that you need to change the properties of the object, you'll want to manually call it again to recalculate it. For example, if you programmatically change the stops, you will want to run the getRule() method rather than just grab the rule property. If you pass a string, the first character will be used as an ending delimiter. If you pass an empty string, no ending delimited will appear. By default, the rule is output with a semicolon. Grapick UI The Grapick UI is relatively straightforward. Clicking the (x) handle above a gradient stop removes the stop from the gradient calculation. If you remove all the stops, the bar is transparent. Clicking on the gradient bar sets a stop conveniently set to the color you click on. Clicking on the colorpicker box below the stop line allows you to select the color and transparency of the stop. Click and drag the stop line itself to modify the gradient. Making changes to any of the controls on the field will update the preview and the calculated rule in real-time. You can always cut and paste this rule and use it in your designs elsewhere if you want. Likewise, if you open the Stops inputfield area (which is collapsed by default) you can directly alter the colors and code using a color in an AARRGGBB format and adjust the stop with a number from 0-100. It's fun to play with - experiment with hard and soft lines, size and origin - many interesting effects are possible. Do not forget that the alpha slider is also available. Examples $grk = new CssGradient($options=[ 'style' => 'linear', 'origin' => '', 'angle' => 270, 'stops' => 'FF8345E4^0|FF5A08DB^25|FF2C046B^97|FF000000^100', 'size' => '', ]); echo $grk->getRule(); will give you: linear-gradient(270deg, rgba(131, 69, 228, 1) 0%, rgba(90, 8, 219, 1) 25%, rgba(44, 4, 107, 1) 97%, rgba(0, 0, 0, 1) 100%); while echo $grk->getRule(''); will give you linear-gradient(270deg, rgba(131, 69, 228, 1) 0%, rgba(90, 8, 219, 1) 25%, rgba(44, 4, 107, 1) 97%, rgba(0, 0, 0, 1) 100%) and echo $grk->gerRule(','); will give you linear-gradient(270deg, rgba(131, 69, 228, 1) 0%, rgba(90, 8, 219, 1) 25%, rgba(44, 4, 107, 1) 97%, rgba(0, 0, 0, 1) 100%),3 points
-
Here is the script: #!/usr/bin/php <?php namespace ProcessWire; include("/home/stephan/www/index.php"); foreach ($pages->find("template=post, status=unpublished, sort=unpublished, limit=1") as $post) { $post->removeStatus('unpublished'); $post->addStatus('published'); $post->save(); } With cron it is triggered once a day and it will look for unpublished posts. If there are any, the oldest post will get published. Simple as that. I am using this script to update my photo blog https://photos.stephansimonis.com more regularly. ?2 points
-
Hi @netcarver thx I've just tried and I can reproduce this. It's a little weird because the sortablejs demos work fine! I'll have to look into this. Thx for the report ?2 points
-
I have a few RPB blocks in _main.php. Nowhere else. When editing HOME and I make no changes, PW warns me about loosing changes all the time. Although no changes have been made. At first it all worked fine, but somewhere during the last few days, it started. I disabled RockMigrations and LiveReload temporarily, but no change. I am not sure how to troubleshoot this...1 point
-
For Flowbite's Javascript file, I just load that file manually. For CSS, I didn't realize they have a ready-to-go CSS file as well, but that seems kind of pointless since Tailwind (similar to UIkit and Bootstrap) would require a build process for it to be customizable. I simply use Tailwind CLI directly (without NPM). But as you mentioned, given the nature of how Tailwind works whereby it will only include classes if they are used, it makes using it for a page builder more complicated unless you safelist a bunch of classes. As far as not being able to use Flowbite for end products, yea that's a downside. But I don't think there's a problem configuring a page builder / RPB with blocks for a specific client and not general use. I'm preferring it over UIkit these days because doing CSS using pure utility classes has won me over as opposed to a mix of utility classes/separation of concerns (UIkit, Bootstrap) vs. pure separation of concerns. For example, I like that I can copy a block from Flowbite without any thought of it not working or having other styles in the cascade affect it, but at the same time having full flexibility to change it easily. Tailwind also just makes more sense for designs where you have to "color outside the lines" of a CSS framework like UIkit. It's horrific to look at all those classes when using it initially, but then you get used to it.1 point
-
Hey @adrian or anybody else, could you please check if you also get an error when deleting templates from the admin tools? Deleting fields works properly. Ouch… Fatal Error: Uncaught TypeError: Fieldgroups::___delete(): Argument #1 ($item) must be of type Saveable, null given, called in wire/core/Wire.php on line 416 and defined in wire/core/Fieldgroups.php:312 #0 wire/core/Wire.php (416): Fieldgroups->___delete(NULL) #1 wire/core/WireHooks.php (968): Wire->_callMethod('___delete', Array) #2 wire/core/Wire.php (484): WireHooks->runHooks(Object(Fieldgroups), 'delete', Array) #3 site/modules/TracyDebugger/TracyDebugger.module.php(826): Wire->__call('delete', Array) #4 wire/core/ModulesLoader.php (168): TracyDebugger->init() #5 wire/core/ModulesLoader.php (100): ModulesLoader->initModule(Object(TracyDebugger)) #6 wire/core/Modules.php (338): ModulesLoader->triggerInit() #7 wire/core/ProcessWire.php (775): Modules->triggerInit() #8 wire/core/Wire.php (413): ProcessWire->___init() #9 wire/core/WireHooks.php (968): Wire->_callMethod('___init', Array) #10 wire/core/Wire.php (484): WireHooks->runHooks(Object(ProcessWire), 'init', Array) #11 wire/core/ProcessWire.php (909): Wire->__call('init', Array) #12 wire/core/ProcessWire.php (665): ProcessWire->__call('init', Array) #13 wire/core/ProcessWire.php (613): ProcessWire->setStatus(2) #14 wire/core/ProcessWire.php (315): ProcessWire->load(Object(Config)) #15 index.php (52): ProcessWire->__construct(Object(Config)) #16 {main} thrown (line 312 of wire/core/Fieldgroups.php) This error message was shown because: you are logged in as a Superuser. Error has been logged. Please let me know if you need more info to debug this or if that error is only on my end. Thx!1 point
-
Thanks @bernhard - should be fixed in the latest version. It looks like at some point PW starting deleting the fieldgroup along with the template automatically, hence the new error.1 point
-
After reviewing RPB for a long time(and having a few issues) I now decided to use it in projects. But now... problems show up and I don't know how to approach this. Setup: A Onepager, SPA A few RPB fields like rockpagebuilder_events or rockpagebuilder_news ... with blocks assigned. RPB 5.0.3 PW 3.0.229 In this setup I don't need the title field in my blocks, so I sett them all to 'hideTitle' => true It worked. Some time after that I noticed that when adding a new PW page with no RPB blocks, just a simple PW for imprint or privacy ploicy, only the name field shows up, no title field: Even when creating a new template no default title is added. After generating a name and saving the new page no error about the required title is thrown. The page will be created with an empty title! After that the title fie3ld is shown. I commented out //hideTitle => true in a all blocks, but the problem remains. I manually deleted all cached and compiled files and now I am puzzled with this. No additional hooks or anything. Where do I look? What to do? How do I go about this? Could be connected to another problem I will post next.1 point
-
Update: Ok showing the error message was a good idea. I can now reproduce the issue. For me it happens when I remove the title field from a RPB block.1 point
-
Thanks!! I will check this later on, but for now I am working on the first issue .1 point
-
I'm not an expert ? but this sounds good. And another issue I had was this: I generate a page with the values of the submitted form. The filenames get sanitized after submitting. An uploaded Image.jpg is saved as image.jpg. So in order to save add the files uploaded to a page, you have to sanitize them. Because the values-array has the original filenames I did it this way: if($form->isValid()){ $p = new Page(); // create new page object $p->template = 'template_name'; // set template $p->parent = $pages->get(1111); // set the parent $p->name = $sanitizer->pageName($form->getValue('surname'), true); // give it a name used in the url for the page $p->title = $form->getValue('textField'); // set page title $p->save(); $p->addStatus('unpublished'); foreach($form->getValue('fileuploads') as $fileItem) { // // sanitizing // $sanitizer->fileName() did not work for me :( // $sFile = $sanitizer->pageName($fileItem, true); $p->images->add("https://domain.com/site/assets/files/{$page->id}/{$sFile}"); } $p->save(); } Maybe it be an option in the future to output the url of the image inside the values fieldarray?1 point
-
I had it on two installation in the past (Nov/Dez timeframe). But then not more. Both had RockMigrations, one had RockFronted - but they didn't had/have RockPageBuilder.1 point
-
I had the same issue and fixed it in the same way last year - i thought i changed the setting and was responsive for it - so i didn't report it.1 point
-
Hello @ngrmm Interesting aspect I have not thought of before ?! I am afraid, but there is no inbuilt method to prevent this. I am thinking of a creating a new validator (fe uniqueFilename) to check if there is a file with the same name present inside the given directory. If so the validator should throw an error. Maybe another possibility would be to add a new method to the file upload class (fe $field->renameDuplicates()), which renames duplicates by adding fe a number after the filename (fe. filename, filename-1, filename-2,...) What do you think?1 point
-
Ok this one is a very easy fix for everyone experiencing this! Just make sure that the title field has the global flag enabled: I don't know why or when it loses that flag yet, but I have it on 2 projects so it seems to be an issue. It would be nice to get some feedback if anybody else is experiencing this as well?1 point
-
Nope! No other Rockmodules.1 point
-
Ok first bug will be fixed in the next release. The field hints for rockmigrations messed up the field select, so if you saw something like the below that's history ? I'm working on the issue with having no title field now as that is something else unfortunately ?1 point
-
1 point
-
Yeah I don't think it has anything to do with that setting. It's related to RockMigrations I guess. I'm already searching and just killed my current project by disabling autoload for RockMigrations. Not a good idea if you are using MagicPages because then nothing will be usable any more, no frontend, no backend ? I had to add this at the very top of index.php and then enable autoload back to normal: require_once __DIR__ . "/site/modules/RockMigrations/classes/MagicPage.php"; Maybe someone finds this info helpful some day ?1 point
-
Ok I can reproduce this so I'll have a look into this instantly! I'll be back ?1 point
-
Thx. This one I have seen myself so it looks I need to fix this. These things are always hard to find as you never know where they are coming from, so a report like this is helpful as it says that it's coming from RockPageBuilder and not another module. BUT. Could you please provide step-by-step what you are doing and when you are seeing it? Because it does not appear when I'm just editing the homepage and then try to leave! There must be more steps involved?1 point
-
Thx for the report. I'm sure we'll be able to fix your problems! First of all it's weird what you experiencing. I've never seen this and I can't explain how that should even be possible. Have a look at what hideTitle does: /** * Hide title field if block has setting "hideTitle" */ public function hookHideTitleField(HookEvent $event) { $block = $event->process->getPage(); if (!$block instanceof Block) return; if (!$block->getInfo()->hideTitle) return; $event->return->remove('title'); } So for a quick test you could just add a "return" at the very top of this method in RockPageBuilder.module.php Let me know what happened ? Are you using RockMigrations or are you doing everything with the GUI?1 point
-
If you want to check your max upload file size, please add this code to your template: echo ini_get("upload_max_filesize"); This will output the value as set inside your php.ini file. You can see the line of code inside the InputFile.php: https://github.com/juergenweb/FrontendForms/blob/main/Formelements/Inputelements/Inputs/InputFile.php#L411 point
-
Good Morning @ngrmm By default, the file upload field takes care about your max upload file size value that has been set inside your php.ini (server config file). https://www.php.net/manual/en/configuration.file.php 2048 is the max file upload size as set inside your php.ini in this case. You can disable this behavior by adding the following rule to your file input field: $file1->removeRule('phpIniFilesize'); This disables the check of the php.ini max file size and you will get the desired result, but it is not the recommended way. If you have access to your server php.ini file, make your changes there and set a higher value for the max upload file size. If you have a local installation (fe. Xampp), you can change it by yourself, if you have a site on a shared host, maybe you will need to contact the server admin, if he can change the max. value for file uploads or you can login to your account and make your changes there. Hope this helps1 point
-
1 point
-
If you dabble in Tailwind some more, I strongly recommend using Flowbite, which is still pure Tailwind but with an added JS library that makes it more batteries included like UIkit and Bootstrap. Also there are free and premium blocks and layouts which I've purchased that speeds things up considerably while maintaining the flexibility of Tailwind. To me, it's the winner of the all the various Tailwind competing user interface kits (ie compared to Preline, Tailwind UI, Daisy UI, etc.).1 point
-
@Juergen thanks for the module. I tried this: $form = new \FrontendForms\Form('myForm'); … $file1 = new \FrontendForms\InputFile('fileupload1'); $file1->setLabel('Multiple files upload'); $file1->setMultiple(true); $file1->setRule('allowedFileSize', '100000'); $file1->setRule('allowedFileExt', ['jpg','jpeg','png']); $form->add($file1); $button = new \FrontendForms\Button('submit'); $button->setAttribute('value', 'Send'); $form->add($button); if($form->isValid()){ print_r($form->getValues()); } echo $form->render(); But it renders this for the fileupload: <form method="post" action="/path/" id="myForm" name="myForm-1705439668" novalidate="" autocomplete="off" class="form" enctype="multipart/form-data"> … <div class="fieldwrapper" id="myForm-fileupload1-fieldwrapper"> <label class="label" for="myForm-fileupload1">Multiple files upload</label> <div class="inputwrapper" id="myForm-fileupload1-inputwrapper"> <input id="myForm-fileupload1" name="myForm-fileupload1[]" type="file" class="input input-file" multiple="" onchange="showClearLink(event)" accept=".jpg,.jpeg,.png" max-size="2048"> <div id="myForm-fileupload1-clearlink-wrapper" class="clear-link-wrapper" style="display:none;"> <a id="myForm-fileupload1-clear" href="#" class="clear-link" onclick="event.preventDefault();clearInputfield(this); return false;">Clear the input field</a> </div> </div> <p class="notes">Please do not upload files larger than 2,0 kB<br>Allowed file types: jpg, jpeg, png</p> </div> … </form> Do I have set the attribute allowedFileSize in another way, so that it allows larger files?1 point
-
Hello, since a recent version, and because strftime has been deprecated in PHP 8.1, month and day names must be translated in PW admin, in file /wire/core/WireDateTime.php. Then you don't need to format date by yourself, it will be formatted according to field configuration.1 point
-
Create a script that does what you want (publish one page) Trigger that script once a day For (1) read https://processwire.com/docs/front-end/include/ and for (2) you can either use https://processwire.com/docs/more/lazy-cron/ or - the better solution - a regular unix cron if possible.1 point
-
Wow. Not 20 minutes later and after a little discussion @bernhard fixed this. Thank you very much.1 point
-
@rick Thanks, dude! OMG more reasons to love Processwire.1 point
-
Hello @Pip, 1. Go to Setup > Templates and click the template you want to edit. Processwire displays a list of fields. 2. Click the Title field and enter the new title text you want displayed. 3. Click save. You can change any Label of any field in any of your templates to better suit your requirements.1 point