2017 © Pedro Peláez
 

silverstripe-module continental-content

Lets you add contents for different continents

image

silverstripers/continental-content

Lets you add contents for different continents

  • Friday, September 29, 2017
  • by silverstripers
  • Repository
  • 1 Watchers
  • 1 Stars
  • 45 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Continental Content Module

A SilverStripe module which allows you to have contents specific for locations, and serve these contents for users by checking their location., (*1)

Installing

Use composer to install the module., (*2)

composer require silverstripers/continental-content dev-master, (*3)

Configuring

After installing the module on your SilverStripe site, you have to manually specify which data objects you want the module to decorate with in order to have different contents., (*4)

SiteTree:
  extensions:
    - ContinentalContent

You have the freedom to decorate any object, in this YAML i am decorating the SiteTree object, which is the base object of SilverStripe pages., (*5)

Setting up location

Once you've done the above you can set up the locations which you want to have different contents for., (*6)

ContinentalContent:
  continents:
    BC:
      Country: CA
      SubDivision: BC
    AB:
      Country: CA
      SubDivision: AB
    ON:
      Country: CA
      SubDivision: ON

If you want to use contents for a group of location then you can group them by., (*7)

ContinentalContent:
  continents:
    Europe:
      Country:
        - GB
        - GE
        - FR
    NZ:
        Country: NZ
    AU:
        Country: AU

In this example Europe will be used for GB, GE, FR countries., (*8)

What if you dont want to have multiple fields

If there are fields which you dont wish to customise for each of the locations, you can specify them as configs, (*9)

ContinentalContent:
  exclude_field_names:
    - SiteTree.Title
    - URLSegment

The above removes URLSegment from any of the data objects you have a field called URLSegment, but it removes Title only from SiteTree., (*10)

Seperate URLS

If you want to have separate urls for each location eg: site.com/uk/home, site.com/nz/home etc. You can allow that with another config., (*11)

ContinentalContent:
  custom_urls: 'Y'

Webserver cant read the visitors IP ? (Higher Level Customizations)

Sometimes this can happen, if you are using several load balancers to and have your website behind them and your load balancers wont pass the end clients IP. In this can use can set up a form and ask your users to select the location they are coming from., (*12)

ContinentalContent:
  proxy_ip: '0.0.0.0'

set up the IP which your webserver gets all the time., (*13)

make a function like the following in Page_Controller class., (*14)

function LocationDetected(){
  return !(ContinentalContent::IsViewingThroughProxy() && ContinentalContent::CurrentContinent() == CONTINENTAL_DEFAULT);
}

If the above returns true you can draw a location selector to select the visitor's location., (*15)

Setting up IP database

The module only supports max mind, upload the max mind City data base from the site config., (*16)

Debug options

There are several options to debug the configs. You can pass three get vars, (*17)

  1. FAKE_IP -- fake the ip address
  2. CLEAR_IP -- clear the ip from the session
  3. debug_location -- Displays a debug message on screen for the locations.

The Versions

29/09 2017

dev-master

9999999-dev

Lets you add contents for different continents

  Sources   Download

BSD-3-Clause

The Requires

 

by Nivanka Fonseka

silverstripe contents ip2location continental iptolocation

29/09 2017

1.0.1-RC1

1.0.1.0-RC1

Lets you add contents for different continents

  Sources   Download

BSD-3-Clause

The Requires

 

by Nivanka Fonseka

silverstripe contents ip2location continental iptolocation

29/09 2017

1.0.1

1.0.1.0

Lets you add contents for different continents

  Sources   Download

BSD-3-Clause

The Requires

 

by Nivanka Fonseka

silverstripe contents ip2location continental iptolocation

28/12 2016

1.0.0

1.0.0.0

Lets you add contents for different continents

  Sources   Download

BSD-3-Clause

The Requires

 

by Nivanka Fonseka

silverstripe contents ip2location continental iptolocation