Jump to content

teppo

PW-Moderators
  • Posts

    3,208
  • Joined

  • Last visited

  • Days Won

    107

Everything posted by teppo

  1. @benbyf, are you getting any Javascript errors in your browsers developer tools console? What about Apache + PW error logs? Seems like something isn't loading / running properly, so that's where I'd start digging into this one. Also: you seem to be running quite an old version of ProcessWire; sadly I'm not very familiar with the 2.0 release and differences it has with 2.1 or 2.2, but just to make sure, you did the re-install with version 2.0 too and not a later version?
  2. @celfred, you've got two problems in that example: YouTube links need to be alone in their own paragraphs, there shouldn't be any other content in same <p> tag -- try adding the descriptions below or above actual YT links (also: now they're in a list, which probably won't work either) Don't make them actual hyperlinks; I might remember wrong, but IMHO that way they won't work -- just plain URL as a string without the <a> tag I hope this helps a bit.
  3. @Sevarf2: Repeaters most likely aren't what you'd like to use here. You might consider using either simple module + custom data table (Antti has a nice example of this in his Process Redirects module) or perhaps even custom field in user template (if this data is actually linked to ProcessWire users) populated with JSON -- it may sound like an odd choice but I've used it for certain simple needs and it's actually quite efficient and very simple to handle with json_encode + json_decode
  4. Hello there, First of all, letting a client post HTML straight into a field and then echoing it (especially without escaping anything) could potentially break things up and cause quite a bit of confusion / extra work for you, so I wouldn't really suggest it. IMHO better option would be to ask the client to post WordPress embed tag offered by SoundCloud to the body field (or any other field you've specified, actually) and then replace that with actually player code at your template. WordPress embed tags look like this: [soundcloud url="http://api.soundcloud.com/tracks/59233018" iframe="true" /] Simply ask your client to post these tags to whatever field you've specified, each as it's own paragraph (just paste and hit enter when field has TinyMCE enabled.) Then include this code in your template (I'm using body field as an example here): <?php $replacement = '<iframe width="100%" height="166" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F$1&show_artwork=true"></iframe>'; $page->body = preg_replace("#<p>[^\w]*\[soundcloud url=\"http:\/\/api.soundcloud.com\/tracks\/([0-9]+)?\"[\w\=\" ]* \/\]</p>#i", $replacement, $page->body); That should do the trick. EDIT: once again I've been too slow.. damnit. Oh well, now there's twice the regexp fun to check out. EDIT 2: @danielholanda, even though both answers so far have certain similarities (regexp ftw), there's actually one important difference just in case you've missed it: the method diogo provided is based on adding a specific field for songs. This way if you want multiple songs on one page you could add that field inside a repeater and loop through it's content. The method I posted above is based on the assumption that you could be using that same field for both "typical" content and (multiple) SoundCloud embeds. I'm adding this just to clarify both methods a bit and make it easier to choose which method you're going to use. This really depends on how your client will manage this content too; especially if each SoundCloud clip has it's own page there's very little point for using the latter method.
  5. SiNNuT: what I was talking about back there was probably more like HTML prototyping than just plain wireframing, though in my humble opinion HTML prototypes are rather straightforward evolutionary step of HTML wireframes -- or "HTML wireframes on steroids." Basics and reasoning behind these kind of techniques are discussed (for an example) in this Webdesigner Depot article, this Handcrafted post about how 37signals work on their designs and in this rather old but still valid blog post by 37signals about why they like to "skip Photoshop." I'm still hoping more people in our industry would take these techniques even further though. What I'm currently most interested in (and experimenting with) is taking HTML wireframes to what I see as "the next level" by adding not only bones (wireframes / structure) but also as much meat (functionality) as possible before drawing / having someone else draw the skin (graphics) on top of it all. Yeah, I really suck at metaphors. Sorry for that. I'm actually working on a project right now that I'd love to see as close to being completed as possible before adding any distracting eye candy, though that's definitely not an easy task to achieve; lots of people still claim (I say claim because I'm not very satisfied with this answer) that they cannot really "get" the whole thing without seeing layouts. In my opinion keeping things as bare and clean as possible forces everyone to concentrate on what really matters: usability and user experience. Long story short: what you're doing is probably very close to what I'm talking about here and I'm happy to hear that you've already implemented a method like this. I'm not a big fan of front-end frameworks myself and definitely not an expert on that subject, but if I've understood properly how they work (and why they exist in the first place) this is exactly what they're good at
  6. We used FlairBuilder a few years ago, but it always felt too complicated -- to the point where creating and/or modifying wireframes with Photoshop was actually faster (not a good situation IMHO, isn't this one of the things wireframing apps are supposed to help with?) The good thing about it was it's ability to handle interactions, but that's just about it. Unless they've made massive improvements I really wouldn't recommend going that way. These days we're mostly using Balsamiq. Since the first time I gave it a try, it's been an inseparable part of my toolbox whenever I'm designing a new UI. Compared to more complicated tools like FlairBuilder, it's strong point is definitely ability to create high quality mock-ups super fast (not to mention that learning to use it takes about five minutes.) Highly recommended! Slightly offtopic: HTML wireframing is a very nice technique to learn. I'd suggest using this method as often as possible, especially if you're going to design / develop applications and/or application-like sites etc. or generally any solution where UX is more important than (too often completely redundant) graphics. With interactive (HTML or not, though creating markup or even code at this point quite often makes things easier later on) wireframes you're not going to need much guesswork, since you can simply implement things and test -- or better yet have someone else test it for you..
  7. ✌ Reading "The Monty Python guide to user experience design" http://t.co/yGWvU0OM

  8. This is probably the most stylish construction company website I've ever seen -- not that I'd seen that many of them but I hope you get my point anyway. Awesome work!
  9. Ryan, I've just tested this and the new arrayToCSV toggle does exactly what I had in mind and works like a charm!
  10. I guess it would be possible to avoid this problem by adding some kind of a preprocessor for certain predefined attributes; convert their values into arrays with explode if they originally were strings with certain characters in them. That's kind of ugly though, so I'll have to think about this a bit. Part of the problem, it seems, was self-made; my module whitelisted vars after they had gone through rather strict filtering and this is where "|" characters came from. Anyway, that didn't fix the underlying problem, which is that MarkupPagerNav can't handle input arrays properly. The problem seems to be caused by this part of setGetVars method of MarkupPagerNav.module: foreach($this->options['getVars'] as $key => $value) { if(is_array($value)) { $a = $value; $value = ''; foreach($a as $k => $v) $value .= "$v,"; $value = rtrim($value, ", "); } ... If an array is passed as a GET var to MarkupPagerNav, it's automatically converted to one string separated by commas. This might be considered intended behavior, but it's still effectively making the use of GET arrays with MarkupPagerNav more difficult than it should be. Personally I'd prefer to keep them as they were (with urlencode included, naturally) -- or perhaps add a toggle of some sort for this. What do you think? Edit: just to clarify what I'm actually talking about here these are the changes I've made to my local MarkupPagerNav.module: --- modules/Markup/MarkupPagerNav/MarkupPagerNav.module (revision ...) +++ modules/Markup/MarkupPagerNav/MarkupPagerNav.module (working copy) @@ -224,14 +224,12 @@ $queryString = "?"; foreach($this->options['getVars'] as $key => $value) { if(is_array($value)) { - $a = $value; - $value = ''; - foreach($a as $k => $v) $value .= "$v,"; - $value = rtrim($value, ", "); + foreach($value as $k => $v) $queryString .= "$key%5B%5D=" . urlencode($v) . "&"; + } else { + // $queryString .= "$key=" . urlencode(htmlspecialchars($value)) . "&"; + $queryString .= "$key=" . urlencode($value) . "&"; } - // $queryString .= "$key=" . urlencode(htmlspecialchars($value)) . "&"; - $queryString .= "$key=" . urlencode($value) . "&"; } $this->queryString = htmlspecialchars(rtrim($queryString, "?&")); }
  11. The solution mentioned above actually helped shave seconds off some relatively complex queries. Still not fast enough, though, so I ended up using pagination anyway -- not how I'd like this to work, but I guess I can cope with that after all Now I'm facing a new kind of problem though: multi-value get-parameters (param[]=x&param[]=y) don't seem to work properly with renderPager(). For an example this URL: /processwire/custom-search/?print%5B%5D=brand_name&print%5B%5D=street_address&print%5B%5D=business_id ... is converted to this within pager links: /processwire/custom-search/page2?print=brand_name%7Cstreet_address%7Cbusiness_id Any ideas how to fix this, or should I just generate my own pager markup?
  12. Thanks, Ryan -- this is actually exactly what I had in mind, though I didn't think it'd actually work. Going to give that a try now. I did consider using FieldtypeCache too, but since (unless I'm mistaking something here) it would require me to cache all the fields used by this template I rejected that solution. Sad thing here is that omitting pagination / limit is intentional. This module I'm talking about produces a print-friendly view to page data and thus pagination / limits are unwelcome. Also: I'm trying not to look too much into query counter, but when there are 5000+ queries in a relatively simple situation, I'm afraid it does become a factor. Dealing with quite a lot of data here.
  13. I'm developing a module that lets user specify which fields she wants to show in the result list (which is intended for print use, but that's not very relevant here.) My problem is that when multiple fields are selected SQL queries tend to pile up which results in sluggish page load times. Currently matching pages (selector is also generated based on user input, but that's another story) are loaded with $pages->find() and then looped through with foreach and rest of the fields (which, as I mentioned above, are actually chosen by user) are fetched individually. This is where things get really slow, especially if user has specified 10+ fields to show One solution I've used to make things a bit faster is that most commonly used fields have autojoin setting on and thus PW doesn't require another query to fetch their content. Problem with this is that same data is used elsewhere in simple list views, which get way more hits than my little module here does and if I make all the fields autojoin it would seriously cripple those other views and in the long run possibly suffocate whole server.. Long story short, what I'm looking for is a way to turn on autojoin for certain fields on the fly before fetching pages OR mimic similar feature some other way. Any ideas how to achieve something like this are more than welcome - and don't hesitate to tell me that I'm doing it all wrong, if you know a better way to achieve same results..
  14. Interesting. I used Google couple of times via phone from Copenhagen and now my Google account has Danish as it's default language..?

  15. teppo

    RoR

    I've always been fascinated by Ruby and wanted to learn more of it. As a language it's super clean and contains many little "tricks" you can use to write really beautiful code. On the other hand, I've always been held back by the fact that even though Ruby might be pretty, it's not particularly powerful / efficient and definitely not nearly as well supported and widely adopted as PHP. When using Ruby to build web-based applications the only available (and viable) solution seems to be Rails. Someone correct me if I'm wrong -- other solutions do exist but generally speaking they don't seem mature enough to use outside small / personal projects. Meanwhile with PHP there are quite literally hundreds of viable platform choices. Anyway, widening your toolbox with things like Ruby/RoR sounds like a great idea, but I sure hope your employer doesn't force you to use RoR for projects it doesn't really fit just because it's "hip" ('cause that'd be a real shame )
  16. teppo

    velokurier.com

    Actually same problem @apeisa mentioned happened to me too. Thought it was just a one-time quirk, so I didn't mention it before. Seems that when page is loaded for first time (when animation / it's components aren't cached yet) the animation won't show up at all.
  17. @apeisa: yeah, well, MediaWiki takes some getting used to.. once you "get it" you'll realize that it's super powerful (but still rather confusing at times.) Wikipedia is actually using a newer, cleaner and much easier text editor these days. It has most of the basic formatting you'll need (such as different headings, lists, refs, tables and blockquotes etc.) implemented in an easy-to-understand way. Might be worth taking a look at, perhaps we could have that one too. Edit: the text editor that Wikipedia currently uses can be found from here: http://www.mediawiki.org/wiki/Extension:WikiEditor.
  18. @Gazley, to answer your original question: I don't think that there are too many proper tutorials on module development available. At least I haven't seen any, so please, someone correct me if I'm wrong There has been some talk about proper module development documentation and/or tutorial though, see this topic for an instance. In my humble opinion that's something the community definitely needs at some point, preferably rather soon, because (IMHO) asking the same questions over and over or trying to dig all the tips from dozens, hundreds or even thousands of posts is not very efficient in the long run. Of course many of us like to learn from examples, but I'd still prefer to have common guidelines, frequent questions / problems, basic components and things like that explained in one place -- this would make it much easier for new folks to get into PW module development. Anyway, once you've managed to grasp basics of module development, why don't you share your tips for others too? wiki.processwire.com would be a great place for such content.
  19. teppo

    velokurier.com

    I don't want to sound too strange, but I've been watching that header animation for almost ten minutes now. With inspect tools opened. Drooling a bit. Absolutely brilliant stuff! Oh, and the rest of the site is very nice too
  20. "Argument 1 passed to [...] must be an instance of string, string given." Uhm.. right.

  21. Highest page count I've seen on a production site so far is 30k+ and that site runs just fine. All things considered I wouldn't be too worried -- PW is surprisingly resilient There's an earlier thread with almost the same question that you really should read; in his reply Ryan explains some of the things you need to consider when building a (very) large site: http://processwire.com/talk/topic/1527-largest-project-performance-multi-server/#entry13779. That performance issue Soma mentioned is discussed further here: http://processwire.com/talk/topic/1508-performance-problem-possibly-a-bug-in-pages-class/ (and yes, related problem / bottleneck has already been fixed.)
  22. Should've known it: only editor you'll ever need my editor of choice already has solid support for SASS / SCSS: http://www.emacswiki.../emacs/ScssMode. Another reason to give it a try. That's actually exactly what I was talking about earlier. I can't help feeling that stylesheets should be as simple and "dumb" as possible to serve their original purpose, which IMHO is to provide separation of concerns; HTML for structure, CSS for style (presentation) and server-side scripts / programming (PHP, Perl, Ruby / Rails etc.) + Javascript / ECMAScript for logic. All these features being added by SASS, LESS and even vanilla CSS3 (transitions, transformations, animation, media queries, variables..) are -- no matter how useful they may be -- constantly taking it further down the road to becoming less (no pun intended) of a presentation / styling language and more of a "lightweight programming language" -- and that's definitely not something I'm happy about.
  23. First of all, 0x100 version is a thumbnail created by either size(), width() or height() calls in your templates or possibly by admin (if you've chosen to show thumbnails for that image field.) Secondly, I'm assuming that your image field is called "images" and it can contain multiple images? It sounds like you're asking the field itself for an URL when you should be asking that from an individual image: echo $repeater->images->eq(0)->url; Or you could loop through all the images: foreach ($repeater->images as $image) { echo $image->url . "<br />"; } Edit: Soma was faster -- again
  24. @yellowled: thanks for your patience and explanations. You have definitely persuaded me to at least give SASS a fair chance. Not saying that I'm still completely convinced, we'll just have to see how well that goes. @apeisa: you're saying some things that I find a bit worrying (I love organized content and that concerns stylesheets too.. which is probably one of the reasons why SASS / LESS sound so tempting to me) but for the most part I believe that I share your view here. New features must prove their value before going into production, so to speak. Bad metaphor, but I hope you get my point
×
×
  • Create New...