• Content count

  • Joined

  • Last visited

  • Days Won


formmailer last won the day on February 13 2012

formmailer had the most liked content!

Community Reputation

63 Excellent

About formmailer

  • Rank
    Sr. Member
  • Birthday 06/01/1976

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Sundsvall, Sweden (but originally from The Netherlands)
  1. And another small issue, after submitting a comment, the "waiting for approval message" shows, but even the form. Shouldn't the form be hidden when the GET variable "comment_success" is present? //Jasper
  2. Hi! I tried to enable mail notification for users (guests), enabled "Allow commenter e-mail notifications": The option shows up on the page: But no e-mails are being sent. Is there something else I need to do? Other mail notifications, like the admin notification for comments, are working just fine, so it's not a general e-mail issue. Any help is appreciated. //Jasper
  3. I managed to build the whole site without using Jquery, for speed optimization, so unfortunately the Jquery option is no alternative. I will go for the copy solution. Thank you for your help!
  4. Hi! Yes, I thought about doing that, but I was hoping there was a shortcut to this. A risk (even if it's a minimal one) is that future core updates could break the module. I was hoping there would be a way to change classes without modifying the module. But if this isn't possible I'll go with the copied & modified module. //Jasper
  5. Hi, I am trying to style the comments form (and comments list) to match the rest of the site. I know that it's possible to edit the CSS file for the comments module, but I would rather add my existing classes to the fields, instead of making another css file containing the same CSS styling. I use the following to render the form: $page->comments->renderForm(); Is there an easy way to add the CSS classed to the fields? //Jasper
  6. For some reason the count() always return one image less than the actual number of pictures. If the page has 3 images with the correct tag, the count is 2. Strange but it seems to be that way....
  7. Thanks again! For some reason this is not working. But this is: $page->randomIndex; if (--$page->randomIndex >= -1) { I am not sure why this is working but it is.
  8. One more (final) question. Is there an easy way to make this work for pages with only one image? That would allow me to use the same hanna tag on every page, not only on the ones that have more than one image. //Jasper
  9. Thank you guys so much, this solved my problem! Good trick about the "seed attribute", @Robin S. //Jasper
  10. Thanks again. Unfortunately my plan is not going to work, because the Hanna Code generates the same result if the Hanna tag is added multiple times. I validated this by making a Hanna code snippet with the following: echo(mt_rand(10,100)); I added the Hanna tag 3 times and the result was 3 times the same integer. //Jasper
  11. Thanks Abdus! Using: $a = $page->images->findTag('inline-body')->getRandom(2); Would be even easier. Problem is that the template doesn't specify location of the images defined. These are inserted in the body text field using Hanna Code. That makes the above a bit harder to apply. My own idea was to create a code snippet in Hanna that could be re-used as many times as needed. If I can check if the array $a exists and only create a new one if it doesn't, it should be possible to do so. I know that it is not the fastest code, but since all the pages are being cached by ProCache I am not worried about this process taking an extra second or two. /Jasper
  12. Hi! I use the following to display a random image on a page: $image = $page->images->findTag('inline-body')->getRandom(); This works of course really fine, but on some pages I want to use 2 or more random images. The images have to be on different places and the same image shouldn't be displayed twice. I assume that I have to something like: $a = $page->images->findTag('inline-body'); $image = $a->getRandom(); echo "<img src='$image->url'>"; $a->remove($image); and with later in the template, for the next image, I'll just do: $image = $a->getRandom(); echo "<img src='$image->url'>"; $a->remove($image); Would this make sense? Or is there a better way? //Jasper
  13. I just solved it using Bernhard's tips, so I didn't try this one. But looking at it quickly, I don't think it would solve the whole problem, since the pages parents are still hidden. But thank you for your reply, It's very much appreciated. /Jasper
  14. @bernhard Thanks! That helped a lot! //Jasper
  15. Hi! I have a side menu, based on the renderNavTree function that comes with the default site template in PW: /** * Given a group of pages, render a <ul> navigation tree * * This is here to demonstrate an example of a more intermediate level * shared function and usage is completely optional. This is very similar to * the renderNav() function above except that it can output more than one * level of navigation (recursively) and can include other fields in the output. * * @param array|PageArray $items * @param int $maxDepth How many levels of navigation below current should it go? * @param string $fieldNames Any extra field names to display (separate multiple fields with a space) * @param string $class CSS class name for containing <ul> * @return string * */ function renderNavTree($items, $maxDepth = 0) { // if we were given a single Page rather than a group of them, we'll pretend they // gave us a group of them (a group/array of 1) if($items instanceof Page) $items = array($items); // $out is where we store the markup we are creating in this function $out = ''; // cycle through all the items foreach($items as $item) { // if there are extra field names specified, render markup for each one in a <div> // having a class name the same as the field name /* if($fieldNames) foreach(explode(' ', $fieldNames) as $fieldName) { $value = $item->get($fieldName); if($value) $out .= " <div class='$fieldName'>$value</div>"; } */ // if the item has children and we're allowed to output tree navigation (maxDepth) // then call this same function again for the item's children if($item->hasChildren() && $maxDepth) { $out .= '<div class="w3-block w3-padding w3-white w3-left-align accordion">'; $out .= $item->title; $out .= ' <i class="fa fa-caret-down"></i></div>'; $out .= '<div class="w3-bar-block w3-hide w3-padding-large w3-medium">'; $out .= renderNavTree($item->children, $maxDepth-1); $out .= '</div>'; } else { // markup for the link $out .= "<a href='$item->url' class='w3-bar-item w3-button w3-opacity-min'>$item->title</a>"; } } // if output was generated above, wrap it in a <ul> // if($out) $out = "<ul class='$class'>$out</ul>\n"; // return the markup we generated above return $out; } The only problem is that all submenus are hidden by default (the w3-hide class). Now I am looking for a way to find if the current page is somewhere in the tree, this part of the tree should be visible: Eg. If I am on the page called "Complete rondreis “Arvid” met Buro Scanbrit", the menu shoul look like this: And when I am on the Page called "Buro Scanbrit", the menu should be like this: How do I achieve this? I guess I need to check if $item is (grand)parent of the current page, but I can't really figure out how to do this. Any smart suggestions? Thanks in advance! //Jasper