Jump to content

interrobang

Members
  • Posts

    255
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by interrobang

  1. 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
  2. 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);
  3. 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; } }
  4. 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
  5. I did not try this myself, but can't you do this like this already? $page->template->filename = 'summary.php'; $page->render();
  6. Edit: Sorry, double posted
  7. 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';)
  8. 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>"; } } ?>
  9. On the github page it also still says "ProcessWire 2.2 stable" in the short description on the top.
  10. 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.
  11. 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/
  12. $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.
  13. 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/
  14. Thomas, I ran into the same issue and used the filter() function as a quick workaround: $pages->find("template=video")->filter("is_private!=1")
  15. something like this in your widget: if ($page->motherpage) $page = $page->motherpage;echo $page->sidebar; and something like this in your motherpage: $yourWidgetPageObject->motherpage = $page;
  16. u-nikos, have you seen there is already a module for custom cropping in the backend? http://modules.processwire.com/modules/fieldtype-crop-image/
  17. My extended Christmas holidays already started, so I can only test when I am back in the office in late January. If noone else did it by then, I would be glad to help you to implement the pixel cropping. EDIT: I should note, that the current percentage cropping, is not really setting the center but its more like aligning the downscaled original into the target size: 0% 0% = NorthWest 50% 50% = center 100% 100% = SouthEast I am not sure if this is the expected result. Should the cropping parameters represent the thumb center instead? What do you think?
  18. I totally agree with you. A fixed date format wouldn't be of much use. Thats why I already reverted my changes. I didn't thought at using a real date field. But now I already solved it using my own foreach. I was simple enough. I think I just wanted to play with your module. It's a great module btw. Thanks for building it, Soma.
  19. thanks. But I don't know how to use php in item_tpl. Maybe I just shouldn't misuse MarkupSimpleNavigation for this $moduleMarkupSimpleNavigation->render(array( 'selector' => "template=news-article, news_category={$newsCategory}", 'item_tpl' => '<div class="news-header"><h3 class="news-headline">{title}</h3><span class="news-date">{created}</span></div><div class="news-body">{body}</div>'), null, $page); It works! I modified the module and added these 2 line @line 203 to output my date: else if ($match[1] === 'created' || $match[1] === 'modified' ) { $field_value = date('d.m.Y', $f); } And now I am gonna revert these changes and stop abusing this module for my purpose.
  20. I want to output the page->created date in my list, but I only get the timestamp. Is it possible to format the date somehow?
  21. In case anyone wants to buy PhpStorm, buy it today. I just got this tweet: I am using PhpStorm for about a year now, and I am quite happy with it. And the upcoming new UI looks nice, too. * Sorry for spamming this forum with special offers, but I think some here might be interested. I am not affiliated with them, just a happy user.
  22. Ryan, I think it would be enough to add something like this below the cropping switch in ImageSizer if you want to implement this feature. // setCropping(array(.3, .4)) // = centered at x=30% y=40% ; if (is_array($this->cropping)) { $w1 = ($gdWidth - $targetWidth) * $this->cropping[0]; $h1 = ($gdHeight - $targetHeight) * $this->cropping[1]; }
  23. I am sure for small page counts ProcessWire can handle faceted searches quite well with some lines of custom code. I think the real advantage of Solr is mainly on high traffic sites with lot of pages. But I think you are right, in the moment the audience for something like this is quite limited. And there are more important features on the roadmap (like page revisions/draft/live version), to get into this enterprise cms area where features like this are needed. If I could get a customer only if PW supports Solr I would be happy to sponsor this feature. Let's see what 2013 has to bring Thanks for looking into this.
  24. A submit button and a little bit of php on top of your templates. Here is a good explanation: http://css-tricks.com/unobtrusive-page-changer/
  25. If you are using the dev branch, you can validate the data using a regex pattern. Just enter a vaild pattern in the Field Settings (Pattern is hidden in the Input Tab) and It should validate both client side and server side. In the moment it is not possible to get custom validation messages, but this should be easy to add at least for client side validation, as it is enough to add a title attribute to the inputfield with the message. Edit: For some reason I can't see a pattern inputfield on Textareas. Of course for client side validation a modern browser is needed, as long pw doesn't include a polyfill javascript.
×
×
  • Create New...