class Public::HomeController < ApplicationController
  
  layout "home"
  
  def home
    
		@articles = Article.before(Date.today).recents

		@articles = @articles.page(params[:page]).per(4)
		
		
		@title = "Articles du blog"
    
  end
  
  def affiliation
    
    cookies.permanent[:mlm_token] = params[:mlm_token] if params[:mlm_token]
    @parent = Customer.find_parrain(params[:mlm_token]) if params[:mlm_token]
    
    if cookies[:mlm_token] and @parent = Customer.find_parrain(cookies[:mlm_token]) 
      
    
  
    end  
    
    
    @no_search = true
    render :layout => "public"
    
    
  end
  
  def redirect_affiliation
    redirect_to "http://sideplace.com/affiliation/"+params[:mlm_token].to_s
    
  end

end
