Jump to content

jacmaes

Members
  • Posts

    301
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by jacmaes

  1. Thanks, WillyC. Thanks to you, I realized that I forgot to change the permissions in the parent template for the categories. Everything's perfect now.
  2. I'm confused by how PW handles user permissions. I have created a user role of editor with the following permissions: edit, view and update profile. This is an events website where the editor should be able to add and edit events and cities, but not other pages such as categories that are set once and for all. This is my page tree for the editor: There are a few problems here: The editor should not be able to create new categories ("categorías") The editor should not be able to create other pages at the top level, i.e. there should be no "new" next to "Inicio" The "edit" and "view" permissions are all fine. For example, they should only be able to view the categories, and it works as expected. But it's the page creation permissions that I do not understand. This is the access tab in my "categories" template: In this setup, the editor should not be able to create pages, but it seems to apply only to the children of that template. If I undertand correctly, the page permissions are inherited from the home template, and for the editor to be able to create new events and add cities, I had to tick all the checkboxes (view, edit, create and add children) in the home template for the editor: What am I doing wrong here? Or is this kind of fine-grained control not possible currently with PW?
  3. This php code to retrieve your latest tweets has been updated to use RSS, and it still works for me: http://f6design.com/journal/2010/10/07/display-recent-twitter-tweets-using-php/ This might be useful for those who want to update the module.
  4. Thanks for the clarification. Even shorter that way! Would it work the same for "today" then? Also, now that I'm reading your code again, I'm not sure I understand date_start<=tomorrow +1 day Finally, In my current setup, one-day events do not have an end date, .i.e. I specify a start date but leave the date_end field blank. Would I need to do it anyway with the proposed code? I'm probably making things overly complex. Dates are confusing.
  5. Thanks a million, Ryan. It's the AND - OR that that I didn't know how to reproduce with the API. As usual, it's concise and intuitive. I can't conceive starting a project without PW now!
  6. I'd like to convert an existing Website of mine (that does not use a CMS) to PW to be able to update it easily. Problem is, I don't know how to deal with more complex queries such as this one: <? $tomorrow = date('Y-m-d',mktime(0,0,0,date('m'), date('d')+1, date('Y'))); // Tomorrow's events $query_tomorrow = "SELECT id, city, event, category, description, DATE_FORMAT(date_start,'%M %D') as datestart, DATE_FORMAT(date_end,'%M %D') as dateend FROM events WHERE disabled != '1' AND ( (date_start = '$tomorrow') OR (date_start <= '$tomorrow' AND date_end >= '$tomorrow') ) ORDER BY date_start DESC"; ?> I want to show tomorrow's events, so I'm selecting all events that I marked as active (disabled != '1', because they have not been cancelled for example) and that are either: 1. ongoing but will not end today, 2. or will start tomorrow. How would I achieve the exact same query with PW? Thanks in advance.
  7. Michael, are you talking about minifying or compressing? I can confirm that the HTML output (along with my js, css, and svg files) from PW is correctly compressed with the following line in my .htaccess, which is basically a shorter version of the code from HTML5 boilerplate quoted above: <FilesMatch "\.(js|css|html|htm|php|svg)$"> SetOutputFilter DEFLATE </FilesMatch> The issue might be with your server then. You can double-check what's gzipped here: http://gzipwtf.com/
  8. OK, everything's magically working fine today. It emptied my browser's cache, and that seems to have solved the problem. Thanks to everyone who helped out.
  9. I added the two required .js language files for CodeMagic to work. It did work prior to upgrading the latest version.
  10. @apeisa: The jQuery Core is 1.6.2, and jQuery UI is 1.8.14. @soma: No, I'm not using that module as far as I'm aware. The only thing that I've not updated as recommended is the .htaccess file, but I don't think that's related. Everything else in TinyMCE is working fine, except that new fields that I created after updating do not seem to register CodeMagic. And I might be using the dev branch without realizing. I clicked on the "Download .zip" button on the following page: https://github.com/ryancramerdesign/ProcessWire/archives/master
  11. Nope, no third party module installed. I just have a multi-language setup (spanish by default + english) and I'm using CodeMagic. The rest is pretty much the default setup. The error in Chrome's Web Inspector seems to refer to line 17 of JqueryCore.js (JqueryCore.js:17)
  12. I've just upgraded to the latest version of PW (from 2.2.3). Now I'm getting the following error whenever I try to insert a link to another page from TinyMCE: Error Call to undefined method stdClass::attr() (line 56 of ....../public_html/wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.module) In the Console Tab of Chrome's Web Inspector, there's the following error: "Failed to load resource: the server responded with a status of 500 (Internal Server Error) ..../processwire/page/link/?id=1176&modal=1"
  13. Thanks, Nik! I wasn't sure on the syntax. As usual, it's easier than anticipated.
  14. In the "search.php" template that comes with the download of PW, this line allows you to search for "title", "body" and "sidebar" fields: $matches = $pages->find("title|body|sidebar~=$q, limit=50"); But how do you search for content inside a repeater field? Thanks.
  15. Thanks, slkwrm. It seems, then, that much of the work has to be done through the API, and that the use of the standard backend for regular users is pretty much out of question. I'm not too worried about that since there an administrador would review all posts before they are actually published on the site.
  16. I've been asked to consider the viability of the following project: a sort of collaborative blog where any Spanish expat could register and post small articles, videos and photos about their experiences as Spaniards living in the U.S. The trick here is that users should only have the options to view and edit their own posts, and should not have access to the posts of anyone else. I'm guessing then that the traditional user roles and permissions (user, editor, administrator...) do not apply here. It must be the summer heat, but I can't think how to achieve this with Processwire. Any thoughts? As usual with PW, it must be easier than I think.
  17. Soma, Pete, I stand corrected In any case, it's clear that Cufón is not a good option anymore now that @font-face support is broad enough. Apart from the inability to select text, enlarge it without pixelating, Cufón is slow to render and routinely suffers from FOUT (Flash of Unstyled Content) without resorting to hacks.
  18. Two useful bookmarklets for testing responsive designs: http://responsive.victorcoulon.fr/ http://www.benjaminkeen.com/open-source-projects/smaller-projects/responsive-design-bookmarklet/
  19. One small correction: Cufón does not generate PNG images. It generates canvas text. This is the code Cufón outputs for <h1>Find a degree in Spain</h1> <h1><cufon class="cufon cufon-canvas" alt="Find " style="width: 47px; height: 19px; "><canvas width="60" height="20" style="width: 60px; height: 20px; top: 0px; left: -1px; "></canvas><cufontext>Find </cufontext></cufon><cufon class="cufon cufon-canvas" alt="a " style="width: 18px; height: 19px; "><canvas width="31" height="20" style="width: 31px; height: 20px; top: 0px; left: -1px; "></canvas><cufontext>a </cufontext></cufon><cufon class="cufon cufon-canvas" alt="degree " style="width: 74px; height: 19px; "><canvas width="87" height="20" style="width: 87px; height: 20px; top: 0px; left: -1px; "></canvas><cufontext>degree </cufontext></cufon><cufon class="cufon cufon-canvas" alt="in " style="width: 24px; height: 19px; "><canvas width="37" height="20" style="width: 37px; height: 20px; top: 0px; left: -1px; "></canvas><cufontext>in </cufontext></cufon><cufon class="cufon cufon-canvas" alt="Spain" style="width: 53px; height: 19px; "><canvas width="58" height="20" style="width: 58px; height: 20px; top: 0px; left: -1px; "></canvas><cufontext>Spain</cufontext></cufon></h1> For use of ease, I suggest using Google Web fonts which are super easy to implement: http://www.google.com/webfonts/
  20. Akamai's brand new tool is very useful to test the performance of your website on a mobile device: http://mobitest.akamai.com/
  21. I started building responsive sites more than a year ago, and like everyone else I quickly realized that the weakness of that new method / philosophy is serving the same image to all devices, from mobile to desktop. Matt Wilcox's Adaptive Images (server-side resizing) works great, but like JeffS above, I'm interested in optimizing content for device groups, i.e. content optimized for mobiles, tablets, desktop and even smart TVs. I've come to the conclusion that to do this efficiently, device detection has to be done on the server. There's even a buzzword for this new technique: RESS, or Responsive Design + Server Side Components as coined by Luke Wroblewski. WURLF is the most famous device detection database, and there are some good tutorials to get you started such as NetMagazine's, but it seems to me way too complicated for simple projects, and WURLF has turned into a commercial project anyway. I've been looking at two recent projects that seem very promising: Detector Categorizr Categorizr is by far the simpler approach, and I like how it turns the traditional and much-decried User-Agent sniffing on its head: it assumes that whatever is not detected as desktop and TV (which are relatively easy and safe to detect) is a mobile device. In other words, it's a mobile-first based device detection. Clever. Here's a test page I created using Categorizr and that you can check on your mobile, tablet, or computer that will show different content according to the device used (disclaimer: not fully tested): http://www.arqyestud.../categorizr.php Combining this server-side detection technique with the versatility and power of PW could make for very powerful and easily-maintainable 'hybrid' responsive sites. What do you guys think?
  22. I second Jeff's opinion of CloudFlare. I've been using the free version for a couple of months on 3 different websites, and the bandwidth saving + speed improvements do make a difference. Threat protection is a nice bonus too, and seems to work really well according to the statistics they provide. The $20-a-month pro version is tempting as it adds SSL encryption and two brand-new server-side image optimization services: what they call Mirage and Polish. Polish "applies 'lossless' or 'lossy' image optimization to reduce your image sizes by 35% on average". That's nice, but a program like ImageOptim does the same thing: http://imageoptim.com/ What really looks amazing is Mirage which "automatically resizes images for optimal display based on the screen size of your visitors' device." I haven't tried since I'm on a free plan, but that kind of server-side automatic resizing looks like the perfect solution to optimize loading time on mobile / responsive sites.
  23. Thanks a million, Soma. Your code fix did work. I think this should be fixed on the instructions page mentioned above. I have developing another bilingual site, and the module you suggested looks like a perfect fit. I'll let you know if I run into any issue.
  24. I've been trying to set up a bilingual site with Spanish as the default language, and English as the second choice. I've chosen the third option --"Example 3: Display a different language based on URL pre-segment"-- on the page: http://processwire.c...anguage-fields/ I've placed the following code in the "language-gateway.php" as indicated (I think) in the tutorial: <? $user->language = $languages->get($page->name); $path = '/'; foreach($input->urlSegments as $segment) { $path .= $segment . '/'; } $mypage = $pages->get($path); if(!$mypage->id || !$mypage->viewable()) throw new Wire404Exception(); // echo $mypage->render(); // the line above is commented out to avoid a "rendering" the page twice $out = $mypage->render(); $regex = '{(<a [^>]*href=["\']/)(["\']'; $topnav = $page->parent->children(); foreach($topnav as $p) $regex .= "|" . $p->name; $regex .= ")}"; $out = preg_replace($regex, '$1' . $page->name . '$2', $out); echo $out; ?> Everything works great, except that the regular expression does not seem to work. My links in the English version (which again is NOT the default option in my setup) are outputted as "domain.com/enabout/" for the About page in the default PW template instead of "domain.com/en/about/". Notice that there's a trailing slash missing after "en". What am I doing wrong? Any help would be greatly appreciated.
  25. That makes more sense this way. Thanks Soma.
×
×
  • Create New...