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 8526751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:21:44+00:00 2026-06-11T08:21:44+00:00

have on question about the Zend Framework 2. In my Application i have a

  • 0

have on question about the Zend Framework 2.
In my Application i have a module whiche handles my whole Application.

For further improvements i want to develop a Theme Manager.

The Theme Manager should work with url params like ?theme = lightTheme.
The Themes are organized in a Folder “templates” somewehere outside the Module.
The Themes should also include the view scripts.

As far as i know from reading some ZF2 documentations it could be achieved with some Listener Events.

Does anybody did that alright or can give me some example how ich can solve this requirement ?

  • 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-11T08:21:45+00:00Added an answer on June 11, 2026 at 8:21 am

    I think this pattern could work…

    themes folder structure

    /path/to/themes
    /path/to/themes/some_theme
    /path/to/themes/some_theme/layout.phtml
    /path/to/themes/another_theme
    /path/to/themes/another_theme/layout.phtml
    

    config/module.config.php

    return array(
        'view_manager' => array(
            'template_path_stack' => array(
                '/path/to/themes',
            ),
        ),
    );
    

    Module.php

    namespace Something;
    
    class Module
    {
        public function onBootstrap(\Zend\EventManager\EventInterface $e)
        {
            $application = $e->getApplication();
            $em = $application->getEventManager();
            $em->attach('route', function($e) {
    
                // decide which theme to use by get parameter
                // $layout = 'some_theme/layout';
                // $layout = 'another_theme/layout';
                $e->getViewModel()->setTemplate($layout);
            });
        }
    }
    

    // edit: changed to use the route event instead of controllerLoader

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several question about integrating integrating Doctrine 2.2 & Zend framework. I know
The question is about the router's setDispatched() method of Zend Framework... I have a
I have a question about the Zend Framework 2, can some one provide an
I have a application built on Zend Framework I am trying to optimize. I
Zend Framework 2 + Doctrine 2 Refering to this question, I have a simple
I have question about python and sqlite3. I want to drop a table from
I have been using the Zend Framework with an MVC configuration, read about Ruby
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all

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.