def get_type_by_url

      return 'P' if params[:slug].blank?

      # split the url up into segments
      segments = params[:slug].split('/')

      # general variables
      url = params[:slug]
      article_url = Setting.get('articles_slug')
      category_url = Setting.get('category_slug')
      tag_url = Setting.get('tag_slug')

      status = "(post_status = 'Published' AND post_date <= CURRENT_TIMESTAMP AND disabled = 'N')"

      # HACK: this needs to be optimised
      
      # is it a article post or a page post
      if segments[0] == article_url
        if !segments[1].blank?
          if segments[1] == category_url || segments[1] == tag_url
            # render a category or tag page
            return 'CT'
          elsif segments[1].match(/\A\+?\d+(?:\.\d+)?\Z/)
            # render the archive page
            return 'AR'
          else
            # otherwise render a single article page
            return 'A'
          end
        else
          # render the overall all the articles
          return 'C'
        end

      else
        # render a page
        return 'P'
      end

    end
def get_type_by_url

      return 'P' if params[:slug].blank?

      # split the url up into segments
      segments = params[:slug].split('/')

      # general variables
      url = params[:slug]
      article_url = Setting.get('articles_slug')
      category_url = Setting.get('category_slug')
      tag_url = Setting.get('tag_slug')

      status = "(post_status = 'Published' AND post_date <= CURRENT_TIMESTAMP AND disabled = 'N')"

      # HACK: this needs to be optimised
      
      # is it a article post or a page post
      if segments[0] == article_url
        if !segments[1].blank?
          if segments[1] == category_url || segments[1] == tag_url
            # render a category or tag page
            return 'CT'
          elsif segments[1].match(/\A\+?\d+(?:\.\d+)?\Z/)
            # render the archive page
            return 'AR'
          else
            # otherwise render a single article page
            return 'A'
          end
        else
          # render the overall all the articles
          return 'C'
        end

      else
        # render a page
        return 'P'
      end

    end
def get_type_by_url return 'P' if params [ :slug ] . blank? # split the url up into segments segments = params [ :slug ] . split ( '/' ) # general variables url = params [ :slug ] article_url = Setting . get ( 'articles_slug' ) category_url = Setting . get ( 'category_slug' ) tag_url = Setting . get ( 'tag_slug' ) status = "(post_status = 'Published' AND post_date <= CURRENT_TIMESTAMP AND disabled = 'N')" # HACK: this needs to be optimised # is it a article post or a page post if segments [ 0 ] == article_url if ! segments [ 1 ] . blank? if segments [ 1 ] == category_url || segments [ 1 ] == tag_url # render a category or tag page return 'CT' elsif segments [ 1 ] . match ( / \A \+ \d \. \d \Z / ) # render the archive page return 'AR' else # otherwise render a single article page return 'A' end else # render the overall all the articles return 'C' end else # render a page return 'P' end end
returns that type of page that you are currenly viewing
returns that type of page that you are currenly viewing