Jump to content

thijs

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by thijs

  1. Ok, this works: {% for sibling in page.siblings('id!=' ~ page.id) %}
  2. Awesome module, much thanks for that. One question though, how would one accomplish the following in twig? (I’m trying to exclude the current page from it’s array of siblings) Vanilla PHP: foreach($page->siblings('id!='.$page->id){ This is my twig code: {% for sibling in page.siblings('id!=page.id') %} I understand that page.id will not be rendered as the page it’s id, since it’s a string etc. But what is the proper way to accomplish this? I’d need to do some string concatenation within the selector there. I know I can create a dataprovider to provide a proper wirearray with actual siblings, but it seems a bit overkill. Thanks in advance!
  3. Well, there was an error in my template code. That’s resolved now, but the behaviour still occurs, yet it is not consistent, sometimes it throws 404s, sometimes it just doesnt. I’m considering implementing my own published/unpublished mechanism (simple checkbox) to work around this, as it’s quite inconvenient...
  4. Think I figured out the cause; with debug mode on I figured out that PHP was throwing an error somewhere. But not sure how this lead to the actual 404.
  5. The production server has got suhosin installed (read something on this in a vaguely related thread). May be something server side..
  6. Hey, thanks for your reply. The template is public (guests can view it). The template permissions are set as follows: Publishing pages and then unpublishing them (from the cms, not the API) sometimes seems to do the trick. But it’s hard to pin it down. Thanks for your input though, I’ll give it another go. And is there a way to debug the process that happens before the actual 404 is thrown? May shed some light on the issue
  7. Hi all, I’ve been experiencing quite a mysterious issue; I’m running PW 2.4, and the following occurs; the client is not able to view unpublished pages but get’s a 404 served instead. It’s not a role/permission issue I think, as it happened for me (admin) as well. But it’s not consistent. When I log into my local install of the website, it does seem to work, and here comes the crazy; it then also works on the production site. What else; the page template renders it’s parent (it’s a backbone js app), but I’m not sure if this matters, thought I should mention it anyway. Any clues? I’m not sure how to debug this one. All the best, T – I did try to clear all sessions, and none of the websites pages are cached at the moment.
  8. It was this line of code: $this->message("$name = $value");
  9. Hey all – I’ve been using this FieldtypeImageExtra inputfield to create multi-language captions for a repeater that contains multiple image instances. It is working well so far. Only thing is, I get flooded with notifications after saving a page, it looks like this: Is there any way to disable this? Will definitely make my client happier
  10. Hey all, I’ve run into the same problem, moved a site to another server (php 5.3.2.) but with an extra hurdle, when I try to reset the password through the API, it throws me a 500 Internal Server Error, which is logged as: Error: Exception: Unable to generate password hash (in /var/www/vhosts/stage.vandejong.nl/httpdocs/depit/wire/core/Password.php line 270) Edit: Radek’s fix (adjusting Password.php) did the trick.
  11. Thanks so much for your extensive answer, and for making this module. And indeed, relying on ip for getting someones location is definitely not airtight, but all we’ve got. I’m not using it for a security feature, just to show/hide content that is (ir)relevant to that specific group. For now I’ve stripped down your module quite a bit. It now first checks if if the session variable is set, if not it will iterate through the list of ip’s / ip-ranges. It sets the variable to true if it has found a match, or sets it to false if it has not found a match. Regarding the caching, thanks for your insights. I think Markup cache would be the best way to go, too bad I cant use the default caching, which is something that has been working well for me so far. If Pro cache could help me out that would be awesome, but I cannot rely on people entering the website on a single url. Now that I read about the PageRenderNoCache (good one!), would it be possible to serve a cached version of the page if the session variable from above has been set, and if it has not been, not to serve the cache page? That would be real great. I’m not sure what code is being executed and what not when a cached page is being served, is it just the template output that is being cached? In other words; do modules run/execute also when serving cached pages? – And many thanks again
  12. Hey all, For a project I’m working on I need a specific section of the website to be visible only for visitors from one country, visitors from all other countries should not be able to view this menu item and page. I think I can bend the Page Render IP-restriction module to set a $page->variable indicating if the visitor is from that country or not. But I’ve got some questions Caching the IP-restriction action Would it be advisable to save this variable in the user’s session so the site doesnt have to go through all ip-ranges to check up on this for every page load? Caching the website pages This is the tricky one (I think). Can I still cache the website pages when not all visitors should be served the same page content? I think I’d need two versions of each cached page, but wouldnt really know if that is possible? Thanks for reading and your insights are very welcome!
  13. Hi apeisa, Thanks for your reply! These are the changes I needed to do in order to make it work: Comment out this line in FieldtypeCropImage.module if ($this->w < 1 || $this->h < 1) { throw new WireException(sprintf($this->_("Width and/or height not found for thumb: %s"), $thumb)); return; } And I’ve changed the if / condition in ProcessCropImage.module: if (!$prefix || $targetWidth == 0 || $targetHeight == 0) { $targetHeight = (int) $crop['h']; $targetWidth = (int) $crop['w']; } Not sure if this is the proper way to do it, I guess a second set of eyes would be good before I propose to merge anything!
  14. Hi apeisa, Thanks for your reply! These are the changes I needed to do in order to make it work: Comment out this line in FieldtypeCropImage.module if ($this->w < 1 || $this->h < 1) { throw new WireException(sprintf($this->_("Width and/or height not found for thumb: %s"), $thumb)); return; } And I’ve changed the if / condition in ProcessCropImage.module: if (!$prefix || $targetWidth == 0 || $targetHeight == 0) { $targetHeight = (int) $crop['h']; $targetWidth = (int) $crop['w']; } Not sure if this is the proper way to do it, I guess a second set of eyes would be good before I propose to merge anything!
  15. Found it, it’s in here: (FieldtypeCropImage.module) if ($this->w < 1 || $this->h < 1) { throw new WireException(sprintf($this->_("Width and/or height not found for thumb: %s"), $thumb)); return; } I’ll see if I can rewrite this to check for the presence of the values and not for them to be smaller than 1. I think this piece of code casts an empty value (no dimensions entered in config) to 0 $this->w = (int) $crop[1]; $this->h = (int) $crop[2]; So I can’t use is_numeric or is_empty to check if there is a value present. And even if I work around this for the time being (by commeting out the width/height check), the crop I make is not being saved.
  16. First of all, thank you for this module apeisa (and your sponsor!). I’m also in the need of having this freeform cropping functionality, the only thing you need to do is to set the aspectRatio of jCrop to 0. Thing is, when I try to enter this in the config file: thumbnail,0,0 The page I use the field on will give me this error: Width and/or height not found for thumb: thumbnail It would be a nice piece of extra functionality to have in there and it seems super simple to do it this way. I’ve been going through the module files but I havent found a way around this yet, any insights from you guys? Thanks in advance! Thijs
  17. Like magic, that was super quick indeed, thank you Ryan!
  18. And as of today Twitter has killed the old API. When using the module you’ll now get the ‘MarkupTwitterFeed: Unable to load’ error.
  19. Hi Wanze, Thanks for your reply! I went for option 2 and it works well, great!
  20. Hey all, Did I mention that ever since I started working with PW web development has gone /so/ much faster! I’d like to ask you a question about the following; I’m building a so called ‘one-pager’, a website where all pages are on one single page. I’ve created the page structure in PW as I normally do, and I’m rendering all these pages as sections from one template which I’ve called home. I do want the individual sections to have their own url, and from these urls I’d like to render the home template. Nothing special so far, what I am after is the following: How can I figure out which page rendered the home template? I remember seeing a topic about this, and the possibility of passing an options array to the render() method; http://processwire.com/talk/topic/3145-multiple-views-for-templates/page-2?hl=%2Brender+%2Bcaller#entry32876 Is this functionality only available in the dev branch? Or is there another way of figuring out what page was originally requested? I’m running PW version 2.3.0. Thanks in advance! Thijs
  21. Hi Ryan, Thank you for your reply, amazing how no single thread remains unseen by you! For now I’ve added it to the .htaccess file as well, I’ll be sure to remember this solution if I ever run into this issue again. Thijs
  22. Thanks for your reply! Forcing the proper content type fixed the issue, I’ve included this in any page I render (also in the admin part): header("Content-Type: text/html;charset=UTF-8");
  23. Update; behaviour is the same with a fresh PW 2.2 install Some more info: When sending a post request on the production server, these are the response headers: Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection close Content-Length 0 Content-Type text/html; charset=ISO-8859-1 Date Thu, 07 Mar 2013 14:22:29 GMT Expires Thu, 19 Nov 1981 08:52:00 GMT Location ./?id=1001 Pragma no-cache Server Apache These are the response headers on my development server Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection close Content-Encoding gzip Content-Length 20 Content-Type text/html Date Thu, 07 Mar 2013 14:22:25 GMT Expires Thu, 19 Nov 1981 08:52:00 GMT Location ./?id=1007 Pragma no-cache Server Apache/2 Vary Accept-Encoding,User-Agent X-Powered-By PHP/5.2.14 Could it be the charset=ISO-8859-1 on the production server?
  24. Dear fellow PW-jedi’s, I’ve run into quite a strange issue which I find hard to debug, I’m pretty sure the issue is not on the PW side of things but something server side. Anyway; I’ve moved a project to the production server, and when I save a page in the admin section, text is being cut off (not saved) where ever a ‘special’ character occurs, for instance accented characters or apostrophes. Has anyone experienced a similar problem before? Or any thoughts on how to debug this? Always grateful to hear your thoughts! T
×
×
  • Create New...