-
Posts
4,077 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
I don't know the "event-example". What is it? Where is it? (hyperlink?)
-
The processwire way is in 95% to use the API, and not to write directly to the DB. (Using direct access is for rare edge cases or maybe sometimes when create a module) PS: Ah, it is your first post here. Welcome!
-
wireshell - an extendable ProcessWire command line interface
horst replied to marcus's topic in API & Templates
@Richard: Hari KT said in his post he will send a PR (Pull Request) to WireShell. So it will be a one click step installer for WireShell, I think. -
So, when looking to all that pro sites that were published here the last time, I first thought better not to post this site. But second thought was: "Oh what the heck, they can not all be professionals here." So here it is, a small site for a little but very fine Italian Restaurant driven by a nice family. They wanted to have something like a webcard that holds their address, telephone number and opening times plus some impressions. http://bella-italia-aachen.de/ The site is build using pocketgrid css framework, less, flexslider.js, superbgimage.js and these modules: Spex & AIOM and CroppableImage & Pia.
- 3 replies
-
- 16
-
Now you have two more
- 4 replies
-
- 1
-
- website
- kindergarten
-
(and 1 more)
Tagged with:
-
WOW! Would you like to also submit it to the sites directory?
-
I think it is called $nativeNamesSystems and can be found in the core/Fields.php
- 1 reply
-
- 6
-
- reserved words
- protected fieldnames
-
(and 2 more)
Tagged with:
-
Hi phippu, interesting post. Maybe I can come back to this later, (im in hurry now), but want to note that you can use different sharpening methods with ImageSizer. It has 3 of those imageconvolution matrixes that only rely on the GD library. The values are: "soft", "medium" and "strong". and it has a USM implementation based on pur PHP-Code what is on by default and also uses those 3 paramnames. You can switch between them per global setting $config->imageSizerOptions["useUSM"] = true | false, or add it to your $options array on a per image base. You also can force the recreation on a per image base with adding "forceNew" = true | false to your $options array. (No need to delete variations manually or in an extra step) Ah, not to forget that the use of "defaultGamma" also affects the result: $options["defaultGamma"] = [0.4-4.0 | -1] (-1 is to disable it) You can add suffixes to image variation names per $options array: $options["suffix"] = [a-z0-9_-] By using suffixes you are able to create variations with different values for the same param avoiding overwriting them each other. A test setup for visual comparision of the possible sharpening outputs could be like that: $options = array('quality' => 100, 'upscaling' => false, 'forceNew' => true); $defaultGamma = array('dg0' => -1, 'dg1' => 2.2); $useUSM = array('usm1' => true, 'usm0' => false); $tests = array('s0' => 'none', 's1' => 'soft', 's2' => 'medium', 's3' => 'strong'); $image = $page->images->first(); foreach($defaultGamma as $k1 => $v1) { $options['defaultGamma'] = $v1; foreach($useUSM as $k2 => $v2) { $options['useUSM'] = $v2; foreach($tests as $k3 => $v3) { $options['sharpening'] = $v3; $options['suffix'] = $k1 . $k2 . $k3; $variation = $image->width(intval($image->width / 2), $options); echo "<p><img src='{$variation->url}' alt='{$variation->name}' /><br />{$variation->name}</p>"; } } } // (written in browser, not tested!)
-
At least you have to give them the permission "user-admin". And maybe other permissions like page-edit is needed too, but this I don't know for sure. But you can try it out.
-
@Neeks: Please add the link to this post, so that others can read it in full and also can get aware of the original context, authors etc.! https://processwire.com/talk/topic/9376-mysterious-white-line-wiretabs/
-
I would not use the $user var to get the saved value. I think it should be possible to call this: (but have not tested it yet) $id = $user->id; $savedLanguage = $users->get($id)->language->name;
-
Where is it done, the change on runtime?
-
ProcessWire does change the $user->language? What kind of language switcher you are using? A pointing link or code example would be helpful, or is it some example that comes with a PW site profile?
-
Exactly! That's what I have to do too. (First I will try to trick it by embedding the JS content in the head tag, not linking to it as external resource. If this will not bump up the result, I try to put it 10% beneath the body tag. If it will not bump up, I try to put it 20% beneath, etc. etc.) (what a bullshit!)
-
Ah, thanks for the explanation. It is very useful to analyze code or test it against scenarios, also if done staticly. But it also can do a lot of harm or result in the wrong direction. I give you a real live example about static analysis that happens to me right a few days ago: Google analyzes websites due to the user experiences with mobile devices. They have sent me a message with their analyzis result where they say that I have to change some things to full fit their requirements, otherwise they don't list those pages in search results requested from mobiles. One of their usefull tips and requirements is: I should avoid calling a JS-resource in the html head, I should not call external resources above the fold! Otherwise it would be not mobile friendly. (Tada!) But in fact, the resource I call there is a very little JS file that don't use dependencies, it just checks if the site is viewed by a mobile device. And if it detects a mobile device it sets some things to avoid overhead and loading of to many resources etc. (like limiting infinite adding to only 2 items instaed of 16 with a desktop, fetching way smaller images, adds a mobile class to the body tag to derive the correct mobile friendly CSS styles from it, etc.) You also should know that all other resources the page needs are: one google-fonts call, one minified css file, and one minified js file which is called just before the body close tag. Also this site uses ProCache and is responding quick like hell. As I can see, in this case it is pretty stupid and useless to follow some static rules, it results exactly in the opposite direction. (If I would call the mobile checker beneath the fold! it could be that there were already to much items (pre)loaded; that the content needs to be rebuilded, rearranged according to the to late added mobile class to the body tag; the fetched images were to big, etc. etc) In fact, the whole users experiences, including those on tablets and desktops (not only those on mobiles), depends on calling this little JS early! If they simply would have built in some logic, it could be a helpful initiative, but how it is used now it is dumb and ignorant.
-
You have answered your question by yourself already $user->language->name will not change, you said you switch the value of $currentUserLanguage, so you can query every time for $user->language->name again.
-
No sorry, this isn't possible.
-
A module yes. But instead to hook into upload, you also can hook into page::save or page::saveReady I think. It depends upon how you have organized your site. Have those unity project pages an own template or not etc. Or do you only upload html files to those pages and not in others too. At least it will work this or that way. You will find many posts with example code here in the forums. One that hooks into upload / fileAdd is here. page::save is here and page::saveReady here. But there are lots more
-
a single point I don't understand: What does it mean, good IDE support?
-
It is mostly possible to cache values or even markup. Don't know how your site works, but if it isn't updated every minute there is a good chance to cache and re-use the markup of your filter form. This would speed up things a lot.
-
I believe it only can used with field=value, not with path or parent. So, one may define and add a hidden field to that template and hook into page::saveready and populate this field with a true or false value regarding if the current page has that parent or not. my_hidden_field=1 If you want to go that road we can show some examples how to achieve that.
- 10 replies
-
- 1
-
- Inputfield Dependencies
- path
-
(and 1 more)
Tagged with:
-
Multiple templates for one page, like PHP traits, or "granular" templates?
horst replied to martin's topic in API & Templates
But I think the checkbox states are saved with the pages, or not? if ($pages->checkbox_bc) { // the fields bundled to "Basic Car" are in use You once have to manually note which fields belong to which subtemplate, (will be good if the fields will not grow in the future) or you stick with a naming scheme and iterate over all template fields to get that information. Maybe not very elegant or high dynamcly, but a fast way to get the job done. EDIT: $subtemplateIds = array('bc'=>aray(), 'fwd'=>array()); foreach($page->template->fields as $field) { foreach(array_keys($subtemplateIds) as $k) { $fn = $field->name; $len = strlen($k) + 1; if (substr($fn, 0, $len) == $k . '_') { $subtemplateIds[$k][] = $fn; } } } // later on you can check like: if ($page->checkbox_bc) { // use also all fields from $subtemplateIds['bc'] } (written in browser, be careful ) -
XML feed importer to map to new pages and fields
horst replied to aaronjpitts's topic in General Support
Yipieh! Looks like a task for an importer script! The XML has <DocumentID>123456</DocumentID> what seems to be the boat-article-ids. So, you can go with it manually via importer script, or first have a look for getting a PHP conversion lib that converts xml to csv and then maybe use the CSV module for importing. But it is also very easy done manually with an importer script, (bootstrapping PW, running via cron or via PWs lazyCron). If you need any further explanation, please ask here. EDIT: @Adrian beats me a few seconds -
Multiple templates for one page, like PHP traits, or "granular" templates?
horst replied to martin's topic in API & Templates
Na, there is also PageTable and PageTableExtended available. -
Multiple templates for one page, like PHP traits, or "granular" templates?
horst replied to martin's topic in API & Templates
Is it needed for the Backend Editmode? What's about to simply have one template with some fieldsets, each fieldset contains a few fields (those you mentioned in your subtemplates) and the visibility of the fieldsets are bound through checkboxes and the onlyShowIf settings for templates? | Select granule Subtemplates: | | | | [ ] use Basic-Car | [ ] use Diesel-Engine | [ ] use Turbo-Engine | [ ] use Four-Wheel-Drive | | | | Select granule Subtemplates: | | | | [x] use Basic-Car | [ ] use Diesel-Engine | [ ] use Turbo-Engine | [ ] use Four-Wheel-Drive | | | |--- Basic car -------------------------------------------------------------------------------| | | | BC_textfield_1 BC_ceckbox_1 ... | | | |---------------------------------------------------------------------------------------------| | Select granule Subtemplates: | | | | [x] use Basic-Car | [ ] use Diesel-Engine | [ ] use Turbo-Engine | [x] use Four-Wheel-Drive | | | |--- Basic car -------------------------------------------------------------------------------| | | | BC_textfield_1 BC_ceckbox_1 ... | | | |---------------------------------------------------------------------------------------------| |--- Four-Wheel-Drive ------------------------------------------------------------------------| | | | FWD_textfield_1 FWD_ceckbox_1 .... | | | |---------------------------------------------------------------------------------------------| - Pseudocode is like: only show Fieldset_BasicCar if Checkbox_BC is checked