Jump to content

ryan

Administrators
  • Posts

    16,715
  • Joined

  • Last visited

  • Days Won

    1,517

Everything posted by ryan

  1. A cache file is locked until completed being written. I'm guessing the requests are coming at it before it can complete the cache. That might explain the longer time it takes here, as you might have a few requests trying to both generate and cache the page. Though double check that it has permission to create the cache file in site/assets/cache/Page/. Does your page being rendered save or delete any pages? Also note that a cached page is not the same as a static page. All hooks still get executed, permissions checked and such. Just the template output is cached. That can help a lot in some instances. But if your template isn't doing anything time consuming, then it won't make any difference--no reason to use cache in such an instance.
  2. Btw, you mentioned the "cache module", and I think you must mean MarkupCache? This is for partials rather than entire pages and it's something different from template cache.
  3. Make sure you are logged out too. Pages aren't cached for you when you are logged in. There are other factors that can disable the cache, but most under the template settings. And of course a page is only cached once the cache has been generated, so if you are hitting a bunch of pages for the first time in an hour then it's likely none of them were cached. In general, cache is only used for the 'guest' user. I am working on a so called super cache module that bypasses both MySQL and PHP. It uses the apache rewrite engine to pull cached urls directly from static files.
  4. Nice job Adam!! Please add this to the modules directory when you get the chance. Also, I suggest removing the "permanent=true" from your getModuleInfo() because otherwise it is uninstallable.
  5. There isn't a setting to do that, but you can accomplish it pretty easily from a selector: $page->children("template!=some_template"); $pages->find("template!=some_template|some_other_template"); Or, even better, specify the template you want: $pages->find("template=good_template");
  6. Most of the web servers I use don't actually have git, so I'm usually just doing this: mv wire wire.old mv wire.new wire When a server does have Git, I'll usually keep the repository somewhere outside of the webroot. Then I'll basically do the above, replacing the wire directory with the new one, after a git pull. But my repository will live in a 'src' directory off of my [non web accessible] home directory. I keep it non web-accessible so that there isn't an extra uninstalled copy of PW lying around the server (which wouldn't be safe). Perhaps there's a better way to go about this, but since most upgrades only involve replacing the /wire/ directory, I don't usually find it necessary to have the live core files themselves version controlled. Sometimes the /index.php and /.htaccess file will also need to be replaced, but that's fairly rare.
  7. Looks okay to me. You might want to account for other possibilities too, like https, etc. $url = preg_replace('{^.+://}', '', $dealer-website);
  8. I'm really happy with the new site too. I wish I could take credit for some part of it, but didn't have anything to do with the design or development (other than some last minute tweaks before launch). It was designed and developed by the forum community here. The designer asked not to be named yet until the site is fully done (we consider the current one a 'soft launch', and some changes are yet in store). Though I think he should take credit, because the site looks great. Antti and Soma did most of the primary development, and I think Teppo did too? Most of the development took place awhile ago, so please let me know if I'm forgetting anyone. Several of us also participated by offering feedback through the process. These guys did all this months ago, and they were patiently waiting on me to take care of a couple thing and launch it, which I finally did last week. In addition to viewing this site on the computer, I'm loving how it works on the iPhone and iPad. Antti initiated use of the Goldilocks approach in the development, which seems like the best responsive way to go. Something that I think still needs some work on the homepage is the screenshots. I'd like to setup a few different sets of screenshots that can appear there, where what you see now is just one example. If anyone has any good screenshots they think would work there, please send them over and we can test them out. I agree about the headline so went ahead and changed it after a couple comments here mentioned it. Since we're already showing the sky, we probably don't need to literally say "the sky". I think the headline still speaks well if you think of it in relation to skyscrapers, but the current headline (build bigger, faster, stronger, easier) probably has better substance, especially when combined with the new look. But keep thinking of new ideas too, we may be able to find something even better.
  9. Looks great Nico. Just a couple small suggestions: 1. Rather than using $_POST, it's better to use $this->input->post or wire('input')->post, because it's always possible that $_POST could be affected by the server's magic_quotes setting. 2. When loading or writing to a file, add some extra validation so that someone can't hack through it and start viewing and modifying other files on the server. Example of one way you could do it: $name = $this->config->paths->templates . $this->sanitizer->name(basename($this->input->get->file)); if(!is_file($name)) throw new WireException("Template file not found"); 3. Your execute() method returns a form witha 'delete' action, but I can't see any implementation of that?
  10. I'm really not sure what to think about the PHP 5.4 error message. If inheritance is no longer fully working in 5.4, it seems like we'd have problems all over the place. This really rings of a PHP 5.4 bug. But it's easy enough for me to duplicate those __get() and __set() methods back into the class directly in the SessionHandlerDB module, so I went ahead and did that (and it's now on GitHub). Hopefully we can remove this duplication later, but it'll be easy enough for us to work around for now.
  11. Thanks for the introduction Casey and welcome to the forums. Glad you are enjoying ProcessWire and we look forward to seeing more of you around here.
  12. I just submitted a pull request to Antti that makes it work with 2.3 (2.2.10). Also updated it so that it deletes the thumbnails when you delete the parent image. My updates are here: https://github.com/ryancramerdesign/Thumbnails
  13. Looking in the ProcessCropImage code, I think I see the problem. It is constructing image URLs manually rather than asking the page for the images path. This was perfectly fine up until we introduced the secured images option (on the dev branch) which uses a different path for secured images. But this wil not work with 2.3. I'll attempt to submit a pull request for this module.
  14. Marc, let me know what you find. I just need some way to reproduce it, but once I can do that I can fix it quickly. If I can't reproduce it here, and you don't mind giving me access to troubleshoot your install, I'll be glad to do that.
  15. Glad you found it. Eventually I think we'll have to add a 'default sort' option for repeaters, so that they automatically sort by some field present in the repeater.
  16. Sure! You just need to know the name of the field (usually the same as the 'name' attribute) and then you can grab it directly from the Field object. Writing in browser here, but think it should work. It assumes you are somewhere in an Inputfield. $field = wire('fields')->get($this->attr('name')); if($field->textformatters) foreach($field->textformatters as $className) { echo "Name: $className"; } Many Inputfield functions already receive a copy of the $field, in which case you can just use that ($field->textformatters) rather than figuring it out yourself. Only text fields will have a 'textformatters' array, and you'd want to double check that it's actually present before using it.
  17. 70% is a seriously large quantity of mobile traffic. I agree, if that's what your analytics tell you then mobile first all the way. Most of the sites I work with have mobile traffic at a similar level to IE6 traffic. Which is to say, not much. But the trends are always increasing (unlike IE6).
  18. The simplest way would be just to post-filter them after your search. Meaning, whatever code you have outputting the found pages would just check the status and skip over any that had unpublished parents. foreach($items as $item) { $skip = false; foreach($item->parents as $parent) if($parent->is(Page::statusUnpublished)) $skip = true; if($skip) continue; // otherwise item is good to output echo "<li>$item->title</li>"; } But if you are also working with pagination, then you kind of need to have these things filtered ahead of time. In that case, I think Soma's method would be good. The hope is that you don't have too many unpublished pages to be found, that could slow the query. One way to further optimize that would be to find only unpublished pages that have children. $up_pages = $pages->find("status=unpublished, numChildren>0");
  19. Once you've got your form, I think it'll be fairly easy to develop this. But your date fields are the only thing that's going to need a little extra work. Since you are asking for just month and year (no day) you'll want to qualify that to the beginning of the first month and the end of the second month. Finding the beginning of the first month is easy since all months start at day 1. There are various ways to find the end of the second month, but there's one way in my example below. Here's how I might perform the query from the API side (written in the browser so may contain typos): // where we will store our $pages->find selector $selector = array(); // add the search query if present if($input->get->search) { $search = $sanitizer->selectorValue($input->get->search); $selector[] = "title|body~=$search"; } if($input->get->yearFrom && $input->get->monthFrom) { // construct date like 2012-12-02 and convert to timestamp $dateFrom = strtotime("{$input->get->yearFrom}-{$input->get->monthFrom}-01 00:00:00"); if($dateFrom) $selector[] = "date>=$dateFrom"; } if($input->get->yearTo && $input->get->monthTo) { // do the same for month-to, but find the beginning $dateTo = strtotime("{$input->get->yearTo}-{$input->get->monthTo}-01 00:00:00"); // now find the end of dateTo month by adding 1 month and subtracting 1 second if($dateTo) $dateTo = strtotime("+1 MONTH", $dateTo) - 1; if($dateTo) $selector[] = "date<=$dateTo"; } // determine and validate the max records to show $limit = (int) $input->get->limit; if($limit > 50 || $limit < 1) $limit = 10; $selector[] = "limit=$limit"; // specify the template we are limiting the search to $selector[] = "template=article"; if(count($selector)) { // perform the search $selectorString = implode(', ', $selector); $articles = $pages->find($selectorString); echo "<h2>Found " . $articles->getTotal() . " articles matching your query.</h2>"; echo $articles->render(); // or however you want to output them } else { echo "<p>No search specified.</p>"; }
  20. Thomas, just to confirm, you are using language alternate fields, where you have literally created a field called title_english in your Setup > Fields? The syntax you mentioned would only work if you were using language alternate fields, as opposed to a multi-language text or title field. I am guessing that there might not be a literal title_english field in your fields list and that you are using the language-alternate syntax on multi-language title field? If that's the case, see here for the correct syntax. If that's not the case, let me know and we can try something else.
  21. Did some investigating here. If I'm right, it's not a bug per se, but an undesirable behavior. Try changing your code to this: require('./index.php'); // this is the ProcessWire index file for bootstrap $wire->pages->setOutputFormatting(false); echo $wire->pages->get('/videos/')->render(); echo "\n\n\n\n\n==============================\n\n\n\n\n\n"; echo $wire->pages->get('/people/')->render(); That fixed it in my case. The reason was that calling setOutputFormatting() on a page only sets the outputFormatting for that page. If your page's template happens to be loading other pages, they will be loaded with outputFormatting off. By setting the default output formatting state before you render(), you correct that issue. This is only the case when you are rendering from a bootstrapped script, because that default outputFormatting state is pre-set to false. In any other situation, you wouldn't have to do this. I think I can make this a lot simpler. I'm just going to update $page->render(); to take care of setting the right outputFormatting state for itself and the system before it attempts to render a page. If that change didn't fix your case, then go in and check the template(s) for the pages that are being rendered. Do you have any include() statements that should be changed to include_once()? This would be the case if you had any function definitions in include files. If you have any function definitions in your main template file, then you'd want to do this instead: if(!function_exists("my_function")): function my_function() { // do something } endif; Since your two page render() calls are happening in the same PHP runtime instance, you just have to watch out for any duplicate definitions or includes. Let me know if any of this solves it there?
  22. Sounds like a bug guys, I'll look into this.
  23. Wasn't Foundation v2 also responsive? I've not checked out 320andup yet, but am going to take a closer look today. And this gridpak generator looks pretty awesome. great links. I think mobile-first sounds like a great slogan but not a great strategy. It's easy to identify sites that have taken that strategy because the non-mobile version of the site often seems like… an enlarged mobile site. I've not done a lot of mobile stuff yet, but with what I've done, I prefer to focus on both at the same time. Otherwise it seems like sacrifices are being made to one or the other. The full-size design is still what I ultimately have to sell to the clients. There's fewer variables on the mobile side in terms of design and that part [so far] seems a lot simpler to account for (and easier to get approved too). So I guess I think the picture should be bigger than just mobile first. Sorry, maybe I'm a bit off topic, but just remembering an overabundance of mobile first hype at an AEA event last year.
  24. That's a pretty nice code editor there, thanks for the link. Will have to take a closer look. For the most part though, ProcessWire assumes you have your own tools for editing things like your templates and CSS files, and is trying to stay out of your way in that regard. There are also some security issues with enabling direct editing of PHP files on the server. Though I still think this is a good idea for a non-core module, to provide editing capability of template files for those that want it.
  25. It should be that second argument to RCDMap.addMarker, where you could specify whatever URL (or anchor) you want: RCDMap.addMarker('some title', '/some/url/', lat, lng); RCDMap.addMarker('some title', '#some_anchor', lat, lng);
×
×
  • Create New...