-
Posts
3,263 -
Joined
-
Last visited
-
Days Won
112
Everything posted by teppo
-
@Pete: any chance that solved-button could be added to "New content" view also? Just noticed that it doesn't show up there -- which would be pretty sweet, considering that it's pretty much the only view some of us (well, at least me..) ever use
-
Textformatter for Google Maps https://github.com/teppokoivula/TextformatterGoogleMaps This module looks for Google Maps URLs (such as https://maps.google.fi/maps?safe=off&ie=UTF-8&q=disneyland,+paris) within paragraph (<p></p>) HTML tags and automatically converts them to embedded maps. Configurable options include embed type ("static" or "iframe"), API key, responsive embedding and Google Maps for Business settings. Other than that, it's pretty basic stuff. Original regexp for grabbing maps links was posted by Ryan (I believe) here on the forums, but I couldn't find that post anymore. I've altered it to better suit the needs of this module, added some configurable features (part of which, such as makeResponsive() method, are again based on Ryan's TextformatterVideoEmbed module) and so on. Hope someone finds it useful. (By the way: if you're going to use Google Maps for Business settings, please read the notes there carefully. Google doesn't exactly recommend storing your private key the way module settings are stored..)
-
I'm sure you already know this, but still: Location can't be reliably identified based on IP alone. Even if you use a very large list of IP's connected to location data that some sites distribute, you'd still have to take into account various proxy services, possible human error etc. Essentially this kind of feature is OK for offering extra value for some users, but it's definitely not a good idea to rely on it alone to provide any security-related features. Just saying. But to get to your questions.. If you're going to have a lot of IP ranges (and you'll probably have if your list is even half comprehensive) this might be a very good idea. As a matter of fact, since you mentioned it here, I've started thinking that perhaps I should include something similar to the original module itself.. can't give an ETA for that yet though, and it might not even be of benefit in your case This is a tricky question. First of all, I'd suggest looking into Markup Cache -- it'll allow you to cache parts of your page, even if whole pages can't be easily cached. That's probably the easiest method here. Other option would be caching two versions, like you've pointed above, but as far as I know that's not really an option available out-of-the-box. Template Cache allows you to cache URL segments, so you might be able to work around this problem using that for an example. Could get very complicated very fast though. With commercial Pro Cache module you can bypass the cache when certain cookie is set.. though it might be difficult to set that cookie if pages keep getting served from cache. That could be an option if you're relying on some pages not being cached, ie. users always entering via root page which won't be cached at all. Doesn't sound like a good idea, but I don't really know your whole setup, requirements and plan here either, just throwing in ideas Edit: as a matter of fact, you could probably also use modified Page Render IP Restriction to set $session->PageRenderNoCache and that way skip Template Cache for either local or non-local users, even without relying on Pro Cache module. Page Render IP Restriction runs before Template Cache can work it's magic, so this should be possible. Obvious downside here would be that part of your audience won't benefit from caching at all.
-
Not sure what you mean with these .json and .zip files, but I'm guessing you're saying that they weren't there in some language pack you've downloaded? Not all language packs contain all files -- there may be more translatable phrases now than there were when the language pack was created etc. so you'll have to either translate these manually or post a heads-up about these to the maintainer of that particular language pack. Anyway, if you want to translate this file manually then just follow these steps: Log in, go to Setup > Languages and select target language At the bottom of "Language translation files" follow the "translate new file" link Type whole path (\wire\modules\Inputfield\InputfieldPage\InputfieldPage.module) in the "File to translate" input Translation page should open -- now you'll just have to translate phrases manually and save If I'm understanding something wrong here, please provide some extra information about what you're exactly trying to do.
-
@Ovi: did you try what I've suggested above, ie. hooking into "CommentFormWithRatings::processRatingInput"? That actually worked for me (at least to the point that a die() statement placed in copyAverageRating() was getting executed), so I'm pretty sure it should work for you too Any chance that your method is getting executed but it doesn't work properly? Try doing something very obvious (like a die("foo")) in your copyAverageRating() and see if that gets executed. Whether it does or doesn't, you'll have narrowed the problem quite a bit already. Another thing you could try is doing something similar in init() method of your module. Try putting a die() statement there; if your page still gets rendered, whole module isn't getting executed properly. (You've omitted module settings, but just to make sure: that module is set as "autoload", right?)
-
Best practice for escaping the ampersand '&' in fields
teppo replied to landitus's topic in General Support
TinyMCE escapes ampersands automatically, so there's no reason to worry there. They're always stored in their escaped format, "&". Plain textareas store ampersands as-is ("&"), but "HTML Entity Encoder" textformatter automatically escapes them run-time, when you're echoing field content. Ampersands printing as "&" to browser sounds like you're doing escaping twice; any chance that you're escaping content again when printing it, in your template files? Is this consistent, ie. are all ampersands printing out as "&" -- or just some of them? If you're certain that you're not escaping content twice, you might have some broken data in your database. I'd check how those ampersands that print out as "&" are actually stored in the data field of corresponding field_[your-field] table. -
Session Login Throttle itself doesn't have hookable functions for this, as you can see from it's code. You could hook into login() method of Session, though, but even then only thing you'd be able to check is whether allowLogin($name) returns "true" or "false". There's no way to say why this happens, ie. whether it was caused by Session Login Throttle, just that this particular user isn't allowed to login right now. Session Login Throttle allowLogin() is the method you'd need to work with here, but that being non-hookable and private makes things a bit complicated.. Only way to achieve this at the moment, as far as I can see, is by a custom module hooking before login() method of Session and checking if local allowLogin() method returns "true" or "false".. and based on that either saving that value somewhere so you can use it in your form, redirecting user to another location (error page) or directly outputting an error message.
-
Try adding quotes and hooking into CommentFormWithRatings: $this->addHookAfter("CommentFormWithRatings::processRatingInput", $this, 'copyAverageRating'); Edit: speed bonus goes to Soma.
-
how to make it work subdomain with PW installed on root
teppo replied to fmgujju's topic in General Support
@totoff is probably right and his answer makes a lot of sense in this context. Just wanted to add one slight clarification (I hope..) from my point of view: Generally speaking it would be a very bad idea to have directory containing a subdomain inside directory containing main domain -- if we're really talking about subdomains (webapp.mydomain.com) and not directories under main domain (mydomain.com/webapp/) here, that is. That kind of setup will only result in logical (ie. what happens when you navigate to mydomain.com/webapp/) and practical (ie. running ProcessWire inside ProcessWire) problems. A subdomain doesn't have to have anything in common with your main domain (it's another domain after all) and it's definitely nothing like a sub directory, which is your current setup seems pretty messed up to me. If possible, something like this would seem better option: /www/mydomain.com/ /www/webapp.mydomain.com/ .. or perhaps this, which is what one webhost I'm using does (though I've no idea why): /mydomain.com/www/ /webapp.mydomain.com/www/ -
@joshuag: https://github.com/ryancramerdesign/ProcessWire-2.0.
-
@dragan: any chance you could post a link to one or more of these (original) images, if they're already online? That could make finding the problem a bit easier.
-
@roelof: you might also want to check out this thread: http://processwire.com/talk/topic/3714-how-to-do-this/. Unless I'm misinterpreting something here it's essentially the same question. By the way: when starting new discussions, you really should try to include something about your question in the thread name itself. It's difficult to find related discussions when they're named like "How to do this", "How can I do this" etc. Just another friendly forum tip..
-
@benbyf: regarding the nav issue @totoff mentioned you're giving "#topnav a" margin-right of 2% (0 2% 0 0.) This seems to screw with box model on at least Chrome. Could probably be fixed by giving it width of 100% (instead of "auto") -- though I'm not sure how that would affect all the other views.. Also: some things could use a bit of tuning on smaller screens (.latest-box elements could be full width, social media icons overlap top nav at one point etc.) Nothing dramatic though. The site itself looks great -- I'm really digging it's design!
-
Try $page->boardbasis->name or $page->boardbasis->title if only one selection can be made at time. If multiple pages can be selected, you'll have to foreach through $page->boardbasis (which'll be PageArray in that case) or do something like $page->boardbasis->eq(0)->title. When echoing out $page->boardbasis, selected page is returned and rendered as numeric ID.
-
@apeisa: I'm trying to use this on a PW 2.3 site and everything seems to work from administration point of view, but so far all I'm getting is this error message when I try to echo $page->my_poll (my_poll being the name of the field) on frontend: Any idea what could be causing this? I'll probably try to debug it properly later, but not being exactly familiar with fieldtypes / inputfields doesn't really help here.. Edit: reinstalling FieldtypePoll and InputfieldPoll fixed the problem. There was something strange with the install process originally (autoinstall didn't work for InputfieldPoll, installing FieldtypePoll before AngularJS caused errors etc.) so this should've been pretty obvious solution. Anyway, problem solved and everything seems to work now, sorry for the confusion PS. Have you considered adding this to the modules directory? Seems like a nice addition there.
-
There are valid use cases for template engines, but generally speaking templating with PHP is at least as simple and fast and at the same time imposes absolutely no limits on your creativity (especially with PW's fantastic API in your toolbox.) You'll love it once you get used to it That said, we also have modules for both Twig and Smarty template engines available, if you really want to use one of those: http://modules.processwire.com/modules/template-twig/ http://modules.processwire.com/modules/smarty-templating/ I haven't personally tried these (and most likely won't, if not purely out of curiosity) so I can't really vouch for either one, but as far as I can tell they both seem to be relatively stable.
-
Internet Trends 2013: nothing too surprising, but still a good read. Mobile and tablet device usage growing fast. http://t.co/MlRTkERcBq
-
Nominations for Critics Choice CMS Awards are open -- support your favorite #CMS at http://t.co/YcMJWYCs75 #ProcessWire
-
Status flag 1024 means that a page is hidden. That (<1024) asks for pages not hidden (ie. status smaller than 1024.) See https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Page.php#L58 for details.
-
Another file could be a resized version, possibly for admin use (if you've turned on thumbnails in admin for that field.) Naming is a bit off, though -- that "-1" shouldn't imho be there. Someone correct me if I'm wrong, please. Anyway, you're not using IE10, are you? If you are, this could be somehow related to issue #195.
-
Sounds like your site_header_banner field allows more than one image. That's probably why it's returning directory path instead of image URL -- it doesn't know which image you want to output. Try altering that field to only allow one image (via field settings) or try doing this instead to get URL for first image in that field: <img src="<?php echo $pages->get("/site-settings/")->site_header_banner->eq(0)->url ?>">
-
Another minor addition to happy family of ProcessWire modules: Markup Load Atom. Markup Load Atom was forked from Ryan's Markup Load RSS to provide similar functionality for Atom feeds: given Atom feed URL it loads it and allows you to foreach through it and/or render it with built-in render() method. Get it from GitHub: https://github.com/teppokoivula/MarkupLoadAtom Note: I've been using this on a production site for a while now, but haven't really worked much with Atom feeds specifically. If you're a guru in that matter and feel that something is odd or plain wrong here, please let me know and I'll see what I can do. How to use With your own markup: $atom = $modules->get("MarkupLoadAtom"); $atom->load("https://github.com/ryancramerdesign/ProcessWire/commits/master.atom"); foreach($atom as $item) { echo "<p>"; echo "<a href='{$item->url}'>{$item->title}</a> "; echo $item->date . "<br /> "; echo $item->body; echo "</p>"; } Or with built-in rendering: $atom = $modules->get("MarkupLoadAtom"); echo $atom->render("https://github.com/ryancramerdesign/ProcessWire/commits/master.atom"); Installation Installing is identical to most other modules; just copy MarkupLoadAtom.module or whole MarkupLoadAtom directory to your /site/modules/, hit "Check for new modules" at Admin modules area and install "Markup Load Atom". More examples, detailed instructions etc. can be found from README.
-
Minor glitch (if you can even call it that): your 404 page is a bit unhelpful. Had an old link to /de/, which ended up serving a blank page and confusing the heck out of poor little me. Site itself is just fabulous
-
@Wanze: are you sure about that? Taking a look at get method in Page.php (which, in turn, is called by magic method __get): public function get($key) { $value = null; switch($key) { ... case 'next': ... $value = $this->{$key}(); break; ... Sorry for all the dots there, but anyway: as far as I can see, actually next equals next() unless PW has already "cached" it's return value as a property, which shouldn't be the case here. And I don't see why above warnings wouldn't apply here either