Leaderboard
Popular Content
Showing content with the highest reputation on 06/25/2016 in all areas
-
Foundation 6 Minimal site profile for ProcessWire This profile is based on the "minimal site profile (intermediate edition)" and bundled with Foundation 6. This precompiled version can be downloaded at github. Features Foundation 6 framework Font-Awesome MeanMenu Slick Carousel (Why not Orbit ?) Render / helper functions for : Simple ul navigation Foundation Multi-level topbar MeanMenu - Responsive menu for mobile device Slick Carousel Foundation Accordion Foundation Callouts Jumbotron Dependencies jQuery How To Install Download the zip file at Github or clone directly the repo with git clone and skip the step 2. Extract the folder site-fdn6-precompiled into a fresh ProcessWire installation root folder. During the installation of ProcessWire, choose the profile "ProcessWire Foundation 6 profile". References Foundation 6 documentation ProcessWire documentation MeanMenu documentation Slick Carousel Documentation Credits The ProcessWire staff Screenshots11 points
-
Does using dedicated module files help a lazy programmer? For a private helper module I wanted to built, I decided to use the possibilities of dedicated files (implemented in PW 2.5.5) and not to write all into a single module file. Until now, I totally missed or forgot about this possibility. To my excuse: on introduction I may have thought not to use it early in my modules to keep backward compatibility. And then totally forgot about it. I allready use a tool for postprocessing in my sites. And I'm not familiar with all those popular node/grunt/gulp/npm/bower/and-what-else stuff out there. It looks to me a bit oversized for small to medium websites. But I also wanted not miss a comfortable, easy to use config for less and sass files, especially for those from frameworks like Bootstrap 3 / 4 or UIKit. So, what my toolbox should get added was a preprocessor (compiler) for sass (.scss) files first. I choosed the UIKit for the first shot. The created files for a configurable module called PreAndPostProcessor and a process module called ProcessPreProcessor were: PreAndPostProcessor.module PreAndPostProcessor.info.json PreAndPostProcessorConfig.php ProcessPreProcessor.module ProcessPreProcessor.info.json ProcessPreProcessor.css ProcessPreProcessor.js As you can read about the differences to the old-schooled style in Ryans blog post, I focus on what I found out to be most useful for me. Starting with the Config file, I decided to use the $this->add() method in the __constructor(). It is the way what needs less code to define your inputfields for a configpage: just a collection of arrays with field or fieldset definitions. Mandatory definitions are: type, name, label. Others are optional: description, notes, required, columnWidth, collapsed, showIf, ... And, of course, you need the definitions specific to your fieldtypes (value, options, ...). To group some fields into a fieldset, add a key called "children" to the fieldset array and add all field definitions to it as collection. Simple! Another nice thing I discovered, is the use of the *.info.json files. So, this I have used before, but not like here. The behave is like with the *Config.php files, - you write really less code, just arrays with key - value pairs and PW does the rest for you! Only difference here is, that you have to write it in JSON notation. The ProcessPreProcessor.info.json file contains the neccessary and common parts: title, version, requires. And some others: permission, permissions, page and nav. Page and nav are specific to Process modules. With page {name, parent, title} you define where PW should create you a page in the admin, and with nav, you can define a complete submenu for this page. For those who are yet not familiar with the internal structure of Processmodules: you can navigate to a submenu entry by calling it: {pw-admin-url}/{main-module-url}/{submenu-url}/. Calling the main menu url invokes the ___execute() method of the module. Calling a submenu url invoke the ___executeSubmenu() method. This all is really simple and straight forward. And it is really really helpful in cases like with the new toy for my toolbox. The nav is a collection of arrays, each holding at least an url and a label. Thats enough for PW to implement the menu and submenu for you in the admin. But you also may define an icon too. Aaaand, you also can add your own custom key / value pairs to it. PW does not complain on it. I have added a description. The nav was generated by parsing all core distribution scss files from the UIKit. They have a name and description in their first two lines. I programatically read this out and generated this nav notation for the info.json file: The (main) ___execute() method of the ProcessPreProcessor.module should present a submenu list with file infos. This now could be done by parsing the info.json file: public function ___execute() { // generate a navigation $dump = json_decode(file_get_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.module') . '.info.json')); $nav = $dump->nav; $out = "\t\t\t<dl class='nav hnpp'>\n"; foreach($nav as $obj) { $out .= "\t\t\t\t<dt><a href='./{$obj->url}'>{$obj->label}</a> ></dt>\n"; $out .= "\t\t\t\t<dd>{$obj->description}</dd>\n"; } $out .= "\t\t\t</dl>\n"; return $out; } To make it even more friendly for lazy devs, , I created one method that is called from all sub-execute methods by simply passing their own name over into this function that loads and parse the scss file and displays its config page: The first version work out nicely. Here is a screenshot of it: ... and to answer the initial question: Yes, it does!4 points
-
This week we have a few nice tweaks for those using multi-language support and translation tools in ProcessWire. Plus improvements to the 2.8.x branch, and a new feature for repeaters. https://processwire.com/blog/posts/pw-3.0.23/3 points
-
There's not even the need to manually count the number. foreach($page->children->getValues() as $key => $child) { if($key % 2 == 0) { // even } else { // odd } }3 points
-
3 points
-
2 points
-
Version 0.2.3 is uploaded, and it's also available from the Modules Directory: http://modules.processwire.com/modules/admin-on-steroids/ new submodule NoAnims: disable all admin animations (CSS & JS) fix for module repository update showing "Requires 0.0.0 >= 0" (reported by matjazp) CSS fixes2 points
-
2 points
-
See Arjen's post for more info, but for your case would be more than enough to use the PHP classical way: $i = 1; foreach($page->children as $child) { if($i % 2 == 0) { // even } else { // odd } $i++; }2 points
-
Hey Hendrik, In this thread you'll find different solutions. No pun intended and I don't know if you've searched, but next time you could try Google first. The forum is loaded with great examples. Try some variations on keywords.2 points
-
@Ivan Gretsky me too! This might be covered already (I've been offline for a week) but you can use the newspaper icon on the top right to access the new content. Only noticed it this morning. Overall, I really like the new forum presentation. There's a little getting used to the new layout but that's only because I've used the old layout almost every day for the past 3 ish years. Well done @Pete and co.2 points
-
Maybe I'm not understanding you right, but can't you search for pages that contain the repeater fields and then get the repeater items for those pages? I think (based on the code you showed in this thread) that the fields you are filtering and sorting on are fields in the get-for page rather than fields that are necessarily inside the repeater items so it seems like what you want to be finding are the get-for pages. Another general idea that might be useful: if you look at the page structure around repeaters in the Admin section of the tree you see that the repeaters parent name is "for-page-1234" where 1234 is the id of the page the repeater is on. So if you want to search for repeater items directly with a $pages->find() you could first construct an array of parent page names to use in the selector. Something like: <?php $get_for_ids = $pages->find("foo=bar")->each("id"); $parent_names = array_map( function($item) {return "for-page-$item";}, $get_for_ids ); $parent_names = implode('|', $parent_names); $repeater_items = $pages->find("template=repeater_my_repeater, parent.name=$parent_names");2 points
-
Thanks, Arjen for your help! I found a solution in your post: I guess this is developer-basics. Now I learned this one too. Thank you! And yes, you are right. I've indeed searched, but not so thoroughly I probably should. I'm a little bit in a hurry right now. Sorry and Thanks again! @diogo: Thank you too Didn't saw your post. This was what I did.1 point
-
1 point
-
just remove the namespace. The code should be : <?php include_once ('./index.php'); // bootstrap try { $mail = wireMail(); $mail->to('someone@domain.com'); $mail->from('root@mydomain.com', 'My Company'); $mail->subject('My subject'); $mail->bodyHTML('My message body'); $mail->send(); } catch(Exception $ex) { echo $ex->getMessage(); } Does it work ?1 point
-
Could you tell us which version of ProcessWire you are using please ?1 point
-
You could just set a bookmark to the Recently Updated Topics page (or to the Unread Content page). Or even make it the start page of your browser...1 point
-
Hi, You could do something like that, assuming you are on PW-3. Create a file called testwiremail.php in the root directory and add the following code : <?php namespace ProcessWire; include_once ('./index.php'); // bootstrap try { $mail = wireMail(); $mail->to('someone@domain.com'); $mail->from('root@mydomain.com', 'My Company'); $mail->subject('My subject'); $mail->bodyHTML('My message body'); $mail->send(); } catch(\Exception $ex) { echo $ex->getMessage(); } Now you can navigate to http://mydomain.com/testwiremail.php1 point
-
Well there's quite a few things lacking if you ask me, CC, BCC, attachments, batch mode on/off. I don't know if these are mail() constraints, I never use that thing. Basic things in email protocols are left out I believe because you could hack things up with the headers method, but that's far from an obvious thing especially for beginners. I don't have much preference on adding to the WireMail class, or having a supplemental interface to implement, or else. Personally I believe the interface specification for send should not be an int, but a true-ish or a false-ish value. Many ways of sending mail don't return numbers sent, but will tell you if it went ok or not. By the very nature of email, it could take hours/days until an email is certified as being accepted by the receiving servers, and some email servers don't even return accept/decline messages. true/1…n should be correct return values for success, false/0 should also be correct for failure. It's just a matter of documenting it and using == instead of ===. It's all fun insisting on integers but if we can't realistically meet those requirements it's just for show..1 point
-
I'd like to see that, too, especially as it's probably only left out because it wasn't part of the pw native implementation. Maybe we could just have a WireMailAttachments interface for that?!1 point
-
cool that you found the selectize inputfield.. hope it works well and let me know if you run into any issues or requests. In combination with the custom PHP option it opens up to almost anything.. hope to be releasing an ajax version sometime in future..1 point
-
@adrian Wow you're fast, thanks for testing I hope it solves the problem! Btw I didn't know that you can pass a filename to Page::render(), so learned something new today (again) Cheers1 point
-
Thanks Wanze - very good point! When I wrote that module I initially had things set up quite differently such that it required rendering the template file directly. More recent changes mean that it no longer needs to do that. Rendering the page directly (like you noted) works fine here, so I will make that change to the module anyway and hopefully it will solve the problem with TEF. PS New version with this change just committed.1 point
-
If you manipulate this method (the only one) in PagesPaginatorNoDuplicates.php you could log or otherwise store found pages/selectors for each separate part. The resulting list is just a pagearray, where new pages are appended one after another. protected function getItems($selector, $key, $start, $limit, $storage) { $selector = $selector . ", start=$start, limit=$limit, id!=$storage"; wire('log')->save('paginator', $selector); $pa = wire('pages')->find($selector); wire('log')->save('paginator', (string) $pa); return $pa; } The class(es) itself do not order things. It could be that $start / $limit values are off, but these are tested, so they should work. Could also be that some selector of yours is not working as you expect it.1 point
-
New version just committed that takes care of most of the problems/suggestions that @bernhard noted above. The console code is now also saved to LocalStorage as you type. I am also hoping that the conflict issue that @Macrura brought up is also fixed. Please let me know! PS - the issue with the garbled code in the "open in window" mode was very painful to fix, but at least I learned a lot more about the inner workings of ACE and the Tracy core from reading through the source code. I discovered a nice shortcut for when you want the "open in window" mode - simply SHIFT+CLICK on an icon in the debug bar to avoid going through the FLOAT mode first.1 point
-
Updated the module to version 1.1.0 which adds the following features: Multiple data can be passed to the template engine via setArray() (alias: setMultiple()) The module now provides a second API variable $factory returning the singleton instance of the TemplateEngineFactory, which can be used to load partial views and chunks Chunks: Reusable code snippets that consist of a PHP file containing the logic and a template (view) to render the output (see https://github.com/wanze/TemplateEngineFactory#chunks) Thanks @justb3a for the contributions! Twig and Smarty modules were updated as well, shipping with the newest version of Twig/Smarty. I tested the module on the latest ProcessWire 2.7 and 3.x and everything worked fine. Let me know if you find any issues! Cheers1 point
-
So we could build some profiles based on a supported frameworks - ie: uiKit here - bundled with the module and play with it directly from PW ? oh and WOW !1 point
-
Thought I would release a pretty simple module I made that integrates the awesome OneLogin PHP SAML toolkit into ProcessWire so you can use SSO with your ProcessWire website. Mainly developed for my own purposes as I have used SAML plugins with WordPress for many years and now that ProcessWire is my go to CMS I sort of missed the convenience of having SSO between sites and services. This is my first attempt at a ProcessWire module, it's probably not the best in terms of code, but it has been pretty stable in my tests. Here's a little demonstration of the module in action https://www.youtube.com/watch?v=YWcsV6RTh90 GitHub repo and Installation Instructions https://github.com/adamxp12/ProcessWire-SAMLAuth Any feedback would be appreciated. Even though this is quite a niche module.1 point
-
In basics my opinion is very simple, when removing stylesheets & scripts, the leftover should be good structured and meaning full Markup. Not markup that is designed to make it look better. What you see a lot in the so called frameworks is a grid system based on rows and columns. In most use cases those row divs are purely there for visualising, and they div(ide) content where the content should not be divided. Classes are meaningless for Markup, what I mean by this is that a <p> stays <p> even when the <p> has a class. So my opinion: classes are perfectly valid for visuals without altering the meaning. Pseudo elements can really help to make your markup as meaningful as possible. With pseudo you can left out that break, clear a float, etc etc, without using markup. Some people point out that html should be re-useable, so classes can be a 'pain in the ass', but my opinion is different for this as I haven't had a single project where I re-used big blocks of HTML.1 point
-
That the css way. You can also use php to achieve this: $i = 1; foreach($page->repeater_field as $repeater) { $i++; // 2, 3, 4, 5, etc $odd = $i % 2 == 0; if ($odd) { echo "<div class='item-$i item-odd'>"; // Use .item-1, .item-2, etc to style /* OR */ echo "<div class='item-$i item-odd' style='background:{$repeater->color_field}'>"; // Or use a the color field by soma to select color in repeater echo $repeater->text; // Left echo $repeater->image; // Right echo "</div>"; } else { echo "<div class='item-$i item-even'>"; echo $repeater->image; // Left echo $repeater->text; // Right echo "</div>"; } } This could be written less verbose, but I think it gets the point accross.1 point
-
For such situations the profield matrix repeater module is a good option. It saved me a lot of headaches I would have faced if I have gone the ckeditor route.1 point
-
These days I would handle this issue with CSS: div:nth-of-type(even) { } div:nth-of-type(odd) { } But since it took me a while to understand this modulus operator stuff I'll give you an example: <?php $i = 1; foreach($page->repeater_field as $repeater) { $i++; // 2, 3, 4, 5, etc echo '<div class="' . ($i % 2 == 0 ? "odd-item" : "even-item") . '">'; // % is the modulus operator echo '</div>'; }1 point
-
A feature request: Sass support (specifically SCSS). Thanks!1 point
-
How about such a syntax? I think this would be flexible enough for any kind of tagging structure. // Get me the tags, // which start with "Tech_", // are used in the tags field of "templates=posts, date>today" // and sort them by number of occurences (maybe named count) $pages->find("template=tag, title^=Tech_, in.tags=[templates=posts, date>today], sort=occurences"); // Not limiting to upcoming posts or even posts $pages->find("template=tag, title^=Tech_, in.tags=[*], sort=occurences");1 point