Jump to content

interrobang

Members
  • Posts

    238
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by interrobang

  1. 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/
  2. 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.
  3. 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.
  4. 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..
  5. 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?
  6. 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/
  7. 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.
  8. 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]
  9. 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.
  10. 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)
  11. A alternative shorter way to do the same: return $pages->find("template=category, id!={$page->parent->id}");
  12. 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
  13. Probably we can do this like the Wordpress shortcodes original. Large parts of the source seem to be the same, but Wordpress only requires PHP 5.2 http://core.svn.wordpress.org/trunk/wp-includes/shortcodes.php
  14. EDIT: Sorry, looking at the InputfieldPassword sourcecode it seems the is no pattern support. But if you dont't need "verify password" you can use a simple InputfieldText and give it a attribute password ($field->attr("type","password");) and a pattern like below. ORIGINAL POST: I think you can use field->pattern like this: $field = $modules->get("InputfieldPassword"); $field->label = "Password"; $field->attr("id+name","password"); $field->required = 1; $field->pattern = "^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$"; //the regex pattern will be used for backend validation and in html5 browsers also for frontend validation $form->append($field);
  15. Thanks for this module. Works great so far. The only issue I have is, that the thumbnail generation doesn't work when using a single image field. I quickly edited you module like this to fix single image fields: // interrobang: additional check: $v instanceof Pageimage if ($v instanceof Pageimages || $v instanceof Pageimage && $thumbExists === false) { // Get image sizes if (strpos($options['pageLabelImageSize'], ',') !== false) { $size = explode(',', $options['pageLabelImageSize']); $sizeWidth = $size[0]; $sizeHeight = $size[1]; } else { $sizeWidth = $options['pageLabelImageSize']; $sizeHeight = $options['pageLabelImageSize']; } if (!is_numeric($sizeWidth) || !is_numeric($sizeHeight)) { $sizeWidth = $sizeHeight = 24; } if (count($v)) { // If image field is of type cropimage (thumbnails module) if ($this->fields->get($field)->type == 'FieldtypeCropImage' && $subfield) { $thumbUrl = $v->first()->getThumb($subfield); $thumbUrl = $v->url . $this->resizeThumb($v, $thumbUrl, array($sizeWidth, $sizeHeight)); // interrobang: additional elseifs for Pageimages and Pageimage // Normal image fields } elseif ($v instanceof Pageimages) { $thumbUrl = $page->$field->first()->size($sizeWidth, $sizeHeight)->url; } elseif ($v instanceof Pageimage) { $thumbUrl = $page->$field->size($sizeWidth, $sizeHeight)->url; } }
  16. Sure? Looking at the code "Template->setFilename" seems to accept the filename with or without path: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Template.php#L324
  17. I did not try this myself, but can't you do this like this already? $page->template->filename = 'summary.php'; $page->render();
  18. I never tried to install PW inside another PW. And I am sure this matters. What does your filesystem structure look like. Where did you install the 2nd ProcessWire instance? Do you bootstrap your 2nd PW in one of your templates of the root PW? I guess the sessions of the 2 PWs conflict. Do you have the same User Authentication Salt in both /site/config.php ($config->userAuthSalt = '')? I guess the salts have to be the same if you have nested PW instances. Do you have the same users with the same passwords in both PW instances? Another idea is to rename one of the sessions in /site/config.php ($config->sessionName = 'wire2';)
  19. Your quotes around "active" are the problem, try this: <?php $root = $pages->get("/"); $children = $root->children(); foreach ($children as $child) { if ($child === $page) { // I changed "active" to 'active' so your quotes dont break the echo. echo "<li class='active'><a href='{$child->url}'>{$child->title}</a></li>"; } else { echo "<li><a href='{$child->url}'>{$child->title}</a></li>"; } } ?>
  20. On the github page it also still says "ProcessWire 2.2 stable" in the short description on the top.
  21. In the past I had similar thoughts a few times, though it woukld not solve Robs issues: It would be great if every fieldtype had setting "max items" and could be repeatable. So a reapeater would be the same as a fieldset with max_items>1. In many case a repeater is just too much, for example when you just want the user to be able to enter multiple urls.
  22. I just moved a site from my local MAMP to the production server and could not login. I tried everything suggest here in the forum, but the "forged" message remained. Because I did not want to upload all sessions I excluded the "/site/assets/sessions/" folder when uploading the site by ftp. As soon as I created the "/site/assets/sessions/" folder by hand on the server everything worked again. Conclusion: Remember that you need these folders: /site/assets/cache/ /site/assets/logs/ /site/assets/sessions/
  23. $news = $page->rootParent->find("template=news-item, sort=-date, limit=5 "); echo "<ul>"; foreach ($news as $newsitem) { echo "<li><a href='{$newsitem->url}'>{$newsitem->rootParent->title} - {$newsitem->title}</a></li>"; echo "<span>{$newsitem->date}</span>"; } echo "</ul>"; Edit: I am too slow... But I think you have to swap sort and limit if you want the latest 5 news.
  24. Ryan, as far as I know a in-page javascript call would indeed hold up the rendering. But you can always put the javascript at the bottom of your body, and there is no need for $(document).ready() Btw, I found a similar thread with some other suggestions: http://processwire.com/talk/topic/1618-page-view-counter-and-cache/
×
×
  • Create New...