Create a Page Gate Follow

Live Example: http://labs.topspin.net/tutorials/pa...ate--runme.php

Page Gate Code:  http://labs.topspin.net/tutorials/pa...agegate-v1.zip

The code includes two files, detailed below. There are two libraries required for the code to work properly: jQuery and the Topspin core javsascript library. A link to a Google-hosted copy of jQuery is included in the code. You can remove this link if the page already includes jQuery elsewhere. The Topspin core javascript library will need to be linked separately. 

If you set up a page gate and would like to have a login button on your page without the pop-up loading on load, you can use the following JavaScript: http://labs.topspin.net/tutorials/pagegate/pageGate--norun.php 

* pageGate--runme.php


This is the sample PHP page with the Javascript code that goes on the page that's going to have the page gate. There are four variables at the top of the code that must be customized: "art" is the Artist ID, "camp" is the array of valid campaign IDs that will be accepted, "checkUrl" is the URL pointing to the PHP authorization script (in this case, the URL of pageGateAuth.php), and "contentSelector" is the CSS selector for the object that's going to contain the HTML code being returned by the authorization script. 

To create a campaign id for the var "camp": 

1) Create membership product

2) Create buy button: A) Set Access Requirement to the membership created in step 1. B) set the price to $0 and C) set the buy button to buy an image or other digital item in your catalog. Save. The Campaign ID is the var "camp". (You are setting up this buy button to create a gated campaign ID, and not to sell an item -- we will eventually have a way to create campaign IDs, similar to buy buttons, that are associated with gated products. (The aforementioned is a work-around until then.)

 

* pageGateAuth.php


This is the PHP authorization script. This small script has two customizable variables at the top of the script: "valid_domain" is the domain (only the domain, the part ending with ".com", is read), and "html" is, of course, where the HTML that's meant to be visible to valid users goes. Any single quotes in the HTML *must* be escaped with a backslash ("\") before them, or the script will fail.

 

Have more questions? Submit a request and our team will be able to help get you sorted.
Powered by Zendesk