-
Posts
365 -
Joined
-
Last visited
-
Days Won
5
Everything posted by Raymond Geerts
-
The Beach Boys before and after Processwire Before: After: https://www.youtube.com/watch?v=9kg-pYItaj8
- 38 replies
-
- 12
-
Yes indeed i noticed that already when something went wrong while uploading there still would be made a new page without an image. I have taken a look at your example script and the aproach you used is much better so that no images in the temp folder or pages without an image will stay behind. Thanks for the example
-
I have got it working now. But this will only work with 1 file upload. If anybody has a better way that also will work with multiple files please post it here $entry = new Page(); $entry->template = 'pollanswer'; $entry->parent = $qUpload; // setting the normal fields $entry->name = date("YmdHis").'_'.$sanitizer->pageName($fields['naam'], true); $entry->title = $fields['naam']; $entry->email = $fields['emailadres']; $entry->datetime = date("U"); $entry->save(); // instantiate the class and give it the name of the HTML field $u = new WireUpload('uploads'); $u->setMaxFiles(1); $u->setOverwrite(false); // have it put the files in their final destination. this should be okay since // the WireUpload class will only create PW compatible filenames $u->setDestinationPath($entry->img->path); // tell it what extensions to expect $u->setValidExtensions(array('jpg', 'jpeg', 'gif', 'png')); // set target filename as md5 hash to prevent showing original filename $parts = pathinfo($_FILES['uploads']['tmp_name']); $u->setTargetFilename(md5($parts['filename']).$parts['extension']); // execute() returns an array, so we'll foreach() it even though only 1 file foreach($u->execute() as $key => $filename) { $entry->img->add($filename); //$entry->img->eq($key)->description = $description[$key]; } // save the page $entry->status = Page::statusUnpublished; $entry->save(); Edit: in this example i used some variables that work specificly in my own website. For a working version you need to replace some values!
-
Is it possible to rename a file with WireUpload. I can image when the file is moved from the temp folder to the destination path there is a chance to rename it? For example i like to rename the file to some md5 hash. I have tried the following but that didnt rename the image: // execute() returns an array, so we'll foreach() it even though only 1 file foreach($u->execute() as $key => $filename) { $parts = pathinfo($filename); $u->setTargetFilename(md5($parts['filename']).$parts['extension']); $entry->img->add($filename); }
-
In my last project i used jQuery to set cookies. But that was merely because its used for some GUI settings and other user-interaction. I prefer jQuery / javascript above php because then you dont have to process the page server-side.
-
Congratulation Ryan and all contributors!!
-
Just installed it trough Module Manager too, works great as far i can see. Straight forward logic. Going to do some more testing comming monday when im at the office. Thanks for this. @Soma also thanks for the Module Manager that works realy nice and easy
-
Great! Going to try it tomorow asap, its now 1:30 night, must sleep. Thanks for this module! Field level access permissions FTW!
-
Ryan you are truely amazing. This should do the job exactly what i was needing. Thank you for this module! I just was wondering if the status value is enough in the folowing line: protected $denyFields = array('name', 'status', 'template', 'parent'); Because im still able to modify the "Hidden: Excluded from lists and searches" as a non super user But further it works fine, the non super user can not change the name value anymore
-
Thanks for explaining that, its now clear to me what the real purpous of the "Disable Settings Tab" checkbox is. I have a user which has only the access rights to view and edit pages with certain templates. Some pages in my site are hidden by purpous so that they do not appear in the menu displayed on the website. When that user logs in they can unhide the page because they have access to the settings tab. I would like to prevent that, so thats why i used the "Disable Settings Tab" checkbox for that. Is there a different way to prevent the user from being able to unhide a certain page? Also, but that is merely my own 'fault', i used the page name in a php switch to set certain variables and functions hardcoded. I probably should have used a different aproach for this for example the template name instead of the page name. But that is also one reason why i would like to have the settings tab not visable so the user can not change the page name.
-
When having set advanced to true in the config.php file of PW, then an extra tab called "SYSTEM" shows up when editing a Template. There it is possible to set a checkbox for "Disable Settings Tab". It would be nice to be able to have another checkbox to add the option to "Disable Settings Tab Not for Super Users". I'm not aware of any situation where one would like to disable the settings tab for the super user, but possible there is one or more cases that im not aware of. In my case i want to hide this settings tab to all non-super users, but have it available when im logged in as super user (admin) so that i can modify settings while developing new things. Now i have to uncheck "Disable Settings Tab" for all users so i can use it and check it again when im done editing. Then there is a chance any other non-super user that is logged in is also able to change settings from this tab on the regarded template.
-
Thanks Ryan, that works great
-
I found a way to check within a repeater template files if the repeater item is the first or the last if ( empty($page->prev-id) ) // first item if ( empty($page->next-id) ) // last item This gives the information that is needed, its a little work around but it works fine
-
This way it also gives an error message, but i probably wasnt realy clear with my explination Lets say i have a field named 'thingy' with field type repeater. I use the following code to print it to the page: foreach($page->thingy AS $data) { echo $data->render(); } then in the templates folder i use the file with the name 'repeater_thingy.php' in that i have something like this: $out = ''; $out .= "<div class='item'>"; $out .= "<h2>{$page->headline}</h2>"; $out .= "</div>"; echo $out; I need to know in the 'repeater_thingy.php' file what the item nunber is or even better if it is the first item.
-
I'm rendering a repeater field, so that i'm using a template file for a repeater item. Is there an easy way to 'ask' if its the first item, or what item numer it is in the repeater tempalte?
-
Repeater bug in PW 2.2.9 (2.2.8-2)
Raymond Geerts replied to Raymond Geerts's topic in General Support
Thanks for fixing this so fast. Downloading from GitHub now -
I noticed since last update of ProcessWire to version 2.2.9 (2.2.8-2 on GitHub) a bug is occuring with the repeater field. When editing a page a javascript error is shown when the repeater field "Add Item" is clicked. Error: TypeError: labelHTML is null Source File: http://local.site.com/wire/modules/Fieldtype/FieldtypeRepeater/InputfieldRepeater.js?v=100 Line: 93 I have set the "Ready-to-Edit New Repeater Items" to 0, when setting this number to anything above 0 it works fine.
-
Thanks ryan, the bug with honeypot as fieldname seems fixed now. I see it gives a warning now that the name is preserved
-
Amazing, you guys are fast as lightning
-
After editing and saving the form the following error keeps showing up when i want to edit the form: Recoverable Fatal Error Object of class FormBuilderField could not be converted to string (line 202 of C:\services\xampp\htdocs\wire\modules\Inputfield\InputfieldSelect.module) Last thing i remembered doing is adding a field of the type hidden with the name honeypot and editing a field of the type (single) select update: Just edited the form entry directly in the database, removed the hidden field from the JSON string solved the problem. Seems the bug is with the hidden field type.
-
Great work it easy to use. I just discovered a bug, is there a certain place to report it (here in this topic or elsewhere on the forum, or do you prefer github?)
-
Ok great, updating wire folder now
-
Thanks for the quick reply. Its a little confusing when the filename says its version 2.2.5.22
-
Nice to see PW has its own channel on freenode! Gonna take a look now