Jump to content

netcarver

PW-Moderators
  • Posts

    2,241
  • Joined

  • Last visited

  • Days Won

    47

Everything posted by netcarver

  1. Just tried the module and it seems to work very well. Thanks, mindplay!
  2. I tried to come up with something better but failed. I think ProcessPagePin is pretty accurate and concise. Good enough in my books.
  3. Bumped to version 1.1.0 with the addition of tag transformations. You can now do things like making a user's name all uppercase... Hello {user.name>upper}, how are you? You can choose 'upper', 'lower', 'title', 'strip', 'base64' or 'url' transformations on any tag. They can also be chained like so... http://blahblahblah.com/index.html?p={page.title>lower>url} Which would first lower the case of the page title and then url encode it.
  4. Ok Antti, that's done, thank you. For anyone really having trouble seeing how the tag parser works I suggest installing the helper module that allows you to play with the parser from a new page in the admin interface until you get the hang of it.
  5. Yes, you understood it. I'll update the example.
  6. I found the parseTags() routine from Ryan's Login Notify plugin pretty useful in a couple of modules I wrote recently and will probably reuse it again in other modules. I thought others might find it useful too, especially if it were slightly more flexible in the setup of the context from which it pulled the values to use in its substitutions so I rewrote it as a Textformatter. Originally parseTags() would turn something like this... "Date: {datetime}\nUser: {name}\nIP: {REMOTE_ADDR}" …into something like this… Date: 12th September 2012, 14:45 User: ryan IP: 127.0.0.1 ...using a User as the context for the substitutions. This text formatter extends this to allow an array of WireData instances to be used as the context for substitutions and extends the tag format from simply {fieldname} to {context.fieldname} to allow substitutions from specific places. This could allow you to use data from, say, a User and a Page when parsing your string. Something more complex can then be parsed successfully; like this... Hello {user.name}, where have you been? It's {datetime} now and we haven't seen you in two weeks. Your last edit was on page '{page.name}' from address {REMOTE_ADDR} ...where the name field from both the supplied User and Page can be substituted into the text. It's entered in the modules directory here but most of the documentation is in the readme file on github. There is also a handy Process module that allows you to experiment with it from within the PW admin (thanks to Nik for the idea as it's based on his Test Selectors module.)
  7. Ok, not sure what's going on as I tried it again and it does work. I might have left the .com off the end of my domain previously.
  8. Ryan, apologies, my mistake when typing the above, I meant in the domain part. I'll strike that error out and correct it in the opening post.
  9. Well, I'm weird because I have several email addresses that have dashes in them in the local domain part (before after the @). This is perfectly legit and my email addresses certainly work. However, PW's email input field always seems to complain if I try entering one of these dashed emails into it. I haven't tried it yet with PW, but '+' can turn up occasionally in gmail addresses. Any chance that we could support weirdos like me with the email input field? Edited to correct mistake.
  10. Just a thought; if your client is using a debian based linux installation with Apache2 then you can make sure that mod_rewrite is installed pretty easily by doing... a2enmod rewrite from a terminal as root (or use sudo if you're using something like Ubuntu).
  11. Hi eomine and welcome to the PW forums. I think teppo is right and, fortunately, as your client runs his own server this should be easy to diagnose and rectify. Ryan recently posted a reply to a similar situation that might help you.
  12. Hey Wim, glad you worked it out. Welcome to the PW forum.
  13. I like this approach, it's more flexible and simpler to program than my example.
  14. Hi Tom Tom & Welcome to the forums. There are a few ways you could address this. Here's just one possible solution (there are plenty more)... <?php $homepage = $pages->get("/"); $children = $homepage->children; $children->prepend($homepage); $n = count($children); foreach($children as $i => $child) { $class = "class='"; if( $child === $page->rootParent ) $class .= "active "; if( $i == $n - 1) $class .= "last"; $class .= "'"; echo "<li $class><a href='{$child->url}'>{$child->title}</a></li>"; } ?> If you are looking to generate a menu-like structure there's a markup module you might want to try as well as looking at doing this via your template file.
  15. @Marty, Could you give this branch a try and let me know if it addresses your needs? It integrates with the ProcessRedirects module (if you have it installed) to automatically generate the short 'redirect_from' field for you.
  16. Hi mike77, nice to see another first-time poster on the forum. What topics would you like to see new tutorials cover?
  17. Thanks for the feedback folks. I just added a link shortening routine to the module so you can use its features programmatically. This addition bumps the version to 1.1.0
  18. Ah, right. I'll just have to make sure I install the hooks consistently next time then.
  19. Ok, that certainly explains the result. But it makes me wonder if a unified approach to hooks might be more logical than having a set of static hooks and local hooks unless there was a specific reason for going for two sets?
  20. Ok, an update. To get two of my modules to work well together I do need this functionality. I basically want the 2-factor login module to get first crack at the hook before the login alarm gets to log/email the users. I set the priority in the 2-factor module to 10 and in the alarm module to 2000 (just to be sure) however on adding a die(__CLASS__) to both hook handler routines I could see that the alarm module was getting called first. An unexpected result, but I've now found out why. It turns out that I was hooking the login event in slightly different ways and this does seem to effect the order the routines get called in. In the 2-factor module I was doing this... $this->addHookAfter( "Session::login", $this, 'my2FactorHook', array('priority'=>10)); Whilst in the alarm module I was adding the hook differently... $this->session->addHookAfter( "login", $this, 'myAlarmHook', array('priority'=>2000)); Switching the 2-factor init() routine over to using $this->session->addHookAfter('login'...) has everything called in the right order.
  21. Am I right in thinking that multiple hooks that are added for the same event can be prioritised by doing something like this... $session->addHookAfter( 'login', $this, 'myLoginHook', array('priority'=>xyz) ); Where xyz is the relative priority for the hook and the lower the value, the earlier it will be called as the hooks are executed?
  22. Hello lucas, welcome to the PW forums!
  23. Heavily influenced by Ryan's Login Notifier, the Session Login Alarm module can log access attempts and optionally send emails to users when their accounts are accessed (successfully or unsuccessfully.) This can give users some indication of unexpected activity on their accounts.
  24. Welcome to the PW forums!
  25. @SiNNuT, if it is already formatted as you suspect, perhaps this would do: <?php echo $page->closing; ?>
×
×
  • Create New...