Leaderboard
Popular Content
Showing content with the highest reputation on 05/02/2013 in all areas
-
Hi all, I just switched to processwire from MODx and I am really impressed of how clean, fast and intuitive this system is. My first project with processwire happens to be a multi language site, and I am really happy that it can be done with a single page tree. However, I had to dig the forums a lot to find all information i needed to get everything working, so I thought I share my newly gained knowledge... The order of the steps is important, especially if you are working on IIS (which can inflict database damage if you add languages before you change the field types!) 1. Install the Language support modules: - Languages Support - Languages Support - Fields - Languages Support - Page Names 2. Change any existing Fields of types Textfield/Textarea/PageTitle to TextLanguage/TextareaLanguage/PageTitleLanguage You now will have an input field for each language you add. 3. Set up your languages under Setup->Languages (define a name and title for each language. For each new language, you will have to add a title to all the other languages in that new language) 4. Edit your homepage, set it to hidden and unpublished. UPDATE: don't set the homepage to unpublished, the first-child-redirect won't work! (I realized just now, because if you are logged in as admin, it does work) For each language, you have to define a unique name (e.g. "de" and "en") 5. Edit your "home" template to redirect to its first child: <?php $session->redirect($page->children->first()->url); UPDATE: this is not essential... as ryan pointed out, it might even be better not to do it (for SEO-optimization) 6. If you have something like $children->prepend($homepage); in the menu part of your head.inc, remove it (you don't want the home page to show up in your menu) UPDATE: if you left out the redirect option, you'll want to leave this out as well. 7. To switch languages, add this snippet to your head.inc: <ul> <?php $user_lang = $user->language; foreach($languages as $language) { $user->language = $language; if($language->name != $user_lang->name) { echo '<li><a href="'.$page->url.'">'.$language->title.'</a></li> '; } } $user->language = $user_lang; ?> </ul> Each language except the currently active one will be displayed in a list (of course, this can also be done with a select field). UPDATE: Ryan pointed me to a better solution for the langugae switch: http://processwire.c...s-urls/?p=33537 8. Done. Now your page urls should look something like path/to/root/en/my-page, or path/to/root/de/meine-seite It took me less than a day to set up processwire, install my html template and configure the site to be multi-language... this is so great, considering the pain multilanguage sites usually cause with all the other CMSs... Keep it up! UPDATE: I was a bit quick to post a tutorial just after one day working with PW... should have made some more research beforehand. Just got a little too excited there... I'm still impressed by the system and plan on digging deeper into it.2 points
-
I think $pages->find("template=invoice,created>".strtotime("1 ".date("M"))) should find invoices created this month. You'd need some extra logic for past months, but strtotime is the key.2 points
-
Create custom admin pages easily without having to build a Process Module especially for that. ☞ This module makes it easy to create simple admin pages but you can also create them in much more powerfull way without the need of a module. Have a look at this post written by Bernhard Baumrock to know how it's done https://processwire.com/blog/posts/building-custom-admin-pages-with-process-modules/ ------- I just updated the module, I kind of merged the two versions and now it works with both stable and dev versions of PW. Only difference is that with the stable version you still need to create the child pages and with dev version that is not needed. The instructions are on Github. Enjoy ---- Download or clone from Github https://github.com/ocorreiododiogo/pw-admin-custom-pages Module page is here http://modules.processwire.com/modules/process-admin-custom-pages/1 point
-
I needed a field that would allow me to select one or more templates, very much like the Page Select. So I created a module that does just that! I based it off of Ryan's FieldtypeModules because the functionality is quite similar. You can also define which templates are selectable by the asmselect field. Hope this helps someone that wants to do the same thing! FieldtypeTemplates.module1 point
-
Hi! Just finished my first module This module adds a new "Google-Analytics" Page in your Admin-Panel and displays various Statistics from a Google Analytics Account. It uses the JQuery plugin "jqplot" to display the charts. Github: https://github.com/w...GoogleAnalytics Modules directory: http://modules.proce...ogle-analytics/ Features Visits by Date (Chart) General Statistics about Visits (Total visits, Visit duration, New visitors, Returning visitors etc.) Demographics: Countries, Cities, Languages System: Browsers, Operating Systems, Screen Resolutions Mobile: Operating Systems, Screen Resolutions Pageviews by Date (Chart) Top Content Traffic Sources: Keywords, Referral Traffic by Domain and URI Choose a default date range displaying statistics: last 24 hours, 2 days, 1 week, 1 month etc. Custom date range by setting a "start date" and "end date" Requirements Google Account and Analytics Account A Project in the Google APIs Console cURL Installation 1) Create a Project in the Google APIs Console: Create a new Project in the APIs Console: code.google.com/apis/console/ Under Services, enable the Analytics API Under API Access: create an Oauth 2.0 Client-ID Give a Product Name, choose "Web-Application", Domain doesn't matter Enter a Redirect URI to the GA-Page in your Processwire Installation: http://yourdomain.com/processwire/google-analytics/ Notes: The redirect URI must exactly match with the URL from the new "Google Analytics" page in Processwire. Open the Page and copy the URL from the address-bar (localhost does work too!) The project created in the APIs Console can be reused for every Processwire installation using this module. You just have to enter more redirect URIs 2) Install the module: Place the module's files in /site/modules/ProcessGoogleAnalytics Install the Module via the Admin-Panel Enter Client-ID and Client-Secret keys from the created project in the module config Load the newly created page "Google-Analytics" and click on the button "authenticate" Grant the module access to the Analytics Data Choose a Google Analytics account (Domain) from the dropdown Done: You should see the statistics. Check out the module config options for further customization In order to let other users see the Google Analytics page, you must give their role access to the "ga-view" permission. Ps. Processwire is awesome and so is this community!1 point
-
This might be obvious since MariaDB should be totally compatible with mySQL, but just wanted to say that everything seems to be working fine with running pw with it after doing some selector tests.1 point
-
Your too fast. Thwt makes sense why $= isnt working. Because it gets strpped off...1 point
-
Yeah I think there's maybe some strange hidden chars but it's not. Just found out by try and error, that if the title has more than 50 chars it will break a title=string search... If you strip the title of the page(s) to 50 chars this it works: $title = "Sabine MeyerAcademy Of St Martin-In-The-FieldsKenn"; So, there's maybe some internal title searching that strips title in the query. But anyway, nice to know, still you should try working with names.1 point
-
Maybe someone else more clever can explaing this behaviour, but wanted to say the doing this with title search maybe also isn't the best way. Why not use the page name when importing? This is more a reliable way as the name can't be duplicates and isn't fulltext. $title = "Sabine MeyerAcademy Of St Martin-In-The-FieldsKenneth Sillito"; $name = $sanitizer->pageName($title); $p = $pages->get("name=$name");1 point
-
You can use the built in search in the admin. Just make sure to use "name" instead of "title body" in "Search in field(s):"1 point
-
Or since the title is fulltext search? $pages->get("title%=$title"); I recently think stumbled over something similar. I installed your db and get it to work with using %= or ^=. Not exactly sure what it's all about.1 point
-
I just tried upgrading a PHP 5.2.17 install and ran into the same issue as you did. Though the errors got logged for me, and I'm not clear why PHP 5.2 triggers these errors that PHP 5.3 doesn't, but it was easy to fix. I've pushed a couple of small fixes to dev so that it should work with 5.2 again.1 point
-
Will this work? $pages->find("template=certain, created>=$firstdayofthismonth, created<=$lastdayofthismonth, sort-=created");1 point
-
Thanks for the report diogo! Your good explanation made it really easy to spot the problem. There clearly was a bug with single page Page fields: they were not handled correctly at all. The bug is now fixed and version 1.1.2 of the module has been released.1 point
-
You can move your /wire/ dir wherever you want and use symlinks. However, I don't think this would do anything for security. The benefit of doing it would be just if you want to share the same /wire/ dir amont multiple installs. I think that some CMS products are prone to vulnerable files and so you want to move them out of web root. ProcessWire is not one of those products and your .htaccess file protects several directories from web access. You can try modifying PW's /index.php file to choose a different $config->assets dir. But I don't recommend it, as I've not tested it. Yes, you can store these assets wherever you want. ProcessWire doesn't actually link to them, only you do, in your template files. As a result, it doesn't matter where you put them.1 point
-
That particular setting is meant to be translated per language. If you add /wire/modules/LanguageSupport.module to your translatable files list in Setup > Languages > [language] > then you can adjust the setLocale setting as you see fit, without having to modify the LanguageSupport.module file. Basically, anything that appears in __('') or $this->_('') or $this->_n('') or $this->_x('') is translatable.1 point
-
I would keep the structure flat and use date sorting. Moving posts from a "show on front" place to a "archive" place is most always not a good idea, in PW the structure is reflected in the URL and the URL of the post will change. So if someone linked to the post it will break (though there's a module that solves the issue with url redirects but it's questionable). To have an archive state for a post defined by a structure, where you have to move pages around, is something I would avoid generally. Having content live in a /archive/post1/ structure is always questionable, and if choosing to design such urls it would be done soft using urls segments. In your scenario I would keep the structure "flat" of the posts and if you want to define posts that show up on a up-front page, use a page field to select and sort them. Then render this page list out.1 point
-
Hi fellow forum friends. I've released (on github at least) my new module - Page Edit Fold Status. May not yet be live in modules section of the site. https://github.com/robphilp/PageEditFoldStatus What this does is use a combo of JQuery, Ajax and the session to remember the state of each field when you edit and then save a page, so that when you return to the page after the save (or later) it will recall that state and fold/unfold all the fields so the edit page is how you last left it. We have pages with a LOT of fields on, and we found it irritating to have them all default to open. That said, if they default to closed and you have to drill down to edit some specific bit of data, it's annoying to have to drill-down again each time when you are making many incremental edits, so I made this module to store the state on a per-page and per-user basis. e.g. some users will need to focus on certain fields, so if they have these open and all others closed, it will retain this state each time they edit a page. No need to open/close these fields each time so you can focus on what's important to you. Because of the use of the session, this behaviour SHOULD last for the lifetime of your login. I hope it is helpful! Just realised I've put this in the wrong forum, can someone move it for me?! Thanks!1 point
-
I'm posting this here, but I this problem maybe goes beyond the module itself. While using the selector test I was having some "Trying to get property of non-object" errors. I manage to track it down to, every time the selector test retrieves pages with an empty, single-page, radio field on their templates. I modified the radio to multiple, and the error stopped. I don't get the error while using the same selectors in the frontend, so It's some property that is being called on the fields inside the foreach made by the selectors test. To reproduce the error: Create a page field and set it to single page (choose whatever template or parent to populate it). Add it to a template. Create a page with that template without selecting any option for the page field. Go to Selector test and test for a selector that would retrieve that page.1 point
-
Hi Ryan, Is your module working with 2.3? Everything works admin side (field is added, and I can select roles), but I can still view the page on the frontend. I've tried the obvious (making sure I didn't have the role, logging out, etc...) — no luck. False alarm. The page wasn't actually viewable. I got confused because it is still showing in my nav (using MarkupSimpleNavigation).1 point
-
So, - that thing with the Titles (sanitizing but leave spaces, etc) seams to be solved. Also basic stream support is added. The output to the frontend is only a simple menu and information about current page. It's made for coders You may have a look to output (it's a bit like var_dump) and the code in the 2 Templatefiles. That's intended as starting point for your own Frontend creation. There is an own caching mechanism with the LocalAudioFiles-module. It caches the menus and the DB-infos. It refreshes them when DB gets modified or you may permanently disable caching in the modules page. Here are the latest screencast: https://youtu.be/qeT5s013GUE and here without audio for the german audience https://youtu.be/MefyBCDDXrs I want upload the first site profile, but have got an error when importing (Can't save page 0: /genre//: It has empty 'name' field). So I first want to fix that and upload siteprofile after that. (Maybe tomorrow evening)1 point
-
Great answers, folks! One thing to add for anyone wanting to learn responsive design is to take a good look at Responsive Web Design by Ethan Marcotte -- guy who coined term "responsive web design" and wrote that wonderful article at ALA @kongondo linked above. Book itself is ~150 pages of easy-to-read (and easy-to-understand) practical tips, explanations and examples. Highly recommended (especially, but not limited to, for beginners) and well worth those couple of bucks it'll cost you. You can't get closer to "the source" than this. Keep in mind that even if you're going to let a framework do all the "heavy" lifting for you, it's still worthwhile to understand what's actually happening behind the scenes. (Oh, and while I'm at it, I'd go as far as recommend getting that Responsive Web Design + Mobile First book bundle A Book Apart is offering. Mobile First is another book you'll definitely want to read at some point!)1 point
-
Whether you choose HTML Kickstart, Foundation, Bootstrap, Goldilocks, something else or you roll your own. Everyone will have their favorite CSS framework. Rather than try this one or that one, I suggest you learn ONE and learn it really WELL!!! I used to think that all Twitter Bootstrap sites looked like every other Twitter Bootstrap site. But lately I've been seeing some pretty awesome designs. I'm also a big fan of Foundation. Been using it since version 2.1 point
-
That was a great answer by kongondo. My answer. Responsive design is not harder than non-responive, in fact it's a great deal simpler. Of course not everything has to be responsive but using a framework (like Foundation, which I much prefer to Bootstrap) gives you piece of mind in terms of how browsers behave plus it's just easier not having to worry about exact dimensions and floats when you can just specify a number of columns and away you go.1 point
-
PWired, This article at A List Apart is a must read if you haven't seen it and are interested in responsive design. I wouldn't say responsive design is "hard". It's about being consistent and sensible . I am a firm believer of not re-inventing the wheel. For instance, no matter how good I was at coding (which am not, hehe), I wouldn't bother coding a PHP application to do what PW did because it's already doing all that I want and does it well. So I use the existing tool. This is not to discourage anyone from coding their own app. One should do so if there is a particular need not being met, IMHO. What am I saying? There's already dozens of HTML and CSS frameworks out there that do responsive design out of the box such as Bootstrap and Foundation. I love Foundation and it is what I use. I don't care about floats and DIVs misbehaving because Foundation takes care of that for me. Of course we might get into the argument about some frameworks using non-semantic classes, but I think at times that argument just gets in the way. Besides, leading frameworks now take such matters into account. These things have been tested with screen readers and perform really well. Just Google the subject. In a similar vein, in PW, most of the time I don't care about sql queries since PW takes care of that for me. I would suggest to find a good framework and use it. Of course you don't have to use all the bells and whistles it comes with. Download a custom build, the bare necessities and code away. So, no, it doesn't have to be hard. And you can still learn the basics of responsive design even as you use a framework. It's all about ems, %s and @media queries in CSS3 really These may be of interest... Which Is Right for Me? 22 Responsive CSS Frameworks and Boilerplates Explained | Design Shack Fluid Images — Unstoppable Robot Ninja css3-mediaqueries-js - css3-mediaqueries.js: make CSS3 Media Queries work in all browsers (JavaScript library) - Google Project Hosting Beginner’s Guide to Responsive Web Design - Treehouse Blog What The Heck Is Responsive Web Design? Responsive Web Design Patterns | This Is Responsive Responsive Web Design: What It Is and How To Use It | Smashing Coding How to Design a Mobile Responsive Website - UX Booth | UX Booth Media Queries for Standard Devices | CSS-Tricks 37 Responsive CSS Frameworks Every Developer Should See | Web Design Principles A List Apart: Articles: Responsive Images: How they Almost Worked and What We Need Edit: Difference between responsive, adaptive and fluid http://teamtreehouse.com/library/websites/build-a-responsive-website/introduction-to-responsive-web-design/fixed-fluid-adaptive-and-responsive Edit 2: Forgot to add - of course you'll still have your custom CSS file called after your framework's CSS to have the final say on styling particular elements. But you knew this already1 point
-
Sorry it's been a while since I last updated you guys on this theme. I was moving house when I started this theme and then I didn't have the internet for a few weeks and then I was ill. lol. But I'm all better now and I've continued developing this theme. Before you see the new screenshots of it's progress I just want to share what I found while developing this theme. I found the markup for the admin theme a bit messy. Styling all the fieldsets for example was quite a challenge because some fieldsets are within fieldsets and so you end up with this doubling up effect. As I started to discover more of the admin theme I realised there are a lot of user experience issues and some fieldsets can be quite heavy. Once I've finished this theme I would very much like to offer my help in suggestions for improving the overal experience of the admin. So I took all my learning into consideration and tried to think of the best way to develop a theme that I could build and suited ProcessWire's current way of presenting information; which so far has led me to this approach. I haven't included the header or footers in these screenshots because I'm still playing around with it. Example of editing Guest role: Example of editing Admin user: Example of editing Field module: As you can see it's changed quite a bit, but I'm feeling a lot more confident about where I want to go with this theme. I'll keep you guys updated in the following weeks as to when I'll release an alpha version of it so you guys can help me find any quirky bugs with it. Thanks for listening.1 point