OllieMackJames

Members
  • Content Count

    281
  • Joined

  • Last visited

Community Reputation

114 Excellent

About OllieMackJames

  • Rank
    Distinguished Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

4,632 profile views
  1. OllieMackJames

    OK, solved, I copied the html to a file called nav.inc, then added this code to the template: <?php if ($page->landingpage !== 1) include ('nav.inc'); ?> That did the trick. Thanks
  2. OllieMackJames

    @dragan thanks, but I don't understand yet, I tried the following but then the front end throws errors. <?php if ($page->landingpage !== 1) echo ([ <!-- Top Navigation Bar --> <div class="site-nav"> <div id="navcontrol" class="logobanner centered original-nav"> <label for="navtoggle" class="navtoggle"><img src="/site/templates/img/logo.png" width="196" alt="logo" title="Menu Toggle" alt="Menu Toggle"><span class='menu-toggle-text'><?=$menu_title?></span></label> </div> <input type="checkbox" id="navtoggle"/> <div class="top"> <nav class="original-nav"> <div id="logoline" class="logobanner logobanner-original centered"> <a href='/'><img src="/site/templates/img/logo.png" width="<?=intval($config->navLogoWidth)?>" alt="logo" style="max-width:<?=intval($config->navLogoWidth)?>px"></a> </div> <ul class="menu"> <!--?= renderNav($page); ?--> </ul> </nav> </div> </div> ]);
  3. In my template I want to exclude some html based on a field being checked. The field landingpage is a checkbox field, and if it is checked I want to exclude the html below from showing up, how can I do that? Thanks! <?php if $page->landingpage=1; //If the checkbox field landingpage is checked I want to exclude the following html code: <!-- Top Navigation Bar --> <div class="site-nav"> <div id="navcontrol" class="logobanner centered original-nav"> <label for="navtoggle" class="navtoggle"><img src="/site/templates/img/logo.png" width="196" alt="logo" title="Menu Toggle" alt="Menu Toggle"><span class='menu-toggle-text'><?=$menu_title?></span></label> </div> <input type="checkbox" id="navtoggle"/> <div class="top"> <nav class="original-nav"> <div id="logoline" class="logobanner logobanner-original centered"> <a href='/'><img src="/site/templates/img/logo.png" width="<?=intval($config->navLogoWidth)?>" alt="logo" style="max-width:<?=intval($config->navLogoWidth)?>px"></a> </div> <ul class="menu"> <!--?= renderNav($page); ?--> </ul> </nav> </div> </div>
  4. 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;}
  5. 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!
  6. OllieMackJames

    @Zeka many thanks! Am now going to test this. @Soma moved, ok thanks
  7. 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
  8. 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!
  9. OllieMackJames

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

    Nice! Very interested in your padloper/mollie combination looking forward to your open sourcing of the payment module you built.
  11. 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.
  12. 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
  13. OllieMackJames

    @Robin S thanks, much appreciated!
  14. 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!
  15. 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!