Leaderboard
Popular Content
Showing content with the highest reputation on 11/06/2013 in all areas
-
Hey guys, I'm new here, and I'm loving ProcessWire and the community spirit so far. We're just about to start using ProcessWire for our new clients requiring PHP solutions. Moving in a Rails direction, structure in our projects is becoming more and more of a necessity. As such, I've tried to employ some MVCish techniques in creating a boilerplate for ProcessWire for getting projects going quickly. One of the primary goals of this structure is to make it easier to separate logic from markup, and to prevent tags from being split over templates. Keeping `body`, `html`, and structural markup open and close tags in the same file greatly reduces cognitive overhead, and reduces opportunities for mismatching tags to exist. This approach also reduces duplication, and is great for keeping files small, focused, and organised. The main structure of the boilerplate is well defined, and ready to use in production. The repo is available here: https://github.com/fixate/pw-mvc-boilerplate (link updated 2014/01/17) Structure Although not completely MVC (using classes for controllers feels redundant, there are no models, and a full MVC approach will require a fair amount of customisation), it is heavily MVC inspired. Additionally, the structure is an extension of Soma's delegate approach. File structure: ├── site ├── assets ├── modules . . . ├── templates // boilerplate contents here ├── assets // css, js, fonts, images, etc. ├── controllers // variables and functions specific to templates ├── errors ├── partials // markup not specific to any particular template ├── views // layouts specific to a template ├── _init.php // used to load global and template-specific controllers ├── main.php // the 'alternate template' for all templates . . . **NB: This structure has largely been updated and improved - see the UPDATE - 2014/01/17 at the bottom of this post! Controllers Controllers hold template specific variables and functions. There is also a global controller responsible for making global fields, such as SEO fields, available everywhere, as well as being responsible for the actual delegation. Template logic should be handled as much as possible from within controllers. Views Views are responsible for handling markup and output. Views have available to them both the global controller, and their own controller. Logic should be, as much as makes sense, handled in a controller, with the view pulling the results in for display. Partials Partials hold markup not specific to any particular template on its own, such as the `<head>`, header, navigation, scripts, or footer. As with views, it is best to keep these as logicless as possible. _init.php _init.php is responsible for making controllers available to views. Controllers are only included if they exist - sometimes a template-specific controller may not be necessary, in which case you won't need to create one. main.php main.php is the default layout (equivalent to layout/application.html.erb in Rails) into which everything is rendered. This file has been kept small deliberately to let partials and views manage more fine grained markup structures, while this file serves the main site structure. A call to render_view(), defined in global-controller.php, is responsible for delegating rendering to the view of the current template. Additionally, there is a constant defined in globals-controller.php useful for serving different assets depending on if you are working in a local environment, or if your site is live. This is useful for preventing Google Analytics from running in a dev environment, or for using unminified scripts for debugging. This boilerplate eliminates the need to do much configuration when beginning a project, apart from having to change each template's alternate template in the admin. I hope this will assist in quickly organising and developing new projects! ------------------------------ UPDATE - 2014/01/17: ------------------------------ All files for rendering are postfixed with .html.php in good ol' Rails fashion. main.php has been removed in favour of mvc.php. mvc.php requires config/boot.php which then handles which controllers, views, etc. are used the main layout is now found in views/layouts/application.html.php - like Rails again. partials are now kept inside views/ each page template can have its own optional controller, or simply inherit functionality only from ApplicationController ├── site ├── assets ├── modules . . . ├── templates // boilerplate contents here ├── assets // css, js, fonts, images, etc. ├── controllers // variables and functions specific to templates ├── core // core mvc files - base controllers etc. (project specific stuff does not go here) ├── errors ├── views // folder for template files, layout files, and partials ├── layouts // application layout ├── partials // markup not specific to any particular template ├── mvc.php // the 'alternate template' for all templates . . .7 points
-
This module allows you to automatically rename file (including image) uploads according to a configurable format This module lets you define as many rules as you need to determine how uploaded files will be named and you can have different rules for different pages, templates, fields, and file extensions, or one rule for all uploads. Renaming works for files uploaded via the admin interface and also via the API, including images added from remote URLs. Github: https://github.com/adrianbj/CustomUploadNames Modules Directory: http://modules.processwire.com/modules/process-custom-upload-names/ Renaming Rules The module config allows you to set an unlimited number of Rename Rules. You can define rules to specific fields, templates, pages, and file extensions. If a rule option is left blank, the rule with be applied to all fields/templates/pages/extensions. Leave Filename Format blank to prevent renaming for a specific field/template/page combo, overriding a more general rule. Rules are processed in order, so put more specific rules before more general ones. You can drag to change the order of rules as needed. The following variables can be used in the filename format: $page, $template, $field, and $file. For some of these (eg. $field->description), if they haven't been filled out and saved prior to uploading the image, renaming won't occur on upload, but will happen on page save (could be an issue if image has already been inserted into RTE/HTML field before page save). Some examples: $page->title mysite-{$template->name}-images $field->label $file->description {$page->name}-{$file->filesize}-kb prefix-[Y-m-d_H-i-s]-suffix (anything inside square brackets is is considered to be a PHP date format for the current date/time) randstring[n] (where n is the number of characters you want in the string) ### (custom number mask, eg. 001 if more than one image with same name on a page. This is an enhanced version of the automatic addition of numbers if required) If 'Rename on Save' is checked files will be renamed again each time a page is saved (admin or front-end via API). WARNING: this setting will break any direct links to the old filename, which is particularly relevant for images inserted into RTE/HTML fields. The Filename Format can be defined using plain text and PW $page variable, for example: mysite-{$page->path} You can preserve the uploaded filename for certain rules. This will allow you to set a general renaming rule for your entire site, but then add a rule for a specific page/template/field that does not rename the uploaded file. Just simply build the rule, but leave the Filename Format field empty. You can specify an optional character limit (to nearest whole word) for the length of the filename - useful if you are using $page->path, $path->name etc and have very long page names - eg. news articles, publication titles etc. NOTE - if you are using ProcessWire's webp features, be sure to use the useSrcExt because if you have jpg and png files on the same page and your rename rules result in the same name, you need to maintain the src extension so they are kept as separate files. $config->webpOptions = array( 'useSrcExt' => false, // Use source file extension in webp filename? (file.jpg.webp rather than file.webp) ); Acknowledgments The module config settings make use of code from Pete's EmailToPage module and the renaming function is based on this code from Ryan: http://processwire.com/talk/topic/3299-ability-to-define-convention-for-image-and-file-upload-names/?p=32623 (also see this post for his thoughts on file renaming and why it is the lazy way out - worth a read before deciding to use this module). NOTE: This should not be needed on most sites, but I work with lots of sites that host PDFs and photos/vectors that are available for download and I have always renamed the files on upload because clients will often upload files with horrible meaningless filenames like: Final ReportV6 web version for John Feb 23.PDF4 points
-
I am currently sharpening up my branding credentials by doing an online course on branding. It is a free course which is being put together by the Open University (a remote access university in the UK) under the moniker of Future Learn. https://www.futurelearn.com/courses/secret-power-of-brands-2014 (The course will be restarting in the new year if anyone wants a go - it is very good.) Doing the course has reminded me that often the technical considerations of a website perhaps do not take into account the needs of the brand and its relationships with brand followers - the customer, mostly. So, I thought I would note down a couple of paragraphs of observations that although probably not new to most of you here, might also serve as a reminder about how important the brand is and how both the developers AND the clients should not be sidetracked by this wonderful new technology into undermining the brand, or losing the opportunity to reinforce the brand. Big Brands and Little Brands It is very easy to assume that a brand is something that only belongs to a colossus of a company - Coca Cola, Ikea, Virgin, Woolmarts. These brands pour huge amounts of capital and service expenditure into promoting and sustaining their brands and have built them over many years,. But a tiny company, organisation or even a single crafts person can also benefit from all the rules and ideas that are used to help large brands; it is but a question of scale. For instance, Coca Cola works hard to seek consistency of product throughout the world. As global travel has become easier and cheaper, this has proved invaluable as the loyal customer can enjoy the same drink, at the same quality, wherever they go. In a smaller but equally important way, a local builder/decorator will do better if his "brand," basically the person themselves, has a reputation for consistently good work. If they slip up on a job then they undermine their own brand and lose market positioning - their formally loyal clients will go find another builder. The words associated with branding actions may seem idiotic when applied to just one bloke with a paintbrush, but they are no less valuable. So, just because the website your are designing is for a local group of fisherman rather than a supermarket chain, does not mean that the brand can be ignored (even if the client does not realise they have a brand) Brand Types There are various versions of branding: 1. A mark or label saying that you own this brand 2. Guaranteeing quality by building a reputation for quality 3. Promising Pleasure - your life will feel better by owning this product 4. Inviting belonging - basically, building a brand in such a way that you build loyalty; you make people feel like they have ownership of the brand You can see that these are more or less in chronological order. The first version is how brands first appeared a few centuries ago. The second is something that grew up in the late 19th, early 20th century, the third version is something we recognise as much more modern and the fourth is very much the new approach to branding. The fourth is especially important to modern, large, multi faceted companies where they can build confidence in the main company brand that will then influence all their main products. A great example is Virgin where the "Virgin" brand informs us about how we feel about their planes, trains, record shops, broadband, cola and so on. Wally Olins, a world leading brand practitioner, defines a modern brand as: "Branding is a profound manifestation of the human condition. It is about belonging: belonging to a tribe, to a religion, to a family. Branding demonstrates that sense of belonging. It has this function for both the people who are part of the same group and also for the people who don’t belong." It is very easy to see how this might relate to some of the functionality that is possibly with a reactive and interactive web policy... The Fifth Brand The most recent version of a brand expands on version four to take in modern social media and the general interconnectivity that has come with the growth of the internet. This is where Brand can be seen as a platform, where the brand is making things useful to the user rather than being just about ownership. Ebay and Google are both good examples of where a brand is more than a product but is something useful too. Version five is a difficult fit for a lot of business out there with very traditional products and services but that does not mean it should be ignored. When we create a website for a brand, taking time to think about or quiz the client about how their product/service is viewed and used by their clients and how the website can connect with not just the client, but connect with how they use the brand, might mean that the website becomes more than just a brochure for the brand, but becomes PART of the brand. How can a website be the brand? Obviously, an website for an online shop where the shop is the brand, is the brand itself. It is not representing the brand, the brand is the shop. That is a bit of a no-brainer, you would have thought. But I have seen enough online shops that seem amazingly divorced from the brand. They use a very obvious template, take people through the catalogue in a very common way and give the shopper exactly the same "chopping" experience that every other online shop does. Oddly, bricks and mortar shops tend to do the exact opposite. They will work very hard at giving shoppers a unique experience, within a unique environment, all designed in such a way that the exercise of shopping becomes not just efficient, but enjoyable. The experience of shopping must have the same brand values as the very products themselves. Can not an online shop take into account the same criteria so that it too not only sells products associated with the brand but reinforces and becomes part of the brand? This same criteria can be taken away from the online shop and applied to any other kind of website. Again, just as with the shop, the website should, as part of a modern brand, become a useful thing. It should be an enjoyable and informative experience in line with any other manifestation of the brand. The website should offer the user (the client or visiter) the ability to be involved with the brand, to take ownership of it and to feel like they belong to it. But, this should be within the confines of the specific brand. It must have the tone and feel that the brand needs because the site will BE the brand, not just be reproducing the brand. Shared Value Companies, big and small, will often get involved with local or national issues either by offering time for nothing or by being philanthropic; giving donations to local causes and so on. Shared Value is the idea that a company can, rather than just give stuff away, design their product, services and the brand itself so that it brings benefit to society, local community, environment and so on without doing a give-away. By building the brand using the principles of shared value, the company can bring together the ideas of being beneficial while making a profit - rather than these being two mutually exclusive elements of the brand. Simple examples of this is, for instance, a company deciding to use energy from renewable resources or recycling any waste from manufacturing. These are written into the operating costs of the company and will benefit the brand and benefit the environment, for instance, at the same time - and this will help increase profits. Small companies can also use the idea of shared value. A local company, for instance, can, as much as possible, use local suppliers - benefiting the local economy directly while also selling to the local economy. The two work hand in hand without being philanthropic and so create profit directly. If a company decides to work in this way, then this should be taken into account with the website. Can the design process of the website use the companies specific philosophy of shared value? Does the website highlight how the brand works and is supported through Shared Value? For more on shared value, see this presentation on YouTube - it is long and badly filmed, but if you are into branding, then it is a must watch: So, there you go. A very short thought on branding and how, when creating a website, you should start with the brand and not with the technology. Personally, this is where ProcessWire is useful. Simply because it does not limit how your web design might work, it allows you to look at the brand in detail, work out how the brand should be embodied in this thing called a website, then use ProcessWire to quietly achieve not just a Web Site, but a Brand Site! (I should copyright that...) Joss3 points
-
Lately there have been lots of people that are not enjoying the default admin theme, so we've been working on making something new. Not trying to solve all issues or add every new feature we'd like, but just trying to come up with something to have as an interim replacement for the default admin theme until we can afford the time to do something broader in scope (like Phillip Reiner's great admin theme design for example). So this theme doesn't necessarily break a lot of new ground, but hopefully has some of the improvements that people are looking for. Visually, the goal here was to find a lighter, more modern look and reduce the boxes-in-boxes feel of the current admin theme. I've opted to commit it to the dev branch because it requires the latest version of ProcessWire on the dev branch, and likely will continue to with updates. Meaning, I can't distribute this one as a 3rd party theme very easily. This is because I'm making core updates related to the admin theme at the same time. So if you want to help test this new theme, you'll need to grab the dev branch of ProcessWire. The new admin theme is in /site-default/templates-admin/. That means you'll see it as the default theme if you are installing a new copy of PW. But if upgrading an existing copy, you'll continue to get the old theme. If you want the new theme, then just copy the /site-default/templates-admin/ directory to your /site/templates-admin/ directory on your existing PW install. This would be in addition to replacing your /wire/ directory with the latest one from dev, as usual for PW upgrades. The existing default admin theme also remains in place in /wire/templates-admin/. So if you want to stick with the existing/stable admin theme, then just make sure you don't have a /site/templates-admin/ dir in place (unless you are using a 3rd party admin theme). This admin theme is probably not production ready, as it's not been tested in many browsers yet. I personally haven't yet tested it in anything but Chrome and Firefox in OS X. Please let me know if you experience issues in other browsers. I fully expect things won't be pretty in IE... but they never are. To start, this comes with 3 color schemes (though we'll be adding more too): Warm: Modern (similar to processwire.com site colors): Classic (similar to existing admin theme colors): To switch to one color theme or the other, specify a GET variable of 'colors' in any URL you are accessing in the admin: /processwire/?colors=warm /processwire/?colors=modern /processwire/?colors=classic To specify a default, edit your /site/config.php and set to one of the following: $config->adminThemeColors = 'warm'; $config->adminThemeColors = 'modern'; $config->adminThemeColors = 'classic'; We'll probably make this switchable in the user profile at some point, but that comes later. This theme also comes with some new features (most of which have been copied/inspired from the work of others here, whether in other admin themes, modules or designs): It now uses Font-Awesome icons rather than jQuery UI icons. We now only use jQuery UI icons for actual jQuery UI widgets. Note that asmSelect and our file/image inputfields are built as jQuery UI widgets, but I don't think anything else is. Basically, the majority of icons in the system are now Font-Awesome icons. You can associate Font Awesome icons with templates. When associated with a template, the icons will appear in the page list, in front of the page title. To use this, edit any template and go to the Advanced tab. In the "List of fields to show in admin page list", you can type in any Font Awesome icon name (in addition to the field names you could before). For example, in the Page List screenshots above, I have my "search" template configured with the value: "icon-search title". You can associate Font Awesome icons with fields. When associated with a field, the icon will appear at the beginning of the input. For example, I associated a coffee icon with my "title" field in the screenshot below. To do this, edit the field, click on the Advanced tab, and enter the icon name in the new field provided for it. The top navigation now supports simple dropdowns. A new "user" dropdown has also been added that contains profile and logout links. The main Pages screen contains an "add new..." button, that is itself a dropdown to a list of templates that are configured adequately for us to know where they would be added. To use this, you have to configure your template "family" settings. The search box is now ajax powered, though this was introduced a couple weeks ago in the existing admin theme too. The theme is responsive too, of course. This is all kind of preliminary and open to changes. I'm trying to keep the scope of the project fairly small since I don't have much time to work on it. But just wanted something to quiet the haters a bit for a little while, so that we can take our time on the bigger admin theme project for longer term. We'd appreciate your feedback if anyone has time to help test.2 points
-
If you don't want a user deleting pages, then it should be as simple as not giving them page-delete permission. If you want to change the behavior on a per-template basis, then come up with two roles... one that has delete permission and another that doesn't. Give the user both roles. On templates where you want them to be able to delete pages, assign both roles. On templates where you don't want them to be able to delete, then only assign edit permission to the role without page-delete permission.2 points
-
Just pushed a new version to Github that supports setting a filename length limit (to nearest whole word) for the length of the filename - useful if you are using $page->path, $path->name etc and have very long page names - eg. news articles, publication titles etc. The final filename will be truncated to this length if set. I have also added support for jquery 'on' as well as 'live' depending on what is available. I have one thing I'd like to sort out before releasing this if anyone has any ideas. I can't seem to get dynamically added (click "Add another rule") ASM fields to properly initialize. The: <select class="asmSelect" name="asmSelect2" id="asmSelect2"> is not being setup, so the fields just looks like a standard html multi-select field until the config settings page gets saved, then it works fine. I am wondering if there is an easy way to fix this. I haven't looked through things thoroughly yet, but it seems weird that the InputfieldPageListSelectMultiple field is working properly. Any ideas? I have the ASM fields now mostly working (works almost every time a new rule is added, but not 100% for some reason). I resorted to a setTimeout to wait until the select form elements are created. I feel like there should be a better way to do this, but it is something I always struggle with a little in jquery. I have used this function in the past: https://gist.github.com/aziz/3792797 but I still think there should be a better way. Anyone?2 points
-
On a somewhat related note, I was looking into (standalone) browser-based file-managers, and found this gem: http://elfinder.org/ It's got an API, drag-and-drop goodness, archive creation / extraction functions, and instructions how to integrate it in tinyMCE + CKEditor. Gonna play around with it this weekend...2 points
-
Hi Everyone, the last days i read a lot about the ongoing process of "modernizing" the admin theme, adding some features and getting some marketing buzz from people who aren't currently aware of processwires awesomeness due to the fact they didn't like the current admin theme. I must admit that at first was one of those "design oriented" guys and didn't dig deeper into the system because i didn't liked it's look & feel (or at least i thought it doesn't look "professional" enough to present it to our customers). Fortunately a colleague of mine finally managed to convice me giving pw a second try. After digging deeper i started to really like the concepts behind it. I tried different admin themes and git stuck with "ergo" which we currently are using on several pw instances. Although i weren't completely happy with it's look and feel on several details (but that's just me: i never heard one of our customers complaining ). The Idea of doing a theme by myself started to grow in my mind. After doing several layouts that "just beautified processwire to my taste" (i can post a "design evolution summary" if anyone is interested) i took a step back and started doing some more conceptual work and research. Specifically i thought about which "personas" are using processwire and for what reasons they are using it. Also i tried or looked at screenshots of some more "hyped" systems (ghost, anchor, craft...), asked out some (dev) co-workers and others who are content editors (which are the two main "groups" of personas imo) what parts of processwire could be done better or used in a more efficient way. The good (but not surprising) news is: There were almost no complaints about the current features. Long story short: With the "benchmark" in mind and some feedback i again started layouting. I rearranged some buttons, menus and tried to give processwire a more modern, clean and "up to date" look. But before i'm going to code all of this i wanted feedback from a broader audience so i can propably fix or correct things that you as everyday users aren't happy with. Here we go: I used the "w" of the processwire logo as a "picture mark" as it is pretty unique and can easily be recognized and remembered (You could also use this as a favicon). I kept using "processwire colors" for brand/product recognition (i know ryan stated people are complaing about them) but also tried to use them in a very minimalistic way so there is nothing that distracts editors from the content. I chose the menu to be positioned right for two reasons:1) Content first! The most part of work in processwire is editing and creating content. So why shouldn't content "rule" and be the first and most important thing (at least for LTR Readers)? 2) With the buttons and the menu both at the right side there is a "cluster of functionality" which makes it more efficient: Shorter ways for eye- and mouse movement, less things to "overlook" when actually editing content. The pages options within the tree are hidden (again: reduce visual complexity) into a dropdown with only the most commonly used one (edit) beeing shown (this should be configurable). The Font is the beautiful Fira from Mozilla <3 The messages are displayed "growl style" and can easily be closed by the user (or close themselves after a certain amount of time) I chose to use the content of ryans "new theme" example screenshots to make it easier comparing them in terms of visual hierachy. As you scroll, the buttons on the top will pin and scroll with you. This way it's always possible to save or view the page at any scroll position (the save/publish buttons are part of a module that's currently in devlopment here). The bar at the bottom will contain some shortcuts as well as less frequently used / system related stuff (i.e: user profile and logout). "Zen Mode" with closed menu. Just you and your content For those who like it bright: An example of an alternate version which is even more minimalistic.From my point of view there are some things still missing. I thought a lot about including a possibility to open the page tree from everywhere (as in Nico Knolls Dark Business and the ongoing Discussion in the Two column admin theme concept). I think this might be more effective to just test it from a ux perspective when actually coding the theme. My Idea is to build a static clickdummy and put it on github before actually releasing a "real" theme (with all the logic / js work to be done) to do some usability testing. Thanks for reading and i hope there will be some feedback! Best regards, Felix1 point
-
Yep, but Wordpress wouldn't put his name, they'd put Automattic Inc. instead as that's the company behind it isn't it? That's the point I was trying to make, badly It seems now that I've re-read some of the earlier posts in this topic that it must stay as it is for now or until ryan gets some clarification from a legal perspective. The reasoning for leaving the ProcessWire name in plain view though is clear - whilst a client's next developer (should their current developer vanish) can see what the system is built in from the license files and so on in the installation folder, most clients wouldn't know they're there. Having something in plain sight enables them to get help from here if something goes wrong - this has in fact already happened once I think where a client has parted ways with their dev and come here for help, so we know it works and it helpful. I very much doubt there would be anything wrong with expanding upon the copyright line though by doing something like this, which clarifies things nicely: ProcessWire 2.3.5 © 2013 Ryan Cramer | Website designed and developed by YourCompany I daresay you could even prepend the words "Built with..." to that as well for even more clarity.1 point
-
Tackling a small part of what has been discussed first, I don't think white-labelling completely is a good idea at this stage. Wordpress has a very strong identity with their admin, and anyone who has used it would know what they were using without the branding unless they were using some really fancy admin themes. Whilst a system is still growing in popularity and can benefit from the simply line of text and the link back to the website I personally think it should remain. Wordpress, depending on the version, has one or more links in the footer linking back to the website just with the software name. MODx is managed under the company name "MODX Systems, LLC" so it's a bit easier for them to simply list "MODx" in their footer. ProcessWire is by "Ryan Cramer Design, LLC" (with many developers/contributors) but it would be confusing to have the full "Ryan Cramer Design" bit in the admin footer ("who designed the website?" might be what the client then asks ). Rather than me speculating further as to reasons why ryan has his name there it's probably best to wait for him to answer of course. All in all though, since I started this thread back when I'd been using ProcessWire for just a few months, I've not once come across a client who got confused by it nor have I noticed anyone else seeing it as a restriction. Obviously it would be interesting to see what ryan says, but I wouldn't see it as a show-stopper either way and I don't think other people do either or we'd probably hear a lot more concerns over it1 point
-
1 point
-
First off, I really think that what you are looking for is just multiple branches in your site tree, one for each language. You don't really need any language support modules installed for this. This is a pretty good way to go when you have the needs you've indicated. When your navigation needs are going to be significantly different across languages, multiple trees is probably the best way to go. But if you want to stick with language support and multi-language fields, then it looks to me like the LanguageSupportPageNames module (included with core dev branch) already does what you are trying to do. My understanding was that the main issue you ran into is that you have instances where you don't want the default language to be active. A couple ways to accomplish this would be 1) just consider the default language to be not in use (don't link to the default language version of any pages, and don't let the user choose that language); or 2) add your own "disable default language" checkbox to every page template and check for it when outputting navigation, etc. Basically, I think there are a lot of very simple solutions if you use the tools that are already there.1 point
-
Fieldtype Float lacks the possibility to specify output format at the moment (see https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeFloat.module#L56). But of course you can use number_format() yourself wherever you're outputting prices: echo number_format($page->price, 2, ',', ' '); This gives "12 345,67" for the value 12345.67. If you've got several places where this field is being used (and/or several price fields), another option would be yet another hidden text field for storing the formatted value when the page is being saved. Nope . That option is to specify how many digits are being saved after the decimal separator, not before it. See http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html for the limits of float in the database - I don't think they will be an issue here.1 point
-
Thanks for your work here. Maybe you want to add it to the modules directory under the "proof of concept" category? That way it's implied that it's not a plug-n-play type module, and that it may need further adaptation by the developer to use it.1 point
-
Thank you guys, here's the link to the calendar I was working on. https://ticketees.com/calendar/ Wouldn't have been possible without your help.1 point
-
1 point
-
Well isn't that pretty much by the definition of an integer not to have decimals? Try using fieldtype Float for the price instead, that should solve your problem I think.1 point
-
Yey, nice time to get involved in ProcessWire. I have been looking at Processwire for a recent project. It is really nice from a user perspective hiding all the complex functionalities. Amazing work guys. I don't say you move to use this or that ( Though I am more inclined towards Aura ). Composer is really a nice tool, and when we go with composer and you install it is always good to keep the files in vendor folder itself. Some of the things in my mind are 1. Flexibility to move the index.php to outside the main folder. So only index.php is the only file lies there. else vendor folder will be visible to the public . May be readmes and all . 2. When working on aura v1 , we installed the packages in the package folder itself. But that is a hard way to manage. So we started with http://github.com/auraphp/Aura.Includer/ So it will be nice to have something like adding a certain configuration file in the module of PW which helps to recognise the file is processwires and which needs to be loaded via same ? Also does the 2.4 development is finished ? There is PSR-4 also coming, which reduces the size of the namespace stuffs. \ProcessWire\Event\Manager => src/Manager.php ( PSR-4 ) than the previous one /src/ProcessWire/Event/Manager.php I am looking forward to contribute to PW aslo please choose PSR-2 also. It is all about future and how we all PHP community work ( For I contribute to Aura, Symfony, Zend etc life is easy ) . Thanks1 point
-
I would like to suggest Lato or Source sans pro, from google fonts: http://www.google.com/fonts/specimen/Source+Sans+Pro1 point
-
http://www.tamperemusicfestivals.fi/jazz/ The four-day jazz festival starts today. There will be a lot of traffic on the website, but I'm sure everything will run smoothly since ProCache makes the site run very lightweight and fast. In previous years this website has been running on WordPress or MODX. This year we switched to ProcessWire, and it has been a huge improvement. Everything on the site is fully editable, which makes the client very satisfied. Also, PW has revolutionized my workflow as well. I have quite the same feeling as when I switched from Windows to OS X : ) Logo is designed by the artistic director of the festival, everything else by me.1 point
-
Chinese Language Packs. note: The TinyMCE works in English, because I can't set the language code to zh-CN. click this link for detail. http://processwire.com/talk/topic/4803-i-want-translate-pw-to-chinese-and-need-support/ you can download this pack from github too. https://github.com/liyiwu/Chinese-ProcessWire update: cd wire grep -Rl '[>_][_nx](' * | uniq I find 90 files, and translate all of them that is translatable. Hope this can help others. Chinese-ProcessWire.zip1 point
-
Thanks Ryan, Not sure why I actually never tried that. I have used InputfieldFile::fileAdded in my SVG rasterizer module, so it should have been on my radar. Anyway, for this module I have gone with InputfieldFile::processInputAddFile and it seems to be working great. New version is on Github and here is the official module support post: http://processwire.com/talk/topic/4865-custom-upload-names/ Thanks again for seeing me through this one1 point
-
1 point
-
Antti, that should be fixed now, just pushed another version to GitHub. Looks like you can't set the value of inline CKEditor the way you'd set it for regular CKEditor, ie. find correct instance and use setData().. not even if you first "force" loading that particular inline editor. On the other hand, inserting value directly to inline CKEditor's container div with .html() seems to work but feels a bit hacky1 point
-
if (file.name == "justinbieber.jpg") { done("Naha, you don't."); } The dropzone guy has clearly a sense of humour...1 point
-
Hey everyone, ajax enabled file uploads in the frontend is something, that I also always wanted, so I did a really dirty hands on to get it done without core hacking. You can find my current state here: https://github.com/bytebus/AjaxImageUpload I consciously don't want to put this into the modules subforum because it's definitely not even close to be used as a drop-in module. The way it works is more or less this: * Provide an API endpoint for ajax uploads. * On each upload, create a new, temporary page with an only an image field. * Provide a method to easily copy the uploaded image to a "real" page and delete the temporary page. I think the concept is definitely simple and ok, so this is why I'm still posting the code and hope it might be a starting point for someone doing a cleaner implementation. I'm also glad about all suggestions (and pull requests ) on how to implement this in a more easy to use and flexible way. P.S.: I originally wanted to use dropzone.js for this because of the nice user interface. On a more in-depth look at it, I had the feeling that it's not flexible enough, though. I used jQuery File Upload instead which seems to be more widely supported, more flexible and also provides drag-and-drop functionality.1 point
-
Wait! For some reason I cleared my cache and set the session fingerprint to false. It seems to have fixed it. I stay logged in now when inspecting an element. Any ideas why it would do this?1 point
-
I just updated the sheet to 0.3 with hooks from latest dev version. + 22 hooks registered. - added teppo's article to info section links (http://www.flamingruby.com/blog/using-hooks-to-alter-default-behavior-of-processwire/) - added link to ryan's tutorial using hook to add method to PageArray (http://processwire.com/talk/topic/4834-simple-hooks-tutorial-turn-a-pagearray-into-a-list-of-links/)1 point
-
1 point
-
This module can't be installed with ModulesManager as it says it's already installed due to the class name being the one in the core "ProcessLanguageTranslator".1 point
-
Steve have build some excellent modules for admin security: http://modules.processwire.com/modules/auth2-factor-ppp/ and http://modules.processwire.com/modules/session-login-alarm/1 point
-
Dear Ryan, Why thank you, and you're welcome! Yes, in a way, having three locks on the door feels very much like a New Yorker. But I lived in Manhattan for two years, so there you have it. I'm going to add SessionLoginThrottle. That's a good idea too! Best regards, Peter1 point
-
If you are having trouble with a module you've created or are using which is no longer functioning with the new admin themes, this is due to some changes in the admin page markup in the new admin templates. The class .ui-widget-content is no longer used in the new themes aside from specific modules such as FormBuilder, and some modules used it as a point of reference in jQuery selector statements which will no longer work. The fix, which maintains backwards compatibility with old themes, is to change the module's .js file to replace this: .ui-widget-content with this: .ui-widget-content, .InputfieldContent Please use this topic to post any other fixes or modules that you encounter issues with relating to JavaScript whilst using the new admin templates.1 point
-
1 point
-
Dear All, Here's an update on how I've protected the admin login url so that only superusers could login to admin, and the registered users with the role of 'member' could only access my front-end code. If anyone has any comments or corrections, I'd appreciate them. 1. I renamed the admin url to something other than 'admin'. 2. I set the admin template to only HTTPS, so that logins are encrypted. 3. I used Soma's recommendation to set the permissions for the 'member' role to view only. Thus, even if they could log in, they would only see a 'Continue' link, as Soma mentioned. (Thanks, Soma!) 4. After copying the wire/templates-admin files to site/templates-admin, I added these lines to the very top of the default.php file in sites/templates-admin: if ( $user->isLoggedin() && ! $user->isSuperuser() ) { $session->logout(); $session->redirect("/members/", false); } Thus, users who log in, who are not super users, will get logged out, and redirected to /members/. I log them out so that they will not be tempted to just use the admin url to log in and get redirected. Since I haven't yet digested autoload modules, this code seemed easier to me. After I work with modules, etc, I might change my mind. 5. I found some .htaccess code on the web that works with friendly urls (rather than real directories), and it tested correctly, so I added this code to the bottom of the public_html/.htaccess file (with urls / filenames changed to generic names in this post): # set env variable SECURED if current URI is /some_admin_name SetEnvIfNoCase Request_URI "^/some_admin_name" SECURED # invoke basic auth if SECURED is set AuthType Basic AuthName "Page Error" AuthUserFile "/home/some_username/.htpasswd" Require valid-user Satisfy any Order allow,deny Allow from all Deny from env=SECURED Based on all of this, I have multiple layers to keep people out of the admin pages. What do you all think about these security measures and techniques? Edit: By the way, I was going to use this "LocationMatch" code in the Apache virtual host file, but it didn't work. It popped up the password box, but then the browser went into "waiting" mode. I believe it's because the .htaccess file, with the definition of the admin friendly url, was defined *after* the main apache file Location code. I could be wrong. Here's the code I tried: <LocationMatch /some_admin_url> AuthType Basic AuthName "Page Error" AuthUserFile "/home/some_username/.htpasswd" Require valid-user </LocationMatch> Best regards, Peter1 point
-
Hi Guys I'm sure some of you will know this. But for those that don't..... There was a wonderful event hosted here in Kuala Lumpur yesterday by Amazon Web Services. Amongst the many things they showed us was a service they call Glacier. I'm glad I attended! Cost? $0.01 per gigabyte per month! http://aws.amazon.com/glacier/ Perfect for archiving your digital library! Hope it helps someone! Cheers1 point
-
Here's the next iteration of updates which takes into account the comments above. The biggest changes are: Switch to Arimo for the font–thanks to Diogo for the suggestion. This font seems about perfect for our need here. It looks like the license for it wouldn't let us bundle it in the app, so we have to load from googlefonts... but I think that's okay. It'll continue to use Arial for people that are working offline. Got rid of the entire headline, per BartekG's comments above. The headline really doesn't seem necessary (regardless of how big or small it is), and his post made me realize that. The headline text is now just part of the breadcrumb trail. The drop down navigation now includes drilling down to individual fields and templates. ./colors=classic ./colors=modern ./colors=warm ./colors=futura Dropdown example: Not sure I understand–can you clarify which submenu items you are talking about (in the page list maybe)? Anyone else agree? What I was gathering from previous feedback was that folks wanted page list actions that were bigger and less subtle, so making them look a little more like buttons was the intent here. I just want to clarify that this is 1 theme, not 4. The color schemes are merely different SCSS variable files included at the top. Otherwise everything else is the same. There's no maintenance burden here. We are also in a spot where many like the classic color scheme, and it's kind of become our brand. But an equal number (or more) dislike the colors to the point where they see them as childish. So I think we have to answer that by having a variable palette / different options from the start. Good suggestion. I had started to think the title was more important than it was. I looked at several other CMSs to compare (Drupal, Joomla, Concrete5, EE, Craft) and noticed that this new admin theme started the content input before any of those–a good thing for sure. But then I got to WordPress, and noticed their content input is practically at the top of the screen! Granted WordPress uses sidebar navigation rather than header navigation, but it drove home your point for me. It's going to look like you've got a big footer if you have little content on the page and no scrollbar. That's because the <body> background color is the footer color. If you have a lot of content on the page, you will have a very small footer. The actual footer is actually very small / very little padding, but that may not be clear on some screenshots. I'm not sure I agree with this, but it doesn't matter now that the title is gone. Yes the forum may have a black title, but I believe that was a limitation of the IPBoard theming system. Notice the rest of the site (outside the forum) uses the pink titles. So the admin theme was trying to be consistent with that. I'm not against the idea, but since we already support custom icons there, I think it would be too much. Also, we already have visual cues that indicate whether an item is open, so additional icons/cues would be a form of double emphasis. Still, I think in the future, we will probably have default icons for when non are specified (like open and closed folder, triangles or something like that). Thanks–I will look into these. I don't think it should matter. Try hitting reload a couple times to make sure your cache is fresh. Also, your screenshots look to be the old admin theme rather than the one discussed in this thread? Though the icons should work in either, but just want to make sure I know which we're talking about.1 point
-
I like admin default colours but totally agree that it has a boxy look when you get lots of inputFields. If the new theme solves that problem it would be a great enhancement.1 point
-
Stolen from the blog profile. This will get all events for the month of May, 2013 $firstDay = strtotime("2013-05-01"); $lastDay = strtotime("+1 month", $firstDay)-1; $events = wire('pages')->find("template=event, date>=$firstDay, date<=$lastDay, sort=-date"); The rest of it is in the archives.php template.1 point
-
The hook you'd want to use would probably be Page::viewable. However, hiding pages that a user can't edit just doesn't work in a tree hierarchy, because how then would a user get to the pages that they can edit? A better strategy would be to figure out exactly what you don't want the user to see in the admin tree, whether it is branch of a tree, a specific page, or all pages using a specific template. And take into account the fact that nothing under the page(s) will be editable since the user won't be able to navigate to them. public function init() { $this->addHookAfter('Page::viewable', $this, 'hookPageViewable'); } public function hookPageViewable(HookEvent $event) { if(!$event->return) return; // page already not viewable $page = $event->arguments(0); if($page->template == 'my-private-template') $event->return = false; }1 point
-
Namespace aliasing is fine, but I'm really hoping to isolate our users from having to think about namespaces at all (unless they want to specifically use something outside of PW). I would gather that most of our users don't care or know about namespaces, so any extra technical verbosity reflects poorly on the simplicity of the system. I don't want people to have to have 'namespace' or 'use' statements at the top of every template file (unless they want to, again), but module files are ok. Not sure if that's even going to be an issue.1 point
-
Let's try with a couple of pointers and such first. Take a look at site/modules/HelloWorld.module (included with default installation) for an example of an autoload module and hooking methods - example 1 is really close to what you need. As Ryan said, you're aiming for Pages::saveReady with your hook. See http://wiki.processw...Module_Creation for more details on creating modules. This information should be enough to make an autoload module of your own, and have some method there run every time a page is saved. Of course you also need a field for the total price. Create a new field and set its visibility to hidden. Save the field once first to see this option in input tab. Then just add it to your product template. Getting further, you'd probably want to do your magic only for pages with the product template. And sanitize the price and vat before any calculations. You can set fields for the page in your hook like this (and they get saved magically): $page->nameOfYourField = "this is the value"; Now just go and try to create the module. . . . And now that you've tried and got it actually working (right? ), you can see an example of a working module here: https://gist.github.com/4462130. This calculates the area of a box with given width and height on a page with certain template - sounds a bit familiar, doesn't it?1 point
-
Well, as suggested: I would put this code in a page with a non cached template: <?php $id = $sanitizer->text($input->get->id); $whichPage = $pages->get($id); $whichPage->views = $whichPage->views+1; $whichPage->saveField($whichPage, 'views'); And in your pages / other templates you place something like this (jQuery assumed): <script> $.get("/mycounter/", {id: <?= $page->id ?> } ); </script> "mycounter" would be your counter page with the counter template. [totally untested]1 point
-
Hi Ryan, Thanks for all your work...really! Someone releasing their project like this truly speaks for itself. How do you feel about removing the name of individual (you of course) from the admin side in the footer but leaving the software info? ProcessWire 2.2.0 © 2012 Ryan Cramer vs. ProcessWire 2.2.0 © 2012 The reason being, the moment I showed the admin login the first question I was asked is "Who the heck is Ryan, I though you will be doing the work?". So it just looked like I 'stole' an app from another individual. Is there a perhaps a 'company name' that we can use as an alternative? Again, please don't take this the wrong way just asking so I don't step on anyone's toes. As always, thank you.1 point
-
Regarding workflow: the default profile is pretty much always my starting point. It's rare that I don't end up repurposing the fields and templates that are already there to start building things out. Likewise, I usually end up just renaming (as necessary) and repopulating the pages that are already in the default profile. Then I will start adding new fields, followed by templates, specific to the needs of the site. While I try to determine most of the templates/fields that I'll need ahead of time, I will continue adding fields and templates throughout the entire development process as necessary to make the site do what I want it to. Most larger PW sites are pretty relational and make good use of Page references. But this is also the part that I think is most important to outline when it comes to workflow. This part is quite a bit different from other systems, but has major advantages. I try to make my selectable Page references part of the site's structure, if at all possible. For example, on tripsite.com, every bike tour has a "country" page reference field, and those countries are useful in the site's overall structure (Netherlands in this case): http://www.tripsite.com/countries/netherlands/ In other cases, page references might not fit as part of the site's general structure, so I'll have a /tools/ section in the site where they live. Though it's easy enough to make them function as pages, so I figure why not. Here are a few examples (they are all using the same template): Multi-page reference field "months" (April in this case): http://www.tripsite.com/tools/months/april/ Multi-page reference field "tour_types" (Guided in this case): http://www.tripsite.com/tools/tour-types/guided/ Page reference field "difficulty" (Difficult in this case): http://www.tripsite.com/tools/difficulty/difficult/ The template used on those pages is not much more than this: $tours = $pages->find("template=tour, {$page->parent->name}=$page, limit=10"); foreach($tours as $tour) { // output the tour } Admittedly, most of my projects are rebuilding existing sites, so I usually have some (or a lot) of data to migrate to the new site. This becomes a major component of the development workflow, so I figured I should mention it here. After I've setup the necessary fields and templates (and usually before front-end development), I'll work on bringing in the new data. If it's a relatively simple conversion job, I might use the ImportPagesCSV module. But most jobs require some markup replacement, character set conversion or other things, so I'll build my own import script. This is where I like to bootstrap PW from a command line PHP script. Here's a simple example: /import-airports.php #!/usr/bin/php <?php require("./index.php"); // bootstrap PW $fp = fopen("./airports.csv", "r"); while(false !== ($data = fgetcsv($fp))) { $page = new Page(); $page->template = 'airport'; $page->parent = '/building-types/airports/'; $page->title = $data[0]; $page->location = $data[1]; $page->year = $data[2]; $architectName = wire('sanitizer')->pageName($data[3], true); $architect = wire('pages')->get("/architects/$architectName/"); if(!$architect->id) { $architect = new Page(); $architect->template = 'architect'; $architect->parent = '/architects/'; $architect->title = $data[3]; $architect->name = $architectName; $architect->save(); } $page->architect = $architect; $page->save(); echo "\nCreated page: {$page->url}"; } Once I've got a lot of data to work with in the system, I'll start doing front-end development: creating the template files, markup, css and anything else necessary to handle the output for the site. The files from the basic profile either get used as a starting point, or replaced completely at this point. These are my main workflow components I can think of, but let me know if there are any specific areas you'd like more detail on or can think of anything I've missed.1 point
-
Updated this to support localized day titles and simple prev/next navigation. <?php function renderCalendar($page, $year, $month, $field = 'startdate') { // This feels little dirty, there is probably much more efficient way to get local day name? $mon = strftime('%a', strtotime("2011-11-14 00:00:00")); $tue = strftime('%a', strtotime("2011-11-15 00:00:00")); $wed = strftime('%a', strtotime("2011-11-16 00:00:00")); $thu = strftime('%a', strtotime("2011-11-17 00:00:00")); $fri = strftime('%a', strtotime("2011-11-18 00:00:00")); $sat = strftime('%a', strtotime("2011-11-19 00:00:00")); $sun = strftime('%a', strtotime("2011-11-20 00:00:00")); $year = (int) $year; $month = (int) $month; $startTime = strtotime("$year-$month-01 00:00:00"); $endTime = strtotime("+1 month", $startTime); $lastMonth = strtotime("-1 month", $startTime); // find all events that fall in the given month and year $events = $page->children("$field>=$startTime,$field<$endTime"); // get all the info you need to draw a grid calendar $weekDayNames = array($mon, $tue, $wed, $thu, $fri, $sat, $sun); $firstDayName = strftime('%a', $startTime); // i.e. "Tue" (Eng) or "ti" (Fin) $daysInMonth = date('t', $startTime); // 28 through 31 // make the calendar headline $out = "<h1>" . strftime('%B %Y', $startTime) . "</h1>"; // i.e. October 2011 $out .= "<div class='nav'>"; $out .= "<a href='../../". date('Y', $lastMonth) ."/". date('m', $lastMonth) ."/'>←</a>"; $out .= "<a href='../../". date('Y', $endTime) ."/". date('m', $endTime) ."/'>→</a>"; $out .= "</div>"; // create the calendar header with weekday names $out .= "<table class='calendar'><thead><tr>"; foreach($weekDayNames as $name) $out .= "<th>$name</th>"; $out .= "</tr></thead><tbody><tr>"; // fill in blank days from last month till we get to first day in this month foreach($weekDayNames as $name) { if($name == $firstDayName) break; $out .= "<td> </td>"; } // draw the calendar for($day = 1; $day <= $daysInMonth; $day++) { // get the time info that we need for this day $startTime = strtotime("$year-$month-$day 00:00:00"); $endTime = strtotime("+1 day", $startTime); $dayName = strftime('%a', $startTime); // if we're at the beginning of a week, start a new row if($day > 1 && $dayName == $mon) $out .= "<tr>"; // create the list of events for this day (if any) $list = ''; foreach($page->children("$field>=$startTime, $field<$endTime") as $event) { $list .= "<li><a href='{$event->url}'>{$event->title}</a><p>{$event->location->title}, <span class='city'>{$event->location->city->title}</span></p></li>"; } // if any events were found for this day, wrap it in <ul> tag if($list) $list = "<ul>$list</ul>"; // make the day column with day number as header and event list as body $out .= "<td valign='top'><h2>$day</h2>$list</td>"; // if last day in week, then close out the row if($dayName == $sun) $out .= "</tr>"; } // finish out the week with blank days for next month $key = array_search($dayName, $weekDayNames); while(isset($weekDayNames[++$key])) { $out .= "<td> </td>"; } // close the last row and table $out .= "</tr></tbody></table>"; // output the calendar return $out; }1 point