Leaderboard
Popular Content
Showing content with the highest reputation on 03/07/2013 in all areas
-
I'm pretty close to having native core support for multi-language page names. It's something I wanted to add originally in 2.1, but just didn't know exactly how without adding lots of overhead. After marinating on it for a long time, an easy way to accomplish it finally became apparent. A nice thing about it is that it does it with near zero overhead. It won't be as fancy as the LanguageLocalizedURL module, but it should be good for people that have relatively simple needs. It's the one feature that we were missing that would really let the multi-language fields sing, and it should lead the way for making more fieldtypes multi-language capable. It works by enabling you to specify an alternate name for each page, for each language. When a page is accessed at its alternate URL, then the language is automatically detected and set for the request. Combined with multi-language fields or multi-language alternate fields, it provides a full multi-language solution without need for multiple trees or having to use any code to set the language. It's not the right solution for all situations, but for some situations, it'll be quite nice. Lets say you've got the page /about-us/contact/. For the "about-us" page you've set the Spanish language name to be "quienes-somos", and for the "contact" page you've set the Spanish language name to be "contacto". When the URL /quienes-somos/contacto/ is accessed, it's technically referring to the same page as /about-us/contact/, except that the user's language is automatically set to Spanish, and thus any multi-language fields output in Spanish. Calls to $page->url on any other pages also output the Spanish URLs. You don't have to define alternate labels for all pages if you don't want to. So long as there is just one of them in the URL (like in the rootParent, for example) then it'll be able to detect the language automatically. In order to avoid problems with having multiple URLs displaying the same content, it doesn't let you access the page with a URL like /about-us/contacto/ (English and Spanish mashup), because both of those pages have their names translated. So if you accessed such a URL, it would 301 redirect to the Spanish version. Here's a screenshot that might help to explain how these things are defined. This will be committed to the core within the next few days, as part of the LanguageSupport group of modules, but I'm going to leave it as an uninstalled alpha then beta module, until ProcessWire 2.4.5 points
-
Page References Tab This little module adds a new tab, References, to the page editor. There it lists pages referencing the page that is being edited (title, path, field). There are also links to view or edit the listed pages (if they're viewable/editable). Only fields of type FieldtypePage are considered to be references and system fields are not listed at all (roles, permissions). It's nothing much, but as the subject has turned up a couple of times in the forums, I decided to give it a try. So watch out what you're asking! Screenshot Links Modules directory: http://modules.processwire.com/modules/page-references-tab/ GitHub: https://github.com/niklaka/PageReferencesTab3 points
-
3 points
-
Excellent advice. Looks like I will be developing my first ProcessWire Module!2 points
-
pw will never compete with out-of-the-box-blog-engines like wp when it comes to setting up a blog rapidly. from my point of view this is a major advantage of pw.2 points
-
Actually, now that Pete mentioned it (kind of), it might be better to add that hook to saveReady instead of saved. You might have access to password in plain text at that point, but you'd still be (nearly) sure that page will get saved. When hooking to save, there's always the possibility that page won't get saved after all, and in that case it'd be awfully early to send that email I'd still strongly suggest not sending passwords in plain text over unsecure mail protocol. That's why instruction to use "forgot your password?" feature is IMHO better choice.2 points
-
"So someone in your team should be the gatekeeper for these administration resources." Yep, always keep someone around who can take all the blame. My dog has a very rough time in that regard.2 points
-
Right, here you go! This is three files complete with instructions for creating news. You need to do some work, but a lot of it is done already. Full instructions are in the newsfunctions.inc file. Just copy the three files to /site/templates/ and then change as you wish. This does not NOW includes categories - just a simple news posting. But it is enough to get you started. It is for a main news page that lists news articles and links them through to their own template. The news articles are all pages created under a hidden page. The main news index page includes pagination. https://github.com/jsanglier/Pw-News Joss2 points
-
Hi to all, As I've mentioned earlier to Ryan, ProcessWire runs fine on Windows 7/2008 Server setup with IIS 7.5 WebServer with IIS Mod-Rewrite from Micronovae that can read .htaccess file. The problem is that this IIS filter is free for development use on localhost without limitations but it's not free for production use on live server (it costs $150 per server license). I've found another solution that works flawlessly and it's absolutely free. Download URL Rewrite Module 2.0 for IIS from http://www.iis.net/download/urlrewrite and install it Define new web site under "sites" in IIS Manager and point it to directory where you've unzipped ProcessWire files Download web.config (translated from original .htaccess) file from this post, unzip it and put it in ProcessWire root directory Delete .htaccess file (because you don't need it any more). I hope that this will help someone if the need arises for ProcessWire use on this kind of install. web.config.zip1 point
-
Here's my first processwire site: www.a-cat.nl ported from modx, the design was already ported from wordpress to modx. HTML Kickstart is used for the basic structure. I had someone do the porting from modx. There are still a number of layout issues with it, having to do with html kickstart margins mainly, but all in all this site is pretty much as I like it. The amazing and awesome apeisa thumbnails module is used to make all the images that are used all over the place in this site, that really makes a difference in speeding up writing new articles, I used to crop the images offline, but now it is a snap. The site also uses the ProCache module, so tell me how fast it feels. Any suggestions welcome! I am sooo happy I found processwire, I come from modx evolution which was/is absolutely great. Processwire is what I hoped modx would grow into. If you want to know why I now went for processwire read the former leading german modx guy who really nailed it for me in this page where he explains why he left modx and went for processwire. With processwire I might have to learn a bit more about php, but from what I see so far processwire really delivers on speed, flexibility and simplicity..1 point
-
Hi, when you are on your own local machine and want to 'upload' a file and wants to get it unzipped, you should provide the path to an unzip-app and all needed params / flags for it. (A commandline app!) If you don't have one, you may go and fetch 7z. It comes with an additional commandline prog called '7za.exe' Put it somewhere into your systempath, open a shell command (cmd.exe) and type in 7za -h or 7za --help to get a list of available commands and switches. If you have figured out the needed command and switch/es, write this into your PW-site config.php, instead of the unix there. I use 7za.exe sometimes with PHP-CLI on my local machine, - but only to zip archives. I never have used it to unzip via cli.1 point
-
There will be a way to get URLs for the page in any language. I haven't yet figured out where to put it, but it'll be there. Of course, you can always do this too: $saved = $user->language; foreach($languages as $language) { $user->language = $language; echo "<li>$page->url</li>"; } $user->language = $saved; Probably what I'll do set set it up so that you can pass a context to $page->url, like $page->url($language); Overlapping will be okay, and I imagine necessary in some cases where a word is the same in two languages. So long as one of the parent names is language-specific, it'll still resolve to the right language. If there is a collision between the page and all parents, then at that point you would have to make something unique about the page's URL so that the pages don't have the same exact path. Homepage has no path, so there's nothing to trigger a language selection there. In a setup using multi-language page names, I imagine the homepage would either be 1) a gateway asking you to select a language; or 2) be presented in the default language with links to other languages. Homepages for other languages would have to be at some other URL, like domain.com/de/ or wherever you wanted it.1 point
-
Sorry for the confusion teppo - I thought I was on the very latest version, but apparently I was one or so behind. All working again - thanks!1 point
-
I've got a CKEditor 4.1 Inputfield pretty far along. I'm trying to duplicate most or all of the functionality we have in TinyMCE with regards to the link and image plugins. So far I've got the link one fully functional, and hope to have the image one wrapped up soon. The docs are nice to look at for CKEditor, but I haven't found them to be any more useful different than TinyMCE's. I still have to ultimately figure out how to do everything via the Chrome web inspector and "trial and error". Though part of this is because we use our own dialogs rather than the ones supplied with TinyMCE and CKEditor. I'm loving the inline mode (using it in the admin). I've got a couple dozen textarea fields to power on a single page. Using TinyMCE or CKEditor regular editing mode, it took several seconds of loading/initialization. I experimented with Redactor, which was quite bit faster for that, but still not perfect. Then I tried out CKEditor's inline mode and BAM! they all load in an instant. So CKEditor's inline mode seems to have some real benefits in speed… particularly if you need to power lots of rich text fields in 1 editor (like you would in a repeater, for instance). Or in my case, several repeater items, each containing TextareaLanguage fields for 6 languages… meaning, potentially dozens of rich text fields in 1 editor. So finding something that could do rich text editing quickly became a necessity. And it looks like CKEditor nailed it with this.1 point
-
1 point
-
1 point
-
1 point
-
I can confirm Dave's problem. An integer field that I set to Number (html5) in Numeric Input Type, reverted to Text when saved. Dave s not crazy.1 point
-
I look at it like a line of obedient hounds following a trail of tasty morsels. When they get to where you are currently standing, they all sit there looking at you with big, expectant, eyes, waiting for you to drop something.1 point
-
I would actually separate out each Vendor and each invidivual Product to be under their own tree like: /vendors/vendorname/ /products/product-1/ You then just use a Page fieldtype to link products to relevant vendors: http://processwire.com/videos/page-fieldtype/ and then use code on the product name something like this to pull the vendor into the product page: <?php $productvendors = $pages->find("template=vendors, id=$page->vendors"); // Assuming you could have more than one vendor per product $productvendor = $pages->find("template=vendors, id=" . $page->vendors->first()); // Or just one vendor You can also do it the other way to view a vendor page and list all products they sell: <?php $vendorproducts = $pages->find("template=products, vendor=$page"); // Assumes your Page field is called vendor1 point
-
I do have a habit on a couple of sites of having the current page added to the breadcrumb but without a link. It just feels more complete to me. If it sounds odd, go back to the fairy tale and assume that the current page without a link is the spot you're standing on without dropping any breadcrumbs. "You are here, in case you didn't know and don't see the title in an obvious location on the page" can actually be relevant if you arrive at a page from search results for example, but I think it's more about personal tastes than anything else.1 point
-
Depends a lot on how the book is written. I really don't like those books that assume that you are reading them in front of the computer. I avoid them like the plague Of course it's good to test things, but if the book is well structured (IMO) You can do it after each chapter for example. Larry Ullman books are great in that matter.1 point
-
Glad you got it working. I couldn't finish the export profile, as it doesn't currently work with multilanguage.. However I commited an update to the module and updated readme to make more sense. https://github.com/mcmorry/PW-language-localized-URL1 point
-
I think you might get access to the password value if you hook before the page is saved, but I don't have time to give an example just now (Soma or someone else with fast typing fingers will doubtless be here soon with an example).1 point
-
Think Fieldtype Concat will help you out. Only fieldtypes stores data in DB, not their fields. So I think when you look at The above Fieldtype lots of questions will be solved.1 point
-
Typekit and FontSquirrel are two different technologies. Typekit uses webfonts. FontSquirrel uses @font-face. Check out their FAQ: http://www.fontsquirrel.com/faq Basically you can browse their site and download a font. Turn around and use their Font Generator. http://www.fontsquirrel.com/tools/webfont-generator It creates web friendly fonts variations for you to use in a ZIP file, along with a sample demo page. Here is a small example on how to use @font-face. http://css-tricks.com/snippets/css/using-font-face/ Personally I bought a year subscription with Typekit, because they offer some commercial fonts that are not allowed to use with @font-face.1 point
-
There is another post going around titled "Repository of php Scripts for Templates" -> http://processwire.com/talk/topic/1018-repository-of-php-scripts-for-templates/ Maybe we can take this opportunity to post little addon snippets to the above news/articles "gizmo", lol, I don't know what to call it, gizmo felt appropriate! I've got the above downloaded and installing later. If I make any changes, I'll tidy things up and I'd like to share them here.1 point
-
I have sort of started the process by accident in answering a different post https://github.com/jsanglier/Pw-News The way I have done these (because it is the way I now tend to work) is to do them as functions that can just be rendered on whatever page.1 point
-
Great site! The design really compliments the nautical/sailing photography quite nicely. It makes me want to go sailing. I wish I could… But we have no big lakes, rivers, or any large bodies of water in Atlanta… well except for in my basement when it rains.1 point
-
I think that traditional version control with Git or the equivalent is great for template files, front-end development files and your own custom modules. When it comes to defining the templates and fields on the admin side, it's better to do this from the admin rather than migrating SQL queries or the like. So someone in your team should be the gatekeeper for these administration resources.1 point
-
How much time per day do you spend looking at the light of the screen? I would guess too much... I prefer to stay away from it as much as I can, and reading on paper is great for this. Plus, you can do it on a coffee table outside or on a bench by the river Now I bought a kobo e-reader. With the e-ink technology It really feels like paper and I recommend it to everyone.1 point
-
It doesn't matter. Though if you had multiple "sort=something" statements, then it would consider the order of the sort statements. Meaning, if you had "sort=last_name, sort=first_name" then the results would first be sorted by last_name and then by first_name. Whereas "sort=first_name, sort=last_name" would do the opposite.1 point
-
Wanze, just a crazy idea. How about building a "visual query builder" as a separate module? That would be the tool that non superuser could use to create pages->find queries. Then people could build on top of that some additional modules on what to do with selected pages. Not sure if I understand myself what I just wrote, but it does sound cool1 point
-
1 point
-
Ryan, You are right of course Funny, when i wrote the js code I knew something is missing but I couldn't figure it out then. Corrected my post.1 point
-
What I meant was for accessibility only the app like for mobile is available. Works nice thx for sharing mats1 point
-
I implemented the first of your requested features (MarkerClusterer) in your RCDMap class. You can find it here: http://processwire.com/talk/topic/690-map-marker-fieldtype/page-3#entry25865 Here it is in action (built for mobile): alltpaoland.com1 point
-
This is true. It's not currently possible. I understand there are some good use cases for supporting one level of repeaters within repeaters, so I'll be on the lookout for a way to support it. But for now, the best route to take for the use case you mentioned is to do it with pages instead of repeaters. Though in your case, I think the textarea option might be a good one since you only need a key and value. You could enter the variants like this: 5.99=Half order 6.50=Half order with cheese 9.50=Full order with cheese On your front-end, you could work with it like this: $variations = array(); foreach(explode("\n", $item->variations) as $line) { list($price, $label) = explode("=", trim($line)); // you could output the variations right here echo "<li>$label: $price</li>"; // or you could stuff them into an array for later use, like this: $variations[$label] = $price; } // how you might output the array, if preferred echo "<table>"; foreach($variations as $label => $price) { echo "<tr><td>$label</td><td>$price</td></tr>"; } echo "</table>";1 point
-
Finally tried it out and very cool module! Thanks a lot tepp for the work. I had some time to get how to get it to work as I was looking for the configuration. I didn't realize there's two modules... only after reading the get started again slowly it clicked. I always looked in the process module. Sometime those module that have more than one .module can get confusing, almost annoying. It would be cool in general to have modules grouped together. It's all there but sometimes when installing a new module hard to find if you don't know/remember what to look for. I noticed when looking for help, that there's version 091 on modules.processwire.com but it downloaded the one from github anyway with modules manager, but wanted to let you know you'd have to update that version on modules.processwire.com to get recognized as new version in modules manager.1 point
-
I don't know Piwik, but glancing over their API documentation it seems fairly simple to grab and display to the data you want on the site. This would be more robust and flexible i think plus it would allow, as Ryan already mentioned, use in a cached environment.1 point
-
When using pagination, make sure you set "start=0" on any other non-paginated, DB-selector based calls that include a "limit=n" in them. Otherwise it'll attempt to paginate those too.1 point
-
Hey guys, I've created an initial ProcessWire bootstrap repository if any of you want to use it. Try this, branch it out, do whatever you want with it. https://bitbucket.org/thatgibbyguy/base_html5_processwire The features of this bootstrap are: HTML5 Boilerplate Modernizr/HTML5 Shiv Javascript Libraries: Twitter Bootstrap Javascript Library jQuery-1.8.2 jQueryUI-1.9.1 jQuery.fittext.js jQuery.mobile-1.20 jQuery.scrollto-1.4.3.1 retina-0.0.2 CSS/LESS Frameworks: font-awesome (not 3.0 yet) KUBE Grid (in LESS) Twitter Bootstrap Library (in LESS - library.less) Base LESS file (style.less) Key changes to Ryan's initial download are just that I took each one of his calls and abstracted them out as includes. So Ryan's functionality has been abstracted into the following includes: Breadcrumbs -> breadcrumb.inc Page Titles -> pagetitle.inc Random Image -> randomimage.inc Search -> search.inc Sidebar -> sidebar.inc For example, to add the breadcrumbs to your site, simply include it in your markup like so: Also included is Soma's Markup Simple Module.1 point
-
Just don't create a template file for these pages template, and their urls will throw a 4041 point
-
Well deleting the original will leave you with a problem as you already know It would be relatively easy to script a batch resize all original images and run that once over all page that has images. Use the ImageSizer class. Working example: $pa = $pages->find("template=basic-page,images.count>0"); foreach($pa as $p){ foreach($p->images as $i){ $ImageSizer = new ImageSizer($i->filename); $ImageSizer->resize(120,0); } } It will resize all the original images to 120x*. And you're done. (This particular example show how cool the on-page images are.)1 point
-
Hi Ryan, would you mind sharing some details on how you integrated FullCalendar? I've never setup a JSON feed, so I'm not quite sure where to start. I built a similar type of calendar a while back using Textpattern, and I'd like to accomplish the same thing with Processwire and FullCalendar. Even a nudge in the right direction would be helpful.1 point
-
WillyC's example just modifies the output of the $page->path() function (which is also used by $page->url). His intention there is to change what URL gets sent out when you call $page->url. It's really no different than making your own function and using it instead, except by using a hook like this, you can continue to use ProcessWire's API and get the result out of it that you want. Ultimately it's just a syntax convenience. While his hook example handles the URLs that get output in your markup, you still have to have something to look for and capture those URLs. Perhaps you could use mod rewrite, but typically you would use the "URL segments" feature that you see on the "URLs" tab when editing any template in PW admin. Lets use a simple example of your homepage template (home) with filename home.php. And lets say you want to make it so that when someone access domain.com/contact/ (a URL that doesn't currently exist) you want it to display the page that lives at domain.com/about/contact/. So you are setting up your site to respond to the shorter URL of /contact/ (rather than /about/contact/, where the page actually lives). Go to Setup > Templates > home > URLs. Click the checkbox to "allow URL segments", and save. Now edit your /site/templates/home.php file, and do something like this at the top: if($input->urlSegment1 == 'contact') { // render the /about/contact/ page echo $pages->get('/about/contact/')->render(); return; } else if($input->urlSegment1) { // throw a 404 throw new Wire404Exception(); } // otherwise continue normally and display your homepage.1 point
-
I wasn't sure what first what you meant by switcher, but now I think I get it. Assume I understand correctly, you need something to target the switch like a GET variable, i.e. domain.com/?theme=pretty Then before you send any output (like before your <doctype>) you'd check for that GET variable and stuff it in the session. if($input->get->theme) { // set the theme $session->theme = $sanitizer->pageName($input->get->theme); } Now that value in $session->theme will be retained regardless of what page they click on, or at least until they set another. When you get into the <head> part of your document where you are going to be outputting the stylesheet links, you would just check the value of $session->theme: if($session->theme == 'grunge') { $css = 'ugly.css'; } else if($session->theme == 'pretty') { $css = 'baby-unicorn.css'; } else { $css = 'default.css'; } echo "<link rel='stylesheet' type='text/css' href='{$config->urls->templates}styles/$css' />";1 point
-
Another approach you could use would be to use PW's WireUpload class: $ul = new WireUpload($field_name); The rest here:1 point
-
Great post Ryan. Coming from both a EE and Symphony CMS background, Processwire is a huge improvement in managing page content (in Symphony, it is so hard to manage a simple brochure site that it is almost not worth doing). The simplicity of Processwire all the way through its core is definitely the most attractive thing about this application, and I admire your clear hard work at creating such a powerful and yet, basic system. (Not knocking Symphony here, it is exceptional for other use cases, but the majority of sites that I build as a freelancer lend themselves much better to Processwire)1 point
-
Almonk, Here's one way you could do it (below), using ProcessWire's WireUpload class: <?php $page->setOutputFormatting(false); // instantiate the class and give it the name of the HTML field $u = new WireUpload('userfile'); // tell it to only accept 1 file $u->setMaxFiles(1); // tell it to rename rather than overwrite existing files $u->setOverwrite(false); // have it put the files in their final destination. this should be okay since // the WireUpload class will only create PW compatible filenames $u->setDestinationPath($page->files->path); // tell it what extensions to expect $u->setValidExtensions('jpg', 'jpeg', 'gif', 'png'); // execute() returns an array, so we'll foreach() it even though only 1 file foreach($u->execute() as $filename) $page->files->add($filename); // save the page $page->save(); Another way to do it would be a more traditional PHP way: <?php $page->setOutputFormatting(false); // we run the $name through $sanitizer to make it PW compatible... // ...this prevents the possibility of it getting renamed on the add() call below $name = strtolower($sanitizer->name($_FILES['userfile']['name'])); // prepend underscores to filename until it's unique... // ...this is just one possible way to handle duplicate filenames while(is_file($page->files->path . $name)) $name = "_" . $name; // validate the file extension $pos = strrpos($name, "."); if(!$pos) throw new WireException("File is missing extension"); $ext = substr($name, $pos+1); if(!in_array($ext, array('jpg', 'jpeg', 'gif', 'png'))) throw new WireException("Invalid extension"); // determine the final destination and store it in $file $file = $page->files->path . $name; // move the file to it's destination using PHP's function if(move_uploaded_file($_FILES['userfile']['tmp_name'], $file)) { // add it to the page $page->files->add($file); /// save the page $page->save(); } Btw, no need to turn outputFormatting back on unless you are rendering parts of that page in the same request. Neither of these examples perform much error checking, which you may want to add. Though the WireUpload class will populate PW's "$notices" API var with any errors: <?php foreach($notices as $notice) { if($notice instanceof NoticeError) { echo "<p>Error: {$notice->text}</p>"; } } If you are using the PW's admin templates, then it already does something like the above snippet.1 point