-
Posts
17,306 -
Joined
-
Days Won
1,724
Everything posted by ryan
-
Making the labels configurable based on field values within them, as well as making them initially collapsed, have been mentioned a couple times. Given that, I think we'll have to add this the next time updates are made to the repeater Fieldtype. Repeaters aren't meant to scale infinitely, so if you need that kind of scalability repeaters aren't the best way to go. Though, you'll be glad to know we also plan to introduce pagination to repeaters eventually... so they will be more scalable from the admin interface side.
-
The Datetime fieldtype no longer relies upon strtotime, as it takes your desired input format and then translates it. So whether 1/2/2013 means January 2 or February 1 to you, ProcessWire will take the lead from your input format, rather than how strtotime would translate it. On the other hand, if you are working directly in PHP with strtotime, then you do have to keep track of how it interprets the different formats. If you go with day/month/year, then you need to use hyphens rather than slashes. If you go with month/day/year then you need to use slashes.
-
The blog profile is meant to be roughly equivalent to what you get with a default WordPress install, but of course there are all kinds of possibilities with how it could be taken further. But the intention really is to keep it as a useful starting point, though I'd be happy to see new profiles built that extend it.
-
Nice work dynweb, thanks for posting this! Please add to the modules directory when you are ready too. One question I have is about the resizeThumb function. This may have come from one of the other modules you mentioned, I'm not sure. But it looks like it creates images in a different file format than the ones ProcessWire does, so I'm wondering what happens to those images when their source (larger) image gets deleted? Do the thumbs continue to exist? If so, you might want to change this to follow the same format of PW's images, which is [basename].[width]x[height].[ext]. If one of width or height are not defined in the resize, then they can be zero "0". But if your thumbnails follow this format, then ProcessWire will take care of cleaning them up when the source image is deleted or replaced.
-
Czech localization + TextDomainHelper.module
ryan replied to Radek's topic in Multi-Language Support
Thanks Radek, I have added these is the latest commit to dev. -
Thanks for the report Nikola. I've tried this a few times and so far I can't duplicate it. Are there any other factors you can think of?
-
Also see this post, which shows you how to create a 'switch' function, similar to what you may see in EE.
-
It's hard to say exactly here because I don't see where the <div class="row"> is output in the code example. But generally if you want to take some action (like outputting an opening or closing div tag) after a predefined quantity of items, then you'd use the PHP modulus operator, as described above in an earlier post. Or you can use a counter variable ($cnt) that you increment on every iteration and then check if it's at the iteration you want. For example, this would have two span6 divs within each row div: $cnt = 0; foreach($something as $item) { $cnt++; if($cnt == 1) echo "<div class='row'>"; // start new row echo "<div class='span6'>Content</div>"; if($cnt == 2) { // end row echo "</div>"; $cnt = 0; // reset } } // if $cnt != 0 then we have an unclosed row, so close it: if($cnt) echo "</div>"; It's possible that the last row div could have only one span6 div. If you wanted to prevent that possibility, you'd add this before the last line: if($cnt == 1) echo "<div class='span6'>Content</div>";
-
The best way to check if the language is default is: $user->language->isDefault(); …but if you prefer to add your own fields to the Language template (like 'code') then that's fine too. Another alternative is that you could add your own defines to a common include, and then compare against them. define("EN", 123); // ID of english language page define("ES", 456); // ID of Spanish language page define("FR", 789); // ID of French language page Then whenever you want to compare a user's language, you could do something like this: if($user->language == FR) { // user's language is french } We will be adding more multi-language fieldtypes as time goes on. Thus far there hasn't been a lot of demand for more than the ones we've already got, but it's always been the plan to keep adding more.
-
Assuming this is also easiest for you, GitHub issues are great. I prefer this because: 1) I can reply to the emails it sends me and it goes in the thread; 2) I can reference the issue # from a commit and it goes in the thread; 3) It notifies you when I fix it; 4) It's impossible to miss or get lost--it stays there till I fix it. Whereas, in the forum it is easy for me to miss or lose things just because there is so much here. I need to learn how to use PHPUnit so that I can help with this. I looked through the code, but am not yet grasping how it works. I'm not totally clear what PHPUnit does that couldn't be done with a couple small functions of our own, but I hope to be over my ignorance on that soon. I will read/study more here and get up to speed so I can participate.
-
creating user permission to create user -- best practice?
ryan replied to evan's topic in General Support
You can't do this from the admin, as user management there is intended as an administrative task. But you can use the API to check and enforce role settings specific to your needs. For example, here's how you might make a "create vendor" form: if(!$user->hasRole('editor')) throw new WireException("You don't have access to add users"); if($input->post->submit_add_user) { $name = $sanitizer->pageName($input->post->user); $pass = $input->post->password; if(empty($name) || empty($pass)) { echo "<h3>Name and password are required</h3>"; } else if($users->get("$name")->id) { echo "<h3>That username is already taken</h3>"; } else { $u = $users->add($name); if(!$u->id) throw new WireException("error adding user"); $u->pass = $pass; $u->addRole('vendor'); $u->save(); echo "<h3>Added vendor: $u->name</h3>"; } } echo " <form action="./" method="post"> <h2>Create new user with vendor role</h2> <input type='text' name='user' /> <input type='password' name='pass' /> <input type='submit' name='submit_add_user' /> </form> "; -
Well I think in this case, it's just that PHP doesn't have a built-in translation engine for this stuff. Functions like strtotime() do recognize English month names and such, but I think they are really intended to translate the most commonly used date strings to unix timestamps (most of which are digit based). It would be like it was/is in 2.2.9, as I think English is the default. Maybe I can just put in a note there, along the lines of "Warning: in languages other than English, stick to digit-based date inputs as only English month names are recognized in string-to-time date conversions." … or something like that
-
Not a poke at all. Right now I'm focused on getting 2.3 out and some client work, so not yet at a point where I can get into development for this. But these are all good ideas that we'll get into soon. I enjoy reading this stuff and then letting it marinate on the mind for awhile. Keep the conversation going. Once I get to a place where development is near, my posts will make yours look like short posts.
-
When you are manipulating a page for the purpose of saving your changes via the API, then you want to make sure that the output formatting state is OFF. When output formatting is OFF then your images field will always behave as an array. The single-image reference (with setting 1) is primarily for front-end syntactic convenience so that you can do echo $page->image->url rather than $page->image->first()->url. But behind the scenes, it's still always an array. This reveals itself when you try to set a value to it and output formatting is on, for instance. But in general, it's not good to set any values you intend to save when output formatting is on.
-
Btw, for anyone else trying to install Pear/PHPUnit on the latest MAMP (and possibly other recent versions), Nik's install instructions don't seem to work, at least they didn't for me. I think it's because MAMP has it's own [already installed] copy of Pear separate from OS X's copy. The very last entry on this page at Stack Exchange worked for me. It's the one answered Oct 9 '12 by Allen Hurff. Failed asserting that actual size "two words" matches expected size "one word".
-
Thanks Nik, this is fantastic! I'm already using and benefitting from it here. Just fixed two PW bugs, as you posted on the GitHub issues report. It's so nice to be able to run this to locate bugs and inconsistencies, and even better to run again after fixing them (to make sure some new problem wasn't introduced). Thanks again for your great work on this.
-
Take a look at this old thread too--might be similar to what you are trying to do: http://processwire.com/talk/topic/28-having-multiple-databases-hacking-pw2-to-work-on-two-different-servers/
- 7 replies
-
- multi-domain
- multisite
-
(and 3 more)
Tagged with:
-
Autocomplete and Other Search Enhancements
ryan replied to Michael Murphy's topic in Getting Started
It doesn't look to me like you are sending your query (q variable) through the ajax request? I'm guessing the code above would just retrieve the URL /busqueda/ with no query. -
I agree it would be nice, but I don't see a simple solution to this one. The code that's tracking the changes doesn't know anything about multi language fields.
-
What do you think--better to leave out the jQuery UI datepicker translations to avoid this issue, or is it worth the compromise?
-
I honestly haven't tried it yet. But if for some reason it doesn't work, I'm sure I'll be able to make it work pretty easily.
-
At present, tabs aren't designed for inline use like this. The jQueryWireTabs module is largely in JS and I'm sure it's possible. But would probably require a major rewrite of the module to support that need.
-
This one is kind of hidden in the docs, but should provide more answers too.
- 7 replies
-
- multi-domain
- multisite
-
(and 3 more)
Tagged with:
-
See the blog profile which demonstrates a tag system.