Leaderboard
Popular Content
Showing content with the highest reputation on 02/04/2013 in all areas
-
Only a very very minor thing, but it would be nice if the field name input was restricted to 58 characters (64 for the mysql limit less the 6 for the 'field_' prefix that gets prepended), so that we don't get an error message and have to fill everything out again.4 points
-
This module tracks changes, additions, removals etc. of public (as in "not under admin") pages of your site. Like it's name says, it doesn't attempt to be a version control system or anything like that - just a log of what's happened. At the moment it's still a work in progress and will most likely be a victim of many ruthless this-won't-work-let's-try-that-instead cycles, but I believe I've nailed basic functionality well enough to post it here.. so, once again, I'll be happy to hear any comments you folks can provide https://modules.processwire.com/modules/process-changelog/ https://github.com/teppokoivula/ProcessChangelog How does it work? Exactly like it's (sort of) predecessor, Process Changelog actually consists of two modules: Process Changelog and Process Changelog Hooks. Hooks module exists only to serve main module by hooking into various functions within Pages class, collecting data of performed operations, refining it and keeping up a log of events in it's own custom database table (process_changelog.) Visible part is managed by Process Changelog, which provides users a (relatively) pretty view of the contents of said log table. How do you use it? When installed this module adds new page called Changelog under Admin > Setup which provides you with a table view of collected data and basic filtering tools See attached screenshots to get a general idea about what that page should look like after a while. For detailed installation instructions etc. see README.md.1 point
-
ProcessWire Concatenate Fieldtype Fieldtype that concatenates the values from one or more other fields at runtime. The value can contain additional formatting and/or words as needed, which you define in your Concat field settings. Example Problem: Your system has a first_name and last_name field, and you want to have a separate full_name field composed of first_name and last_name, without redundancy. Solution: You would create a new Concat field, click the details tab, and enter "first_name last_name" (the fields you want to concatenate) in the settings. Other Potential Uses Having a field that combines the value of two or more others, without the redundancy of separately stored data. Defining a custom “label field” for select boxes, like those used with the Page field. Defining a custom label for your Page List that includes your own formatting. Defining an alternate variation of a text field that uses a different text formatter. Considerations The value for this fieldtype is generated at runtime and thus no data is stored in the database. This is good because there is no duplication. However, it also means that you cannot directly query a Concat field from $pages->find(), for example. If you happen to change the name of a field being used in a Concat field, you will have to update the name in your Concat field settings as well. By design, Concat fields do not inherit the text formatters of the fields they concatenate. You define these separately with the Concat field. Because this is a runtime-generated field, there is no Inputfield associated with it. How to Install Install the module by placing FieldtypeConcat.module in /site/modules/. Check for new modules on the Modules screen in the ProcessWire admin. Click Install for the Concat Fieldtype. How to Create a Concat Field Under Setup and Fields create a new field using type Concat. After entering the new field name and label, click Save. Click the Details tab and enter one or more field names. Separate them with whatever spacing and punctuation is appropriate. Optionally choose one or more Text Formatters. If you are not sure which, “HTML Entity Encoder” is a good default to use. Save. Add your new field to one or more Templates. How to access the value of a Concat field This is no different than accessing the value of any other field. If your Concat field has the name “full_name” then you would output its value like this: echo $page->full_name; Download PW Modules Site: http://modules.proce...eldtype-concat/ GitHub: https://github.com/r...FieldtypeConcat1 point
-
ProcessWire is fast. With ProCache, ProcessWire is insanely fast! ProCache provides the ultimate performance for your website by completely bypassing PHP and MySQL and enabling your web server to deliver pages of your ProcessWire site as if they were static HTML files. The performance benefits are major and visible. Using ApacheBench with the homepage of the Skyscrapers site profile, we completed 500 requests (10 concurrent) to the homepage. The amount of time occupied to complete each of these was as follows: 29 seconds: no cache enabled 6 seconds: built-in cache enabled 0.017 seconds: ProCache enabled As you can see, the performance benefits are substantial. ProCache gives you the ability to drastically reduce server resources and exponentially increase the amount of traffic your server can handle. This is especially useful for traffic spikes. Beyond measurements, ProCache makes your website feel faster to users, respond faster to search spiders (which can help with SEO), and helps to conserve server resources for requests that actually need PHP and MySQL. ProcessWire is already very fast, and not everybody necessarily needs what ProCache delivers. But regardless of whether you need it or not, there is little doubt that you can benefit greatly from ProCache. For an example of ProCache in action, visit processwire.com or the skyscrapers site. Look in the lower right corner of the page (in the footer). If it says "ProCache", it means the page was delivered via ProCache. We did this for demonstration purposes (ProCache does not put anything in your markup unless you tell it to). More information about ProCache can be found on the ProCache documentation page. Please note There is a known issue when using ProCache with the LanguageLocalizedURL module. I hope to have this figured out soon, but for the moment you should not use ProCache in combination with that module as it doesn't appear to work in full. ProCache does not yet support multi-host capability (i.e. cache and delivery of different content per hostname), but it will very soon. How to get it Like with Form Builder, ProCache was produced as a commercial module to support development of ProcessWire. It is now available for purchase here. ProCache is in a beta test period. As a result, it's being offered with introductory pricing that may increase once we're out of that period. During the beta test period, I just ask that you let me know if you run into any bugs or issues during your use of ProCache. I also recommend that you follow the usual best practices with regard to backing up your site and testing everything before assuming it's all working. Beyond the introductory pricing, you may also use coupon code PWPC-BETA for 10% off the listed prices at checkout. This code will expire as soon as we're out of beta. When you get ProCache, you'll also get 1-year of access to the ProCache-members support and upgrades board, available here in the ProcessWire forums. Upgrades to ProCache will also be posted there for download. Disclaimer: At the date/time that I'm writing this, I think that I am currently the only one using ProCache in production use. That's why I'm providing it with the lower costs and coupon. If you are running production sites where everything must always work perfectly, you will either want to: 1) wait to install on important sites till it's out of beta; or 2) test thoroughly on a staging server or localhost before taking it to production use. In either case, always make sure you have good backups anywhere you install new modules, and always test to double check everything works how you want it to. Get ProCache Now ProCache Documentation Below are a few screenshots that show the configuration screens of ProCache. Have questions about ProCache? Please reply to this topic. Thanks for your interest in ProcessWire ProCache!1 point
-
Another approach you might take is to copy ProcessPageAdd.module to /site/modules/ProcessPageAddDoolak.module. Edit the file, and rename the class to be the same too. Then go to Modules > Check for new modules, and add your version of it. Go and edit the 'Add' page (Which is here: Admin > Page > Add). Change the 'Process' field from ProcessPageAdd to ProcessPageAddDoolak. Now you have full control over the page adding process.1 point
-
1 point
-
I've seen a couple of these myself happen due to malformed markdown links, it's reproducible. To cause it - you take any page above the homepage, and add a special character (!@#$%^&*()) followed by a backslash. It'll throw the rootparent error. For example, http://www.example.com/news/*/ seems to throw it consistenly in LAMP, though not in a Windows environment for some reason. Not sure of the etiquette, perhaps I should've created a new thread rather than reanimate one that's over a year old?1 point
-
1 point
-
you can use the pagetype field for all these relations. It's just a mater of organizing your pages accordingly. So, taking your example, you could organize your PW tree like this: -people --john --doe --xico --... -organizations --acme --corporation --lda --... -industries --candies --guns --moon trips --... -types of people --nice --bad --so so --... Then, on the template for organizations you put a page field with "industries" as parent of the selectable pages (PSP), and on the template for people you put two page fields, one with "types of people" as the PSP, and the other with organization as the PSP. You can make this system grow indefinitely Just think that any time you want a dropdown, or a selector for multiple choices in your templates, this is the way to do it in PW, even if those pages only exist to be a selectable value on other pages. Edit: And welcome to the forum1 point
-
Diogo's code above taught me a lot and saved me lots of time, but I just noticed one tweak that I think should be made: foreach($mypage->fields as $f) { $mypage->set($f->name, $form->get($f->name)->value); } should really be: foreach($mypage->fields as $f) { if (!in_array($f->name, $myfields)){ $mypage->set($f->name, $form->get($f->name)->value); } } so as to avoid "Notice: Trying to get property of non-object" errors on any fields that were excluded. Also, I had to include: $mypage->of(false); // turn off output formatting before setting values $mypage->save(); I don't know whether this is something specific to my use, or whether it's just obvious and so wasn't included, but though it might help someone else.1 point
-
You can always add an entry for this IP in your OS hosts file so that you can locally resolve a host / host.domainname.tld to the IP address of your dev site.1 point
-
You can also do this: $users = wire("users"); $u = $users->get($username); if($u->id) $users->delete($u);1 point
-
1 point
-
Yes, i am using it as a label for a Page Field - works fantastico now, thanks again!1 point
-
@mindplay.dk: Separation of concerns, single responsibility principle, and so on -- I get it. You seem to think we're designing these things without understanding of these principles, and that couldn't be further from the truth. I'll also assume that you understand what I was stating before, that we've tried to adopt enough flexibility so that a developer can choose to adopt these principles, while still using the module interface. But we don't want to enforce that upon everyone because it would be counterproductive design. Why? There are principles, context, audience and goals. Our context is not the same as that of the Symphony framework, for example. Our audience has crossover, but is not the same. Most module cases are relatively tiny components. We have a project goal of making module development as simple and bulletproof as possible... something that might encourage web developers to take an interest in exploring their own module development. Part of that is an original design requirement of being able to share and communicate simple modules as 1 file / 1 class, when one chooses to (as many do). The ability to be super-simple and self contained like this encourages growth for the entire ProcessWire module ecosystem. We derive a lot of benefit from this, and that was the goal. It's not at the expense of the underlying principles unless you choose to make that sacrifice yourself. Don't develop your big module using the same strategy as your small module. We don't have many implied strategies for big modules and what's probably lacking most is just the documentation to explain when and why you might take one approach over another. Don't think I'm making any claims of perfection with any bit of code or design. There is always room for improvement in anything, in any project, in any system, in any file, in any class, in any method, and so on. The definition of a bad coder is someone that thinks they've got it all figured out or something is beyond improvement. I am very far from that. As most here know, I'll defend that which is worth defending and agree on things that aren't. But there's a lot more thinking behind the design than you often assume. I feel strongly about the decisions behind our current module system, and that they were the right ones. I also have an open mind. If someone proposes something better that understands not just the principles, but the context, audience and goals too, then I welcome it.1 point
-
Thanks, I will read everything in the coming days and if I have questions I will come back. Roelof1 point
-
Yes, I want to manipulate something on the admin interface side: Each member of a sports club is saved as page, i don't want the website editor to have put in name and first name as title when adding a new member, maybe with a number if there are two members having the same first and last name - and then entereing first name and last name again when editing the member page to have both values seperatley. So i first had the idea to populate the title field of a new added page during ProcessPageEdit dynamically, e.g. with a increasing number. As i couldn't manage it to check the template of the new added page or the number of existing pages using this template - at least i was not able to check any parameters of the pages. I found some information in this post, but this did not work for ProcessPageEdit (or i just made something wrong). So i began to use just Jquery (as described above in my second post) and made a little module which populates the title dynamically with the name and the date of birth after they are entered in the edit page: <?php class PopulateTitle extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Populate Title', 'version' => 101, 'summary' => 'Populate the title field dynamically', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookAfter('ProcessPageAdd::execute', $this, 'addScript'); $this->addHookAfter('ProcessPageEdit::execute', $this, 'addScript2'); } public function addScript(HookEvent $event) { $this->config->scripts->add($this->config->urls->PopulateTitle . "populate_title.js"); } public function addScript2(HookEvent $event) { $this->config->scripts->add($this->config->urls->PopulateTitle . "populate_title2.js"); } } populate_title.js: During ProcessPageAdd this script checks if the page which will be added is in a child of the "Members" page, if it is, the timestamp is added as title to keep it individual. Same for the page name. It hides both fields and triggers a submit, so the page is added automatically. jQuery(document).ready(function() { if($('input[name=parent_id]').val() == '1015') { $('input[name=title]').val(new Date().getTime()); $('input[name=_pw_page_name]').val(new Date().getTime()); $('#wrap_Inputfield_title').hide(); $('#wrap_Inputfield_name').hide(); $('#submit_save').trigger('click'); } }); populate_title2.js: When editing a page it checks again if the page is a child of the "Members" page, empties the title, checks if the members name is already entered (mitglied_name) and displays "Neues Mitglied" (New member) as title if it is not. If there is a members name entered (which is a required field) it concenates name, first name and date of birth (all required fields) and uses them as page title and, a filtered version as page name: jQuery(document).ready(function() { if($('input[name=parent_id]').val() == '1015') { $('#title').empty(); if($('input[name=mitglied_name]').val() == '') { $('#title').append('Neues Mitglied'); } else { $unfiltered = $('input[name=mitglied_name]').val() + ", " + $('input[name=mitglied_vorname]').val() + ", " + $('input[name=mitglied_geburtsdatum]').val(); $('#title').append($unfiltered); $filtered = $unfiltered.toLowerCase().replace(/[\*\^\'\!\,]/g, '').replace(/[\.]/g, '-').split(' ').join('-'); $('input[name=title]').val($unfiltered); $('input[name=_pw_page_name]').val($filtered); } } }); So this does exactly what i want, even more (as it corrects the page name dynamically after name, first name or date of birth are changed later). But i am sure that one could have done the same with PW API - without using just jQuery and that would make it possible to write a module which offers the possibility to choose the fields which should be used as title dynamically. Hmm... Maybe one could use a modified Fieldtype Concatenate for this?1 point
-
@joss - here is an example function for rendering a full top bar with bootstrap. https://gist.github.com/46990201 point
-
Interestingly enough, we have just retired one of the kids PCs as she now has a laptop. It is a basic intel dual core dell with 2 mb ram and windows vista. It is about 3 years old and cost £250. It is nice to have a spare machine around, so I have done the MS cheap upgrade offer to windows 8 pro and ran it as a clean install. It went very smoothly and then I restarted it. 5 seconds boot up. I nearly fainted!!!! So I tried again - yep, 5 seconds. I hit the power button, sit up at the desk and it is all ready. NONE of my machines boot that fast!! Even my huge music computer. Goodness knows what I have done wrong, or right ...!1 point
-
Josh's post encouraged me to tell what I have Laptop is a Dell Inspiron with 15'' display, and when at home I dual screen it with a 21'' Samsung monitor. The OS is the very new Fedora 18 Beta (I'm living on the edge ) with Gnome graphical user interface. When people know I'm a designer and I show up with something that is not a Mac, they say "YOU DON'T HAVE A MAC???"1 point
-
1 point
-
Maruchan, these are all good suggestions. Also look at the ProcessExportProfile module which includes a PHP native database export function. Perhaps I should repurpose it to module just for doing DB backups.1 point