Jump to content

teppo

PW-Moderators
  • Posts

    3,259
  • Joined

  • Last visited

  • Days Won

    112

Everything posted by teppo

  1. Already a bunch of good resources, but here's a couple more: Especially if you're at "absolutely beginner" level, there's a ton of useful video tutorials floating around. This one titled "Learn PHP in 15 minutes", for an example, seems pretty good. For more background there are also more thorough videos, such as this Harvard extension school lecture. Once you get up to speed, you should most definitely take a look at PHP: The Right Way. If you're really into it, I'd strongly suggest Programming PHP from O'Reilly. It's available as an ebook too. Another book worth checking out is Essential PHP Security. Short but good -- if every PHP developer knew at least this much about security best practices, PHP world would be a lot safer place. Just my two cents. Totally random fact: Designing Web Graphics by Lynda Weinman was one of the very first web design books I could get my hands on. That was some fifteen years ago, when quality learning material was still kind of scarce, at least around here. Should probably take another look at that book one of these days, could be sort of fun
  2. RT @HeyyThereDalia: So Nyan Cat and LulzSec are in my sociology textbook http://t.co/KQLrIP0ccZ

  3. $pages->find(..) returns PageArray, not regular array, hence the issue with array_merge(). Also there's no need for array_unique() (should it work), PW handles this already by grouping results by page ID's. Apart from that, I believe that DaveP is right; you'll have to do separate queries and merge results: $ps = $pages->find("customer=$page->customer"); $ps->add($pages->find("service=$page->service")); $ps->add($pages->find("business=$page->business")); // etc. One problem with this approach is that, depending on your situation, you might not be able to use limits and built-in pager functions to full extent. Anyway, hope this helps a bit.
  4. Take a look at mb_substr() for setting character limit. For word limiter you can use something like this: http://snipplr.com/view/12987/limit-words-in-a-string/. // basic mb_substr example $value = $page->my_field; if (mb_strlen($value) > 255) { echo mb_substr($value, 0, 255) . "..."; } else { echo $value; }
  5. “Submit your poster in PowerPoint format”. Whoever wrote that must hate Mac users. Two hours well spent. http://t.co/m7asD0KzI6

  6. RT @codepo8: Web apps that talk - Introduction to the Speech Synthesis API - http://t.co/8Ti42qpIgA

  7. RT @lukew: "You understand a product if you understand how it’s made." -Jonathan Ive

  8. RT @UCDNewsletter: Accessibility Features of HTML5 With Mark Sadecki, W3C / Web Accessibility Initiative http://t.co/Fn7fOPlewM

  9. RT @johnmaeda: Steve Jobs on the disease of believing that 90% of the work is having a great idea … via @cdixon http://t.co/4yT1EJlmrx

  10. @WillyC is right; the problem is most likely that you're calling renderDirectorProfile() .. a) for user that doesn't exist or b) for user that exists but doesn't have any images available. Adding proper checks for $user->id and count($user->images) / $user->images->count() before trying to output content is strongly recommended: function renderDirectorProfile($person) { if ($person) { $director = wire('users')->get("name=$person"); } if ($person && $director->id) { $o = "\n<div class='member span4'>"; if (count($director->images)) { $directorsImage = $director->images->first(); $o .= "\n\t<img src='{$directorsImage->size(369, 369)->url}' alt='$director->fullname' />"; } $o .= "\n\t<h2>$director->fullname</h2>" . "\n\t<span='position'>$director->position</span>" . "\n\t$director->body" . "\n</div>"; } else { $o = "<p>Couldn't find director.</p>"; } return $o; }
  11. You can definitely use size() in functions. If you take a closer look at the error you're getting, it's not saying that you can't use size(), but that you can't use size() "on a non-object", meaning in essence that $image (or whatever you're calling the size() method on) isn't defined or isn't valid object (it should be an instance of PageImage in your case). Without seeing your code this is just a guess, but it would seem that this is a scope issue, i.e. you're fetching the $image outside function and then trying to use it inside or something like that. Since $users->get() shouldn't work within function context at all (you should use wire('users')->get.. there) I'm wondering what exactly you mean by "equivalent" solution here
  12. I'm not entirely sure that I get your whole setup, but just a small pointer: The error you're seeing most likely comes from FieldtypePage and means that Page with ID "ID#" (from your error message) is not a valid value for "Field-Name". First thing I'd do here is check the settings of this field ("Field-Name") to see why this page isn't valid for it. Hope this helps a bit.
  13. "Verkkopalvelun ostajan opas" 17.70€ from @TalentumKirjat. Would prefer ebook, but that costs additional 40€. Right..

  14. @etling: that's right, include the domains you'll want to use this site with there and things should work just fine. @bwakad: sorry, I'm not really sure what you're saying there, but whatever domains your site uses need to be included in httpHosts config setting. It's that simple.
  15. You'll want to make sure that your Apache user has read, write and execute permissions to assets and it's subfolders. Other directories you rarely need to worry about. Setting permission 777 to whole assets directory recursively (chmod -R 777 site/assets/) is more than enough. You could be more specific and only allow it to only write into assets/files/, assets/cache/, assets/logs/ and assets/sessions/, but then there are modules that write directly to assets folder and would fail after this. Bad Gateway 502 as a result of this sounds like some strange server setting -- I've seen shared hosts throw errors if a file is executable/writable by all users (security feature attempting to mitigate risks usually caused by shared hosting itself, kind of ridiculous really), so this could possibly be something like that. In those cases you'll need to configure permissions properly: only give write and execute permissions to the user Apache is running as (often that would be your own user account). The host most likely explains this stuff somewhere. Apart from that I've no idea what could be causing that.
  16. I'm guessing that you're already familiar with it, but the Multisite module Antti wrote does awesome job when you want tightly connected sites. If that's too much, custom interfaces (or pages web service, as you already mentioned) make it possible to design exactly the type of coupling you need. Just saying; your idea sounds great, though not sure if this would make that much sense as a core addition, considering that it's pretty specific need you have there and all the building blocks are already available, so to speak
  17. You should be able to do this with sanitizeValue(). My experience with fieldtypes is very scarce, but AFAIK that's what this method is for Edit: unless you're already using it as a base for your own fileldtype, take a look at how sanitizeValue() of FieldtypeEvents works. That pretty much explains it, I think. If you don't like the value, throw exception. I'm not entirely sure if it's possible to entirely disable setting value via API though, if that's what you're after -- i.e. giving $page->yourfield a value that's an instance of the object it expects -- without disabling page edits etc. too.
  18. Actually what DaveP suggested would make a lot of sense as an addition to default ProcessWire .htaccess. Commented out by default, like it is in HTML5 Boilerplate, probably. I did not know that proxies dislike query strings, but that does make sense -- and I'm unlikely to be the only one caught out by this.. Taking things a bit further, options for enabling / disabling / configuring certain .htaccess settings easily during install phase could result in some very interesting possibilities. That's probably way out of scope for this particular discussion, though
  19. It would be awesome if we could simply notify authors and they would update their content, but I'm also a bit skeptical if that would work, how many would react in given timeframe.. and how many modules we might end up losing in the process. Don't know if that's really worth the risk. For the paranoid types (like me) seeing what license a module is under is very important, especially if I'm planning to use it in work projects and not just for fun, but in all honesty most authors probably won't be going after users of their modules with legal claims anyway I don't really know what would be the best solution here and Ryan would probably be the right person to make that decision. In any case adding a way to define this info in the modules directory and sending an email like you mentioned would definitely be a good start. Using a license usually means including license text somewhere and/or mentioning in your source code what license it's under. GNU licenses (GPL, LGPL) are only ones I know to especially state that you should include full license text in every source code file you've got under that license. That's a bit over-the-top, to say the least, and most authors simply skip that part. For my own projects I've included LICENSE file within the repository and added PHPDoc @license tag (linking to text format license) to all PHP files -- that should at least make my intentions clear.
  20. From legal perspective you can't really assume that, especially since we have already established that ProcessWire modules aren't automatically under same license as ProcessWire itself. There was a rather lengthy discussion about this here. Can't have it both ways, I'm afraid. Code that doesn't specify a license is simply protected by copyright law, meaning in essence that you can't use it legally without the authors consent. I'm no expert in (especially international) copyright law, so please don't take my word for it, though. Luckily more trustworthy sources, such as GitHub, have written tons of good articles about this
  21. Small(ish) request related to modules directory: could we get a field for selecting license used by the module? At the moment it's often very unclear what's the licensing policy for an individual module. I'm hoping that this would -- in addition to making this information more obvious when browsing modules -- also give module authors a slight (and much needed, I'm afraid) nudge towards actually defining which license the module is distributed under. A simple text field would be enough for the time being, but a list of possible / most common licenses like GitHub has implemented would, of course, be even better.
  22. RT @codepo8: Wow, Immortal Technique is a rapper who gives sensible interviews and knows his stuff: https://t.co/SQXEh57XN3

  23. Pages are the preferred way to do this and 30 pages is absolutely not a problem. You'll run into usability issues with select field itself much sooner than any kind of problem related to number of pages behind the scenes..
  24. On a more serious note, the sequel to “If Google Was a Guy” really nails it: https://t.co/IHRz4Mc5FJ

×
×
  • Create New...