Guidelines for managing multiple specialized versions of a single application

I have a web application that has many faces, and so far I have implemented this by creating themes. A theme is a collection of html, css and images that will be used with a common back end.

They are done like this:

code/
themes/theme1
themes/theme2

And each instance of the web application has a configuration file that indicates which theme should be used. Example:

theme="theme1"

Now the new business rules are asking me to make changes to certain topics that cannot be achieved by simply changing the html / css / images and requiring a change to the backend. In some cases, these changes need to be applied to a topic group.

, , . , - .

, :

code/common
code/theme1
code/theme2
themes/theme1
themes/theme2

, include_path , code/theme1, code/common.

, , LogoutPage class theme2, code/common code/theme2 .

, . , .

, ? Theme1LogoutPage extends LogoutPage. , , - (, ) LogoutPage. , , ?

, , , , .

, , , , .

. - , LAMP.

+3
6

. ... , - .
.

+1

Strategy . Factory, . , . Factory, , . ( ) , .

( , #)

public interface ILogoutStrategy
{
   void Logout();
}

public abstract class AbstractLogoutStrategy : ILogoutStrategy
{
   public virtual void Logout()
   {
      // kill the sesssion
   }
}

public class SingleSiteLogoutStrategy : AbstractLogoutStrategy
{
   public void Logout()
   {
      base.Logout();
      // redirect somewhere
   }
}

public class CentralAuthenticationSystemLogoutStrategy : AbstractLogoutStrategy
{
   public void Logout()
   {
      base.Logout();
      // send a logout request to the CAS
      // redirect somewhere
   }
}

public static class StrategyFactory
{
   public ILogoutStrategy GetLogoutStrategy(Configuration config)
   {
      switch (config.Mode)
      {
         case Mode.CAS:
            return new CentralAuthenticationSystemLogoutStrategy();
            break;
         default:
         case Mode.SingleSite:
           return new SingleSiteLogoutStrategy();
           break;

      }
   }
}

:

ILogoutStrategy logoutStrategy = StrategyFactory.GetLogoutStrategy( config );
logoutStrategy.Logout();
+1

-? , . , Injection Dependency. Spring.NET ..

0

.

.

smarty . PEAR template_it.

http://www.smarty.net/

. , html php php html.

, , html, . .

0

:   //

:   /_/

/common/code . /common/code - /sitename/code, INHERITS /common/code.

CHANGES /sitename/code , /common/code

- . , , / .

0

:

[topic name] / [subfolder] by default / general by default / general / HTML by default / general / CSS red / code red / general red / general / html red / general / CSS red / code green / general green / general / html

So, if the code or some other component does not exist, it will revert to default.

But in fact, I would fork the website in svn, so that general code, if it develops, I can merge it, etc. see Subversion at: http://subversion.tigris.org/

0
source

Source: https://habr.com/ru/post/1698840/


All Articles