-
Posts
4,077 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
No, there are no errors! It was just a thought / explanation that, even if someday there would be one, I simply can disable it.
-
How do you have done the move? What local system are you using (win / mac / linux)? Have you emptied all caches, especially filecompiler? (You can use @Somas ClearCacheAdmin for this, fe.)
-
I want to add my 2 cents too. @Soma: yes it maybe error prone, and yes some of these steroids should belong into the core. In the past we have had some small modules that tweeked a single thing in the admin, fe add more button functionality for pages directly in the page tree overview, your "page is edited reminder" to avoid accidentaly leaving a page without saving, and others. Over the time, many of this was included into the core. And I believe not all would have benn incorporated without becoming a module first. So, besides all the good steroids stuff here, there are two things I additionally like on AdminOnSteroids: 1) that it collects many usefull parts into a single collection, avoiding to deal with 10+ small modules, and 2) to have the ability to see (and early use) what all can be possible. Ah, there are more: 3) for Ryan it can be a good way to just try out things, and, hopefully incorporate some into the core than. 4) I can decide for every single feature to en- or disable it. I even can install AOS and have the unchanged default admin theme. So, if there is an error (CSS/JS) I simply can disable a feature or the complete module.
-
@loukote, has someone already said to you that you should grab a template, give it a document, tag and description fields? As addition to @Robin S, If you don't need to display those single document pages to the front, you don't need a template file. Just create a new template in the backend. Additionally to my addition: For those cases, doc repository, category repository, etc, I create two templates without a template file: a parent template (REPO) and a child template (ITEM) The parent template has the following setup: may pages have children: yes can this template be used for new pages: only one! allowed templates for parents: home allowed templates for children: ITEM show in the shortcut menu: no fields: only a title The child template has this one: may pages have children: no can this template be used for new pages: yes allowed templates for parents: REPO show in the shortcut menu: yes fields: a title and all what is individually needed! In the family settings of templates they are linked to each other. After setup the templates and creating the single allowed parent page in the tree, further no one can create repo items on a wrong place, and you can use the short cut dropdown in the admin for creating new entries! I propably do create the templates in two simultaneous opened tabs in my browser, because when creating the first one of them, I can not directly link to the other (as it doesn't exist yet). So I go to a second browser tab, create the other template, link it to the first one and save. After that, I can link the first one to the second one too, and I'm finished. And really, you don't need modules for such things, you simply use PW as it is to setup things individually. Simple, easy and fun! ------------------------
-
A view month ago, I finished a website for a local Car Dealer. It is based on handcrafted CSS with pocket grid. The dropdown menu is made in CSS, without Javascript. It also has a separate menu for tablets and one for mobile phones. On the intro page is a jssor animation. All background images are made by me. All other content is from the owner. Here are some screenshots how I designed the initial version: http://buescher-gruppe.de/
- 1 reply
-
- 8
-
Now I found out that the Tags get saved for me also under PW 3, but the form fields (Tags, Descriptions) got not populated via AJAX, so when the page finally gots saved in the page editor, the previously saved values get blanked out again. I HAVE USED THE WRONG HOOK! Damn! It has to be addHookBefore and not addHookAfter. I changed the code in the first post so that it now is working with PW 2 and PW 3. Sorry for the confusion. (I copied the function out of an old module into a $wire->hook for site/ready.php. Hereby I must have accidently changed to the wrong hook event. Damn!)
-
I have updated the code in the first post of it to also work with PW 3. But now I also get the tags not saved. I have asked on GitHub why this is not working anymore: https://github.com/ryancramerdesign/ProcessWire/issues/1920 I will investigate a bit more, but also hope that someone reads it on Github and can answer it. I have tested the code on a site with PW 2.7.2 and it worked for me before I posted it. I also will test your version on that site and report back.
-
Oh, you were right. WIth PW 3, p was false. I have updated the snippet and the page is now detected. But unfortunately, the tags don't get saved, what puzzles me a bit. I try to find out what may have changed here and will update the code then. We have had changes to the images field with PW 3.17 / 3.18. Maybe that's why it is different now.
-
Why? This code is running for me over different PW versions from 2.3 till today. (at least 2.7.2) What PW version are you on?
-
Ok. // code snippet that belongs into the site/ready.php file: // a hook that reads IPTC keywords on images upload and populates them into the images tags field $wire->addHookBefore("InputfieldFile::fileAdded", function(HookEvent $event) { $inputfield = $event->object; // handle to the image field if(!$inputfield instanceof InputfieldImage) { // we need an images field, not a file field return; // early return } if(version_compare(wire('config')->version, '2.8.0', '<')) { $p = $inputfield->value['page']; // get the page, PW < 2.8 } else { $p = $inputfield->attributes['value']->page; // get the page, PW >= 2.8 | 3.0 (or only from 3.0.17+ ??) } $image = $event->argumentsByName('pagefile'); // get the image // check for IPTC data $additionalInfo = array(); $info = @getimagesize($image->filename, $additionalInfo); // read image markers if($info !== false && is_array($additionalInfo) && isset($additionalInfo['APP13'])) { // APP13 is the IPTC marker $iptc = iptcparse($additionalInfo['APP13']); // IPTC field 025 = keywords collection if(is_array($iptc) && isset($iptc['2#025']) && is_array($iptc['2#025']) && count($iptc['2#025']) > 0) { $tags = array(); foreach($iptc['2#025'] as $k => $v) { if(empty($v)) continue; $tags[] = trim(strtolower($v)); } $p->get($inputfield->name)->trackChange('tags'); // prepare page to keep track for changes $image->tags = implode(' ', $tags); // add the tags list as string $p->save($inputfield->name); // save the page images field } } }); EDIT: code was modified to detect $page also with PW version >= 2.8 | 3.0 EDIT 2: Now it is working for all PW versions again. Had have the wrong HookEvent used here (addHokkAfter, but must be: addHookBefore!)
-
Hi welcome to the forums, I never dived into this, because I prepare my images before uploading and all other is done automagically. There are also solutions like somas Images Manager, and others too. But I don't know what or how these tools work out in this regard. But just a question: "Would you be able to add IPTC keywords locally to your images before uploading?" If yes, then I can give you a codesnippet that imports all keywords into image tags, and (optionally) another IPTC field into the image description, on uploading. Locally programs can be Adobe Bridge, IrfanView, and many others.
-
This depends on if there is only one VAT %. In germany there are two, or three: 0% 7% 19% If there are multiple VAT % possible, I think it is better to maintain with the saveReady hook, and if one day the VAT will adjusted to another % value, run the bootstrap script again. But if there is only one VAT %, @Robin S solution seems to be better. If this is the case, I would add a property hook to $page, that gives me the VAT-include calculated value. (I think, this is what Robin have in mind too.) EDIT: Ah, totally silly. Robins solution is better, regardless if you have one or multiple VAT % values.
-
You need a bootstrap script that should be located besides the PWs index.php. I have a template for that: After you have setup all your products, I would write a hook into the site/ready.php. Hook into before pages save, check if it is a productpage, if so, calculate the incl. vat price and populate it to the field, Ready!
-
Hi! Very good initiative! I have skimread through the code and my opinion is: The first and second ones looks good. But to be honest, this hotswap user thing is a big security issue. Sorry! Also only for demonstration / tutorial purposes, it is better not to use hot user swapping as a thema. The audience for beginner tutorials often will be, yes, the name says it: beginners. And assumed they simply do not know about such security issues and best practices in regard of how to validate user-inputs, you should not show code like this to them. At least you would need to embedd all security relevant stuff too. But then it fastly will become to complex for a beginner tutorial. A good one would be to only pick up how to validate user inputs and how PW provides good tools for that. (type and format validation, whitelist matching, ...) With your code, everyone can login with each existing account (also Superuser) just by knowing / trying (multiple til endless!) user name(s). In regard to this, you may have a look into ALIF or TracyDebugger, how the security for this is tackled there. I hope you do not mind me my frankness. ------------- Looking to the code of the users redirect module, you can shorten it a bit. When found a matching user / role, you don't need to store true in a temporary var, break the loop and then check the temporary vars value / state, if you should redirect the current user. You simply can redirect the current user if a role matches: /* * ___renderPageRedirect * * redirect user to page if current user role found in config */ public function ___renderPageRedirect($event) { // check to see if current page = admin template page // otherwise: early return! if($this->page->template != "admin") { return; } // find roles set in module configuration and create array $roles = explode(',', $this->userRoles); // for each user in module config check to see if current user foreach ($roles as $key => $val) { $roles[$key] = trim($roles[$key]); // if current user found then redirect = true if($this->user->hasRole($roles[$key])) { // this will leave the page and code immediately! $this->session->redirect($this->redirectPage); // stop user search break; // this can stay in here, just as fallback, // if something went wrong with calling the redirect, // but normally this line will not get executed. } } }
-
Have made some updates to ALIF: 1.1.0 fixed a bug in method sanitizeColor() 1.1.1 added detection and a toggle button for TracyDebugger (enable/disable) 1.1.2 more security for User-Switcher, (stays in for cases, where TracyDebugger isn't available) http://modules.processwire.com/modules/admin-links-in-frontend/
-
Why Aligator with one "L"? Maybe it is first name, last name? First Name: Ali Last Name: Gator
- 15 replies
-
- nested
- navigation
-
(and 2 more)
Tagged with:
-
@rickm this is answered discussed already, but can not find it yet. BUt the good news is, you can use PW 3 right now with PW 2.7 modules or earlier ones. To get more informations you should google in blog posts with the term: FileCompiler https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/
-
I would exclude *.min.* per default. I think no one uses this for his work and adding ToDo comments.
-
Once more but last one too: I strongly suggest to read the php docs on how to upload files: http://php.net/manual/en/features.file-upload.php
-
Yes you get random names because you assigned them to your variables. If you don't like them, don't assign them. $photo=$filetemp = $_FILES["photo"]["tmp_name"]; This has nothing to do with my module nor with PW. I suggest to follow up with the php docs on how to upload files, followed by how to use it with PWs WireUpload class. There you also have validation options for filetypes. IMO this is essential knowledge in regard of security to your website. Open it for uploads must be done in a secure way. Therefore you must understand, at least to a small extend, what you are doing.
-
From where do you get the file(s)? Can you please show this exact code snippet? (and only this, please) The module is working fine. It just uses what you passes to it. So, you probably do something wrong in regard of your filenames / files passing to the module.
-
Hi, first thing, if you have a question regarding a module, please use its support board thread! One solution to determine / validate filetypes would be to check the magic bytes. Imagetypes that are supported by the native php function getimagesize can be detected by that function.
-
These are two different things: subcriber system and newsletter sending. I suggest to first read / post in the NewsletterSubscriptionModules forum support thread to get this working. In regard to newsletter sending, I suggest to use a service and / or use a module like: http://modules.processwire.com/modules/wire-mail-mandrill/ http://modules.processwire.com/modules/wire-mail-mailgun/ http://modules.processwire.com/modules/altivebirit