OllieMackJames

Members
  • Content Count

    278
  • Joined

  • Last visited

Community Reputation

113 Excellent

About OllieMackJames

  • Rank
    Distinguished Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

4,558 profile views
  1. OllieMackJames

    OK, got it to work with the following code, don't know why, as I am not a coder, but hey it works, posting solution for anyone who wants to use it. Added following code to template function visitorgroup($which = null) { $ip = wire('session')->getIP(); $int = ip2long($ip); $group = ($int % 2) ? 'a' : 'b'; if(is_null($which)) return $group; return $group == $which; } if(visitorgroup('b')): if($page->id == 1 && $page->page2use4homepage) { $page = $page->page2use4homepage;} endif; if($page->id == 1 && $page->page2use4homepage) { $page = $page->page2use4splittest;}
  2. OllieMackJames

    @Zeka just tested and the following does not seem to work: function visitorgroup($which = null) { $ip = wire('session')->getIP(); $int = ip2long($ip); $group = ($int % 2) ? 'a' : 'b'; if(is_null($which)) return $group; return $group == $which; } I have added the above code to my _funcs.php which is called in my template with: require_once "_funcs.php"; Then straight after that line, in the same template I add: if($page->id == 1 && $page->page2use4homepage) { if(visitorgroup('a')): $page = $page->page2use4homepage; elseif: $page = $page->page2use4splittest; But then I get this error Server Error We're sorry! The server encountered an internal error and was unable to complete your request. Please try again later. I also tested with all of your code in one go in my template, did not work either: function visitorgroup($which = null) { $ip = wire('session')->getIP(); $int = ip2long($ip); $group = ($int % 2) ? 'a' : 'b'; if(is_null($which)) return $group; return $group == $which; } if($page->id == 1 && $page->page2use4homepage) { if(visitorgroup('a')): $page = $page->page2use4splittest; elseif: $page = $page->page2use4homepage; Thanks!
  3. OllieMackJames

    @Zeka many thanks! Am now going to test this. @Soma moved, ok thanks
  4. OllieMackJames

    @zeka, thanks for that! Analytics route for CallToAction measurement, makes good sense, thanks getkirby splittest plugin looks good, I wonder how to port this to Processwire. I copied the code below from https://getkirby.com/docs/cookbook/a-b-testing. Question now is... How can I turn it into Processwire language and then make into a plugin?: function visitorgroup($which = null) { $ip = visitor::ip(); $int = ip2long($ip); $group = ($int % 2) ? 'a' : 'b'; if(is_null($which)) return $group; return $group == $which; } Then if that works I would add something like this to the template: if($page->id == 1 && $page->page2use4homepage) { if(visitorgroup('a')): $page = $page->page2use4homepageoption1; elseif: $page = $page->page2use4homepageoption2; Any ideas how to do this? Thanks
  5. Thanks to @Zeka for helping out. I am not a coder and had to tinker some to make it work, but hey it works! The code below allows splittesting 2 pages against each other. Visitors will be divided in 2 groups based on their IP. Measuring clicks to be done via analytics software. Concern might be lack of speed of loading, because this can not be cached, I have no data yet regarding loss of speed of delivery of pages, but will check. This is the code that does the trick: function visitorgroup($which = null) { $ip = wire('session')->getIP(); $int = ip2long($ip); $group = ($int % 2) ? 'a' : 'b'; if(is_null($which)) return $group; return $group == $which; } if(visitorgroup('b')): if($page->id == 1 && $page->page2use4homepage) { $page = $page->page2use4homepage;} endif; if($page->id == 1 && $page->page2use4homepage) { $page = $page->page2use4splittest;} Here's what I would like to do: - divide traffic over 2 versions of a page - measure clicks on a call to action button to see which page gives a better conversion. I already have a system in place to pull data from a different underlying page into one page, I do it with this code: if($page->id == 1 && $page->page2use4homepage) { $page = $page->page2use4homepage; The code above allows me to change a page while keeping the original intact, I went this route because I found on one of my sites after changing a page, I lost rankings in google, and needed a way to change a page, and with one click go back to the original. But now I want to use this dynamic in a different way for splittesting conversions on one page. Let me write down what I would like to happen in the code above: if($page->id == 1 && $page->page2use4homepage) { function count CallToActionClicks for each of the options below count clicks on CallToAction button; function dividetraffic for 50% of the traffic present $page = $page->page2use4homepage version 1; for the other 50% of the traffic present $page = $page->page2use4homepage version 2; Any ideas much appreciated, thanks!
  6. OllieMackJames

    following this, very interested in a visual pagebuilder Good work guys!
  7. OllieMackJames

    Nice! Very interested in your padloper/mollie combination looking forward to your open sourcing of the payment module you built.
  8. OllieMackJames

    @wbmnfktr thanks lots, if I could get that to work, that would make me happy! This works beautifully [[jumplinks for=h2]] with your code did it all in one go! I tried the following code, but it would not work, can you see where I went wrong? <?php // $for defines the headlines you want to take care of. // i.e.: h2, h3, h4 $for = str_replace('h2', 'h3', $for); $for = explode(' ', $for); foreach($for as $k => $v) $for[$k] = trim($v); $for = implode('|', $for); $anchors = array(); $value = $hanna->value; if(preg_match_all('{<(' . $for . ')[^>]*>(.+?)</\1>}i', $value, $matches)) { foreach($matches[1] as $key => $tag) { $text = $matches[2][$key]; $anchor = $sanitizer->pageName($text, true); $anchors[$anchor] = $text; $full = $matches[0][$key]; $value = str_replace($full, "<a name='$anchor' href='#'></a>$full", $value); } $hanna->value = $value; } if(count($anchors)) { echo "<ul class='jumplinks'>"; foreach($anchors as $anchor => $text) { echo "<li><a href='$page->url#$anchor'>$text</a></li>"; } echo "</ul>"; } else { echo ''; } @bernhard thanks, I prefer not to go the route of repeaters here, as I just want to write the article and use h2 and h3 headers and then let Hanna deal with it. But thanks for chiming in, much appreciated.
  9. OllieMackJames

    SOLVED - Thanks to @wbmnfktr for pointing out that this was already made possible with Hanna code, big thanks therefore to @ryan who even gave this as a working example of what could be done with Hanna code. Man this forum is awesome, this CMS is awesome, and now my site gets one step closer again to awesome for my visitors as well, thanks all! Leaving the original question below in case someone searches the forum for this exact same thing. ===========================original question below============================ I need a way to automate getting a table of contents on a really long page that I write. The sections on the page that need to end up in the TOC all have h2 headers. So I need the TOC module to loop through the page and take every instance of a h2 header and use that to buld the toc with clickable links to that particular h2 header Anybody have an idea how to do this? SOLVED
  10. OllieMackJames

    @Robin S thanks, much appreciated!
  11. OllieMackJames

    I am trying this out in a json-ld setting and running into some trouble. For json-ld I need the content of the whole article om any give page. On this particular site we build pages with different fields, including matrix repeater fields. 2 problems, I see lots of markup like h2, span etc in the output, and the matrix repeater fields are not taken into consideration at all. What I need is the unformatted output of all the individual fields, including from the repeater matrix to show up in a concatenated field. Thanks!
  12. OllieMackJames

    I like what you did with the homepage, asking people what they want to trade, and then based on their answer you show the next question etc. Can you perhaps explain how you did that? Nice work!
  13. OllieMackJames

    Thanks, that should get me going. Much appreciated!
  14. I have a site that exists since 2003, but has been on different platforms, html, modx and then processwire. And then on processwire we also migrated the site to a whole new design, which meant we started from scratch and imported some stuff. As a result my created and published dates are all over the place and not showing the history of the site. OK what is my question? How can I (re-)set the published and created dates for individual pages. Par example the homepage is created in 2003, but since the redesign of the site in 2015 proceswire now says the homewpage was created and published in 2015, but that is not true of course. Hence I want to set the created and published date back to the start of the site and then show the last modification to the page via datemodified. Anybody know how and where to set the published and created dates? Thanks.
  15. OllieMackJames

    @Robin S and I thought it couldn't get any better and now you improve it again! Just tested it and it works, THANKS.