Jump to content

netcarver

PW-Moderators
  • Posts

    2,236
  • Joined

  • Last visited

  • Days Won

    47

Everything posted by netcarver

  1. Hi tinacious, Does wrapping your call to strftime() in utf8_encode() fix this for you? Like this... $formatted_date = utf8_encode(strftime($strings['date_format'], $page->date));
  2. Thank you ceberlin. I've been in two minds about allowing optimisation of InnoDB tables for a while and this has pushed me off the fence. I'll remove the optimisation for that engine with the next release. Regarding a configurable level for issuing optimisation "warnings" that should be entirely possible.
  3. @ceberlin Thanks for posting. I'm not able to repeat the problem with a newly updated pw2.5.8 dev installation. Can you tell me what steps you take that make this repeatable please?
  4. It's about time this was pulled together as a configurable module. So here it is on github and in the module DB. You can configure a set of roles and a target redirect page under the module config. I've done very limited testing here - hence it being marked as alpha in the module DB - so please let me know if it works for you. A word of thanks to both Wanze and kongondo are in order as they pulled most of the material together that I used for this!
  5. Perfect, Raymond, thank you!
  6. @Raymond I'm trying this out now and seem to have hit a problem. I can see that the assigned column is getting stored correctly in the DB but when I access the assigned time as per your example in the opening post I always get "1970-01-01 01:33:34" - which is obviously incorrect. Edited to add: I think your example code should be... if (count($page->myfriends)) { foreach($page->myfriends as $friend) { echo "id: ".$friend->id."<br>"; echo "name: ".$friend->name."<br>"; echo "assigned on: ".$friend->assigned."<br><br>"; } } ...as the assigned field is already formatted. Double-formatting it causes the problem (at least it does in my case.)
  7. @Raymond Thanks for sharing this module. I'm thinking of using it in a project but need to know if the assigned value is API settable too - I'm presuming it is but want to be sure. Thanks in advance!
  8. Some nice feedback there - thank you. Am I right in thinking that ProCache is the only part of the official PW system that needs write access to .htaccess? If so, does it need that access on install or all the time? If it is only at install I'll change the wording on that warning to indicate that it's a general steady-state recommendation and that some components might need write-access when installing them.
  9. I think the size is likely to be correct. Can you verify with a tool like phpMyAdmin? Once I'm less busy I can take a look at why this isn't optimizing.
  10. @cmscritic Thanks for being open to feedback, even criticism, Mike. I like that! And thank you for your backing of PW too! <reminiscence> This topic reminds me of the time I shared a house with a bunch of Spanish post-grad students here in the UK. All 13 of us had communal meals and shared the dining table and house duties. Being a reserved Brit, however, I'd been brought up with one conversation at a time at the dining table - and you could join in or not as you wished. In the student house there were always, what seemed to me to be, six concurrent arguments going on; usually about football. As I got used to this, I realised that they weren't arguments - just good-natured, frank, conversations: with the volume cranked way up. I've seldom met a group of guys who were so community minded, cheerful, helpful and well organised yet their neighbours lived in fear of them through incorrect perception which seemed to equate their being foriegn and loud with aggression/unfriendliness. </reminiscence>
  11. @gebeer Thank you for the feedback - glad this is working for you. For this Inputfield I deliberately wanted to have a way of quickly entering things from the keyboard but I do appreciate that some folks might want a way of adding a JS picker to this. When I'm less busy with my current project I'll look at re-visiting this to add one. If anyone else has additional suggestions for a candidate time-picker, please drop a note below.
  12. Tom, You can use WireHttp's get() and getHttpCode() methods for this.
  13. Good to hear! Not really. The if, as a whole, applies to whatever is in the brackets following it. Yes, $page->sidebar is in the mix, but not as a true/false evaluation any more. So, you've got this bit; if (some-boolean-expression) { // If the expression evaluates as true do this stuff... echo "True!"; } Now you have to peel the if "onion", from the outside in, to find what's happening... if (strlen(X) > 0) : // Checks if the string length of X is greater than 0. This is the true/false decision. // Now let's peel another level and look at what X is... trim(Y) // X is the trimmed version of Y // And Y is? $page->sidebar Putting it together again, from the inside out, the if statement says... 1) Read the contents of the $page->sidebar field. (Even when this string field is empty in PW's admin page it's coming to us with length 1 after the textformatter - probably the TF adding whitespace) 2) Trim it - The trim function trims leading and trailing whitespace (amongst other things) - so now we have an empty string. 3) Measure how long the trimmed version is (Now it's 0) 4) If that length is > 0 then do this stuff (This stops us showing the empty string as the length is no longer greater than zero. You might find this, simpler, if statement works for you too... <?php if (trim($page->sidebar) != '') : ?> ...and I think that's what Soma was suggesting earlier in the thread. Hope that helps.
  14. So doesn't this solve your problem... <?php if (strlen(trim($page->sidebar)) > 0): ?> <div class="sidebarItem"><?php echo "$page->sidebar"; ?></div> <?php endif; ?> ...?
  15. And what about... echo "<pre>Len: ", strlen(trim($page->sidebar)), "</pre>"; If it's still len: 1 then there are some chars in there that the trim function isn't removing. It that's the case I'd do this... $ord = ord($page->sidebar); echo "Ord: $ord";
  16. What do you get if you do this... echo "<pre>Len: ", strlen($page->sidebar), "</pre>"; ...?
  17. @alan Yeah, it's a mess. I found a link to the episode of Security Now that I listened to about this. It's here (hashing in SSL certs part of the show starts about 48 mins in) and there is a transcript for the show over here. Edited to add: If it's any consolation, I currently don't plan to switch to a better cert till the deadline is almost upon us.
  18. Alan, this probably won't affect you or anyone else here who's running https sites but I'll post it anyway... Please makes sure that there aren't any issues with your visitors' browser support for SSL certs that use SHA-2. If you have a whole bunch of visitors using older versions of IE then you may be cutting them off if you do go down this route. (I know that another take on this would be "Encouraging them to switch".) I believe that Mozilla had to rapidly switch back to SHA-1 after switching to SHA-2 recently as many people who install Windows then visit Mozilla's site to get the latest version of Firefox and download it. Of course, when Mozilla switched to SHA-2 some proportion of their visitors (I think it was a fair few percent but can't remember the figure) were finding that they couldn't download Firefox without certificate warnings & ironically this put up a barrier to their switching to a better browser - so Mozilla rapidly reverted the change. What I like about the story are that folks were using IE just once, as a bootstrap, to load a better browser & that Mozilla thought that it was more important to allow them to do that easily than to improve their own site's SSL hash algorithm.
  19. Hehe, if you can get the address of Ryan's public calendar for releases, I'll add it as a default feed.
  20. Just posted a new module to github that simply displays a google calendar in a new calendar page in the Admin interface. It's meant to go hand-in-hand with Ryan's MarkupLoadGcal module. There's really not much else to say about it other than it uses the new module config class so you'll need to be running an up-to-date dev version to be able to use this. Here's a shot of the config page... ...and here's what the calendar page is like... Please note, this module only embeds the calendar; the event you see listed under the calendar in the screenshot above is added by hooking this module's execute() method and extending the output. The hook method uses Ryan's MarkupLoadGcal module to pull events out of the calendar's feed and then appends them under the calendar. ProcessGcalEmbed in the module repository. ProcessGcalEmbed on Github.
  21. Has anyone else tried this yet? If you have, could you let me know if, using the new scheme, you managed to get checkboxes as configuration fields working please? Thanks in advance.
  22. netcarver

    Muesli Café

    @diogo Perhaps onjegolders is onto something (offering an illustration or illustrations) for potential donors who are not in Porto and can't benefit from your rewards with local delivery.
  23. This could work fine for intranet sites. In fact I do something similar on the internal club admin site I'm working on now where we want the names and titles of certain pages to be built consistently from other fields in the page.
  24. @muzzer Check out Teppo's ProcessWire hooking article on this sort of thing and also look at the last two hooks added in the HelloWord example module. You'll see that Ryan's added the ability not only to externally inject new methods to Wire-derived classes but to inject new properties too.
  25. Just a pointer for those interested in why the first() method that diogo mentioned solved this; if you look at your page field "food_types" and switch to the details tab, you probably have the first option selected, like this... ...which is setup to return an array of pages, even if that array only has a single page in it. Now that's why you need to call first() as you need to select a page from the array that $page->food_types was returning. /** * Examples for a page field setup to return an array of pages... */ echo $page->food_types; // This won't work for an array return as you haven't drilled down to a page entry yet. $p = $page->food_types->first(); // Ah, now $p holds a page. echo $p->title; // And now we can show the title. echo $page->food_types->first()->title; // This works too, no need to assign to a variable if we don't want to. You stated in your opening post that food_types only has one page selected... Now look at the other two options for your page field in the screen shot. Both of those options return a single value when the page field is referenced. If you had picked either of those two options then your code would have worked as you'd have been given a page (or 'false' or a NullPage) directly without having to fish it out of an array. Anyway, hope that helps explain things a little more.
×
×
  • Create New...