Jump to content

interrobang

Members
  • Posts

    255
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by interrobang

  1. Yes, ProCache caches the pages in a folder and adds a redirect rule to your .htaccess, but I don't think it's possible to store these files on another folder. And the cache files are only created on the first request. This mean you have to visit each page once to have a static Version of your whole site. If you just want a static version of your site I recommand using a sitegrabber or wget and upload these files to your server. I think the licence is valid forever, but you only get updates in the first year. Once installed you can keep ProCache running forever on the site. At least this is how I understood the licence, better ask Ryan if you want to know for sure.
  2. I can't say anything about HTTP Response Header tweaking, but if you don't need sessions on your pages it sounds like a perfect candidate for Ryan's excellent ProCache Module. It creates static versions of your pages und you won't have any headers set by php, as no php will be involved when delivering the pages from the cache. I use ProCache on most of my pages, and the performance is really great, especially when combined with some of the best practices from HTML5-Boilerplates .htaccess file.
  3. Either that, or I go to the settings of the PageRender module and click the "Clear the Page Render Disk Cache?" button. Most of the time I do it manually, as it clears the modules cache at once.
  4. I usually dont't exclude any folders and only clear the cache before uploading, but I think its save to exclude the contents of these folders: /site/assets/cache/ /site/assets/logs/ /site/assets/sessions/ But the folders themselves should exist and be writeable on the server too.
  5. put this into one of your templates and you can see the admin url and login: echo '<a href="'.$pages->get(2)->url.'">this way to the admin</a>'; found here: http://processwire.com/talk/topic/4491-unable-to-log-into-processwire-website/?p=44323
  6. title->getLanguageValue is the method you are looking for. Something like this should work: <?php require_once '../../index.php'; $data['markers'] = array(); $markers = array(); $affiliates = wire()->pages->find("template=affiliate"); foreach ($affiliates AS $affiliate) { $marker['latitude'] = $affiliate->mapmarker->lat; $marker['longitude'] = $affiliate->mapmarker->lng; foreach (wire('languages') as $language) { $marker['title_' . $language->name] = $affiliate->title->getLanguageValue($language);; } $data['markers'][] = $marker; } print(json_encode($data));
  7. I did a quick test and this seems to work too: $config->var = new stdClass(); $config->var->item = 'val1'; echo $config->var->item;
  8. I like the idea of this. Though my need is less the part of reusing existing fields, but creating a fieldgroup bundled with its fields. For sure it would a nice if I could even reuse existing fields like "title" and access them like somehow like this "$page->myfieldgroup->title", but I never missed this feature. I try to explain my usecase: I have some templates with a fieldgroup "metainfo" with the fields "browsertitle" and "meta_description". Currently I have to assign all these fields one by one to my templates. And if I later need some additional meta infos for facebook like "og_image" and "og_title" I have to edit all my templates to add these fields. If we would have some kind of defined fieldset, I could just assign my new fields to this fieldset and all my templates would have the new fields.
  9. Sounds strange. Maybe you have forgotten a = somewhere like this: if($page->id=1){} instead of if($page->id==1){}
  10. I never had this problem myself, but HTML5 Mobile Boilerplates .htaccess has some rules for this: # Prevent some of the mobile network providers from modifying the content of # your site: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5. <IfModule mod_headers.c> Header set Cache-Control "no-transform" </IfModule> # Prevent mobile transcoding <FilesMatch "\.(php|cgi|pl)$"> <IfModule mod_headers.c> Header append Cache-Control "no-transform" Header append Vary "User-Agent, Accept" </IfModule> </FilesMatch>
  11. Thanks Ryan, your script works great for me. I just added some lines so my thumbnails from the ThumbnailsModule are also kept: ini_set('max_execution_time', 60 * 5); // 5 minutes, increase as needed include("./index.php"); $dir = new DirectoryIterator(wire('config')->paths->files); foreach ($dir as $file) { if ($file->isDot() || !$file->isDir()) { continue; } $id = $file->getFilename(); if (!ctype_digit("$id")) { continue; } $page = wire('pages')->get((int) $id); if (!$page->id) { echo "Orphaned directory: " . wire('config')->urls->files . "$id/" . $file->getBasename() . "\n"; continue; } // determine which files are valid for the page $valid = array(); foreach ($page->template->fieldgroup as $field) { if ($field->type instanceof FieldtypeFile) { foreach ($page->get($field->name) as $file) { $valid[] = $file->basename; if ($field->type instanceof FieldtypeImage) { foreach ($file->getVariations() as $f) { $valid[] = $f->basename; } } // keep thumbnails: if ($field->type instanceof FieldtypeCropImage) { $crops = $field->getArray(); $crops = $crops['thumbSetting']; $crops_a = explode("\n", $crops); // ie. thumbname,200,200 (name,width,height) foreach ($crops_a as $crop) { $crop = explode(",", $crop); $prefix = wire('sanitizer')->name($crop[0]); $valid[] = $prefix . "_" . $file->basename; } } } } } // now find all the files present on the page // identify those that are not part of our $valid array $d = new DirectoryIterator($page->filesManager->path); foreach ($d as $f) { if ($f->isDot() || !$f->isFile()) { continue; } if (!in_array($f->getFilename(), $valid)) { echo "Orphaned file: " . wire('config')->urls->files . "$id/" . $f->getBasename() . "\n"; // unlink($f->getPathname()); } } wire('pages')->uncache($page); // just in case we need the memory }
  12. I am not sure why, but I often have a lot of orphaned images in my page assets folder. Probably due to failed uploads? What is the best way to clean up my assets folder? No problem to loop through all my pages and find the valid files, but how do I find the orphaned ones?
  13. If your Home has the same template as your events you can use this selector: $parentmost = $page->parents("parent={$page->rootParent}")->first();
  14. I thought I once chnage the messages language by setting <html lang="de">, but I tried it now again and had no success. Maybe I used some polyfill which did this for me? Probably you have to use javascript for your custom messages then: <form> <input type="text" required value="" oninvalid="setCustomValidity('Custom Message')"/> <input type="submit" value="Submit" /> </form> http://jsfiddle.net/HdSqt/171/
  15. This is out of the scope of PW, the bubbles you are seeing are from your browser. You can find some infos here: http://www.html5rocks.com/en/tutorials/forms/constraintvalidation/ Also, make sure you have set the right html lang attribute for your language.
  16. Maybe you can modify Somas ImageMinSize.module http://processwire.com/talk/topic/4091-imageminsize/ to remove the image if its dimensions exceed your allowed dimensions.
  17. I did not try the following code, but I think it should work: foreach ($pages->find("status>=" . Page::statusTrash) as $p) { $p->delete(); } Edit: Soma was faster again..
  18. Did you try the module? As long as you don't save the pages with you image field again the deleted folder won't get recreated. This module should still be useful if not all of your pages actually use the image field. Of course if you edit and save these pages often, the file folders will be created again, but you you could run the module once a day or week using the LazyCron module to get rid of all recreated unused folders. Just interested, but how many pages do you have?
  19. I think you can't prevent that these folders are created, but here is a module to delete unused folders: http://modules.processwire.com/modules/page-clean-empty-dirs/
  20. Sorry for being so cryptic. But you got it right. If you dont need a real CDN and some subdomains on the same server is enough for you my idea should work for you. Maybe this isn't the most professional solution, but its quite fast to implement.
  21. I once created a pseudo/subdomain CDN like this: I created 10 subdomains cdn1.mydomain.com cdn2.mydomain.com,.. all pointing to the same folder as the mainsite. In my templates I had some simple logic to output my assets with one of these subdomains (If i remember correctly i used the last number of the page id, which worked quite good in my case). The only thing you need now is something like this in your .htaccess right after the www-redirect: # subdomain CDN for my image assets RewriteCond %{HTTP_HOST} ^cdn(.*)$ RewriteCond %{REQUEST_URI} !^.*\.(jpg|jpeg|png)$ # all other requests are redirected to the main site to avoid duplicate content: RewriteRule ^(.*)$ http://www.mydomain.com%{REQUEST_URI} [L,QSA]
  22. Nice, thanks for sharing. For getting css styles from photoshop I often use csshat (http://csshat.com). It doesn't have this sexy editor integration, but in exchange it supports CSS Preprocessors (Sass, Less, Stylus) which is even more important for me.
  23. You can also create a single file with all your translateable strings and use this file as your Textdomain in your __() calls. For more infos look in the API docs: http://processwire.com/api/multi-language-support/code-i18n/ (scroll down to TECHNICAL DETAILS/Using Textdomains)
  24. A alternative shorter way to do the same: return $pages->find("template=category, id!={$page->parent->id}");
  25. Yes, it looks like PW is rapidly becoming more popular. Ryan posted some stats here some months ago: http://processwire.com/talk/topic/1793-2012-critic’s-choice-cms-awards/?p=20070 Google trends look good too: http://www.google.com/trends/explore#q=processwire
×
×
  • Create New...