Jump to content

Zeka

Members
  • Posts

    1,065
  • Joined

  • Last visited

  • Days Won

    11

Posts posted by Zeka

  1. Hi.

    I can't figurate out is it a bug or I miss something 

    $selector = '(template=catalog_category|product), (id=1430|1530|1443|1528|1442|1441|1440|1527|1529|1439|1438|1437|1436|1531|1523|1522|1435|1433|1434)';
    $some_pages = $pages->find($selector);
    $some_pages->has('id=1417') // true

    Then on the page with ID 1417

    $page->matches($selector) // false

    As you can see that the page with ID 1417 is found by the selector, but do not match it.

  2. Hi.

    In different modules, I have seen these two ways how default data is set

    	static public function getDefaultData()
    	{
    		return array(
    			"test" => "test"
    		);
    	}
    
    	// first way
    	public function __construct()
    	{
    		foreach (self::getDefaultData() as $key => $value) {
    			$this->$key = $value;
    		}
    	}
    
    	// second way
    		public function __construct()
    	{
    		foreach (self::getDefaultData() as $key => $value) {
    			$this->set($key, value);
    		}
    	}

    Could somebody please explain what is the difference between them? 

  3. 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->page2use4homepageoption1;
    	elseif:
    		$page = $page->page2use4homepageoption2;

     

    • Like 1
  4. @OllieMackJames

    Measure clicks to "Call to action" buttons you can by using Google Analytics Events. 

    There an example of simple A\B testing plugin from Kirby's forum https://getkirby.com/docs/cookbook/a-b-testing. It would be easy to rewrite it for Processwire. 

    If you want to do some kind of AB testing than you should also take care of returned visitors as they should see the same version of the page that they saw on the first visit.  

    • Like 4
×
×
  • Create New...