Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/10/2012 in all areas

  1. 6 points
  2. Glad you found out the mystery. Well that's why we do: if("home" == $page->parent->name) Because like this if you miss one "=" it will throw an error.
    4 points
  3. Hi everyone, A wee site for dream2beats who believe that music can change your life. I subscribe to this idea given that I have my headphones on all day. http://www.dream2beats.com/ Regards Marty PS: This is the first time I've built a blog with categories from scratch in PW so a big thanks to everyone who helped out here.
    4 points
  4. Hey guys, Working on a new idea I've wanted to do for a long time. It's fairly simple and small but maybe you guys will be able to use it in your PW projects at some point. I'm still working on it but here's what it's all about: http://phpformbaby.skakunmedia.com It's called PHPFormBaby and I'm still not sure if it's going to be just one class or a library. But I'm going to get it out soon and get your opinions on it. Cheers!
    2 points
  5. I just pushed an update and is now to 1.1.2. It was easier than first thought. Thanks apeisa for finding it.
    2 points
  6. FieldtypePage will take a whole lot of different things: integers, strings, multiple IDs encoded in strings, arrays, a Page, a PageArray, etc. But the point here is so that it can accommodate various export/import and data abstraction situations. As an example, lets say you export a bunch of pages to a CSV file and one field has multiple page references (lets call it 'pagerefs'). The page references become a string like "123|456|789" in the CSV. When that CSV gets imported again, $page->pagerefs gets assigned the string value of "123|456|789" and it needs to be smart enough to know what to do with that. In ProcessWire, any page field can be represented in a more basic type like this. This is what enables a high amount of portability with the data for export/import and web service situations. But that doesn't mean it's recommended API usage. For API usage, you should treat it as the type you specified in the field settings, be that a PageArray or a Page. I'm not aware of anywhere else that this type of overloading would be possible. I also don't want to recommend these abstractions for regular API usage. This is purely for the benefit of behind-the-scenes portability and automation. I don't think it's so applicable outside of the context of a $page->set() situation.
    2 points
  7. This is a site I released a couple of years ago, but since their previous hosting provider couldn't upgrade her plan to mysql 5 (!) I somehow managed to get all kinds of weird textpattern messages when editing the different photoalbums. I moved her to another hosting company. Kudos to Textpattern for working on a server which was never updated since the early releases by Dean of TextPattern. Just for the photoalbums I converted the site to ProcessWire in two nights. Props for TextPattern for not infering with my code so the transformation process couldn't be done any quicker. Props for Ryan for making the other end possible. Lisettemartens.nl Game on. Got a couple of sites to convert too. Now it's time to buy that form thing.
    2 points
  8. You wouldn't happen to have something like this executed on those 3rd level pages before the foreach? $page->parent->name = 'home'; After that line everything works exactly the way you described. Don't know why you'd do that on purpose, but for example a missing second equals sign in an if statement would explain this.
    2 points
  9. Hey, there are a lot of good posts that I would love to like but I "have reached my like limit" in this forum for today... Could someone - Pete - change this? / Nico
    2 points
  10. Should this file be translatable: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupPagerNav/MarkupPagerNav.module Especially prev / next labels? I know these are easy to set from template code, but it is boring stuff if you have primary lang something else than English.
    1 point
  11. Those should be translatable, I'll update.
    1 point
  12. this.why i no use moo .tools or leche
    1 point
  13. I've done this before and used the method SiNNuT mentioned. Made the navigation with something like this: for($n = ord('A'); $n <= ord('Z'); $n++) { $letter = chr($n); echo "<a href='{$page->url}$letter/'>$letter</a> "; } Then pulled the items matching the letter from the URL segment like this (just like SiNNuT): $letter = strtoupper(substr($input->urlSegment1, 0, 1)); if($letter >= 'A' && $letter <= 'Z') { $items = $page->children("title^=$letter"); echo "<h2>Letter: $letter</h2>"; if(count($items)) echo $items->render(); else echo "<p>No items found</p>"; }
    1 point
  14. I like PSR-0 because it really does have a point and provides that potential for mix and match of tools as you mentioned. This is one I want to implement. But I don't feel the same about PSR-1&2, at least when it comes to some of the code style aspects. Intentional choices about some of these aspects were already made in ProcessWire. While some of these are subjective, I think the choices already made are far better than those in PSR-1&2. So PSR-1&2 won't ever be on the roadmap for the code I maintain, but PSR-0 will.
    1 point
  15. I feel like I broke something in that install just by looking at the screenshot.
    1 point
  16. Fantastic! Thanks arjen - that's sorted it. Not much excuse for that error! As it worked locally, I assumed I'd got the file names right.
    1 point
  17. Just an idea: it looks like you name you file with an Uppercase (Semphome.inc) and include with a lowercase (include("./semphome.inc"). Maybe that's the problem?
    1 point
  18. Hi, and welcome to the forums! You're right, the limit selector can be used like this: $images = $page->images->find("limit=6");
    1 point
  19. I updated the repo, to fix the inputfields.js problem. It was there but I named it wrong.
    1 point
  20. Nico - increased it to 50. Marty - I suspect this will be fixed in the next version coming *soon* (no idea when soon is, but the speed of updates in PW means waiting for any other software update is like having your teeth pulled out ). I'd hesitate to spend time on it just yet if a new release is coming in the next week or so, but I agree that it is terribly frustrating when you press "back" on your phone and can't click on the topics beneath the overlay. Marc - yes it does. If you're on a smartphone you can load the forums, touch the icon at the top-right and touch the New Content button. It's pretty quick as it doesn't load the usual theme for the forums and works reasonably well even in slower data areas, although 3G and wi-fi would be preferable to waiting.
    1 point
  21. Hi Michael. I don't think it's the right way to install language support only for the sake of displaying localized dates. The problem with setlocale can be that the list of installed locales can change from server to server, also in relation to the OS the server runs. So there is no guarantee that setlocale(LC_ALL, 'de_DE'); works on all systems. If you're on a *nix system you can probably look up the available locales by doing, <?php system('locale -a') ?> or run this the command, locale -a, from the terminal. If that doesn't work you can try an array in config.php in which you just put the most common variations, then it will try them all. Something like, <?php setlocale(LC_ALL, array('de_DE.UTF-8','de_DE@euro','de_DE','german')); ?>
    1 point
  22. Micta (Mensink ICT Advocatuur) is a lawyer office based in Groningen, The Netherlands and specializes in internet law, intellectual property law and general IT law. You can safely press the accept/akkoord/accepteren button, it's a Dutch cookie thing. Link: micta.nl
    1 point
  23. i agree to would move everything into a subdomain, or at the very least block robots with a robots.txt file, while you are working on fixing those things; and also in future it is a good habit as arjen says to first test the site in a subdomain when migrating from a local version to a live server...
    1 point
  24. This looks like it was save the html from the render to a file which isnt exaclty what we were trying to do. I like the idea though. Well the odd thing is that when I would view the page via the browser I would get the full path to the image, but via the render it would only show the path to where the image is located but not the image filename. So it exists but wasnt showing the full thing. As a side note we found a fix for the problem after trying about 20 different things... The fix was to add the "setOutputFormatting" to the $a that was looping for the articles like this, not sure if it was the best way but it works: <?php $related_articles = $pages->get(1007)->children("template=article,is_national=1,related_edition={$pages->get(1021)->related_edition},related_categories!={$pages->get(1132)},sort=-date,include=all"); if ($related_articles->count()) { foreach ($related_articles as $a) { ?> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <a href="<?php echo base_url().$a->url; ?>" title="Learn More: <?php echo $a->title; ?>" target="_blank" style="text-decoration: none;"><?php echo ($a->headline != '') ? $a->getUnformatted("headline") : $a->title; ?></a> <?php // Set output formatting to true so article images work $a->setOutputFormatting(true); $suffix = ' <a href="'.base_url().$a->url.'" target="_blank" style="text-decoration: none;" title="Learn More: '.$a->get->title.'">Learn More »</a>'; if ($a->featured_image) { ?> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom: 10px;"> <tr> <td style="padding-right:10px;" valign="top"> <?php if ($a->featured_image->url->description != '') { ?> <a href="<?php echo $a->featured_image->url->description; ?>" title="<?php echo $a->get('headline|title'); ?>"><img src="<?php echo base_url().$a->featured_image->url; ?>" alt="<?php echo $a->get('headline|title'); ?>" border="0" /></a> <?php } else { ?> <img src="<?php echo base_url().$a->featured_image->url; ?>" alt="<?php echo $a->get('headline|title'); ?>" border="0" /> <?php } ?> </td> <td valign="top"><p style="font-family: Arial, sans-serif; font-size: 13px; color: #555555; line-height: 16px; margin-top: 0; margin-bottom: 10px;"><?php echo (trim($a->summary)) ? $a->summary.$suffix : truncate($a->body, 250, '..'.$suffix); ?></p></td> </tr> </table> <?php } else { ?> <p style="font-family: Arial, sans-serif; font-size: 13px; color: #555555; line-height: 16px; margin-top: 0; margin-bottom: 10px;"><?php echo (trim($a->summary)) ? $a->summary.$suffix : truncate($a->body, 250, '..'.$suffix); ?></p> <?php } ?> <?php // Reset the output formatting to false (original) $a->setOutputFormatting(false); ?> </td> </tr> </table> <?php } } ?>
    1 point
  25. Hi Ryan! Thank you for your reply, Sorry for not replying till now, I've been a bit busy trying to work this out and it seems I'm finally getting the hang of this. Basically I'm building a module based in your FormTemplateProcessor but without using the InputfieldPage to store the fields. Instead I'm storing them in array of Inputfield instances. This gives me the ability to use any type of field which solves my first issue, it also validates which is sweet! But I noticed something, after a Form is processed the fields seem to lose their original type somehow. I think this is because I'm not storing the fields inside a Page instance. This was only noticeable inside the sendMail method when checking for a InputfieldEmail instance. It's not really an issue, just something I noticed. Thank you very much for your help!
    1 point
  26. I had the same problem on my local server while using MAMP on a Mac. I was able to solve it by adding the following to my VirtualHost declaration in httpd-vhosts.conf: <VirtualHost *:80> DocumentRoot "/Users/username/Test Site" ServerName testsite.loc <Directory "/Users/username/Test Site"> AllowOverride All </Directory> </VirtualHost>
    1 point
  27. Looks like you're right martind, sorry for the confusion. At least I got confused with this, so let's make things clear in case someone else stumbled across this sometime later: When dealing with FieldtypePage (a field of type Page in Setup -> Fields), it's ok to assign a single Page object to the field and things just work. If the field is set to be dereferenced as PageArray (edit the field -> details), the assigned page is added to the array. Otherwise the given Page object is naturally assigned to the field (field is set to be dereferenced as Page). On the other hand (this is what got me confused in the first place), when dealing with plain PageArray simple assign of a Page does not work, but add() method has to be used. It's the FieldtypePage that adds the magic. While it's great to have such convenience added here and there, one would expect things to work the same way where applicable. At least I would. This is actually why I was so keen on making sort, start and limit with WireArrays work more like they work when using selectors. I think there are some other cases as well where this kind of alignment could be a good thing.
    1 point
  28. Simplest version of Ryan's code for this (that I've found): http://processwire.com/talk/topic/860-videos-inside-processwire-how-to-embed-videos-inside-processwire/#entry7280 The nice thing is, you wouldn't need to use preg_replace and some crazy regex. You'd just need to replace the preg_replace function with str_replace. For this reason I'd recommend using some special word rather than just "gallery". Maybe "renobird" or something. More of Ryan's code: http://processwire.com/talk/topic/1768-video-embed-fro-youtube-vimeo-etc/#entry16447 (in case it's helpful)
    1 point
  29. Yes there is, method has(). Assuming you're trying to remove a page from a page field if it is there already and otherwise add it there: if($user->abos->has($p)) { $user->abos->remove($p); } else { $user->abos->add($p); } Notice also that $user->abos is a PageArray while $p is a Page, so plain assign wont work. You'd have to use add() method as in my example above.
    1 point
  30. One of the first reasons I fell in love with PW was the coding style, because I use the same rules Though I'm only a casual PHP programmer, I'm mostly programming in Delphi, but the same rules apply for me.
    1 point
  31. 1 point
×
×
  • Create New...