Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8854109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:48:37+00:00 2026-06-14T13:48:37+00:00

I am working on a website using the Lithium framework for PHP, and I

  • 0

I am working on a website using the Lithium framework for PHP, and I need to have two sub-directories (ie. for admin and blog) with my controllers and views:

-controllers
  -admin
    HomeController.php
    ...
  -blog
    HomeController.php
    ...
  HomeController.php
  ...

-views
  -admin
    -home
      index.html.php
      ...
    ...
  -blog
    -home
      index.html.php
      ...
    ...
  -layouts
    default.html.php
    admin.html.php
    blog.html.php

So far, I have discovered the way to allow the use of sub-domains in the controller using the Dispach::config() method:

Dispatcher::config(array('rules' => array(
  'admin' => array('controller' => 'app\controllers\admin\{:controller}Controller'),
  'blog' => array('controller' => 'app\controllers\blog\{:controller}Controller'),
)));

This works when you use the following routing:

$options = array('continue' => true);

Router::connect('/admin', array(
  'admin' => true,
  'controller' => 'Home'
), $options);

Router::connect('/admin/{:args}', array(
  'admin' => true
), $options);

Router::connect('/blog', array(
  'blog' => true,
  'controller' => 'Home'
), $options);

Router::connect('/blog/{:args}', array(
  'blog' => true
), $options);

Now the problem I am having is that I can’t figure out how to set it to automatically use the admin/blog template and admin/blog view folders.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:48:38+00:00Added an answer on June 14, 2026 at 1:48 pm

    You could override default templates paths thanks to Media.
    The filter above sets different paths for admin requests (in config/bootstrap/media.php).

    Dispatcher::applyFilter('_callable', function($self, $params, $chain) {
      $next = $chain->next($self, $params, $chain);
    
      if ($params['request']->admin) {
    
        Media::type('default', null, array(
            'view' => 'lithium\template\View',
            'paths' => array(
                'layout' => '{:library}/views/layouts/{:layout}.{:type}.php',
                'template' => '{:library}/views/admin/{:controller}/{:template}.{:type}.php'
            )
        ));
      }
    
    return $next;
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am working on an e-commerce website using php. i have tried post/get and
So I have created a working comment system for my website using php and
I am integration Facebook connect in my website using php SDK.. Everything is working
I'm working on a website and have been using absolute positioning, since the viewport
A website I've been working on will not match data using a PHP (preg_match)
I'm working on my first website using php. I came up with a good
I'm creating a website using MVC framework (Yii) and I need to dynamically create
I am working on a website using a PHP script to display information formatted
I am working on a website using Smarty. I have searched the web to
I am working on a website using opencart and have it setup to automatically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.