Git Product home page Git Product logo

silverstripers-continental-content's Introduction

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.

Installing

Use composer to install the module.

composer require silverstripers/continental-content dev-master

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.

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.

Setting up location

Once you've done the above you can set up the locations which you want to have different contents for.

ContinentalContent:
  continents:
    - Gb
    - NZ
    - AU

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.

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.

ContinentalContent:
  proxy_ip: '0.0.0.0'

set up the IP which your webserver gets all the time.

make a function like the following in Page_Controller class.

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.

Setting up IP database

The module can use three types of database to detect a user's location. It can use one of these three data feeds.

http://dev.maxmind.com/geoip/legacy/geolite/ http://lite.ip2location.com/ https://db-ip.com/db/

visit yoursite.com/dev/tasks and you will get three build task options to import data from the feeds, and those contains further instructions on downloading the feeds etc.

silverstripers-continental-content's People

Contributors

fonsekaean avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.