HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Developers' Forum (
-   -   Extending/Restructuring of the "Theme-Engine" (

cfoe 14th May 2012 17:28

Extending/Restructuring of the "Theme-Engine"
Hi Devs,

I am developing a theme for ISPConfig 3.0.4.x ( with a higher impact on the layout than "just" the files in "themes/theme-name/".

I would propose a "little" change of the "theming-engine" which would make the ISPC-frontend more flexible and the file-structure more logical.

move template files
ISPC_WEB_PATH./themes/tmpl_var name="theme"/templates/$module/*
to not break all module files the class newTemplate must be changed to reflect the base-dir of
ISPC_WEB_PATH./themes/tmpl_var name="theme"/

What do you as experienced php-developers think about the complexity of this modification?

Would be great to not "hack" the template files of all modules for the new theme and by this breaking the default-theme.

falko 15th May 2012 16:24

First, that would require quote some work, so that change is a rather big one.

Second, if you want to modify a template, you have to do it once right now. With your proposal, you have to modify it for each theme.

I understand your point, but I'm not sure if this is a good idea.

cfoe 17th May 2012 20:11

I just thought a little bit more about the "problem".

In a module file e.g. dashboard/dashboard.php
loads the template-file from dashboard/templates/dashboard.htm

public function newTemplate($tmplfile)
"just" needs to add "(ISPC_WEB_PATH.)../themes/.$_SESSION['s']['theme']./" to the $tmplfile-var.

-> themes/*theme-name*/templates/dashboard.htm

In this case templates must be moved to the theme-folder but no modifications to modules are necessary.

till 18th May 2012 13:35

Modules in ISPConfig are self contianed, this means that they shall have their own templates folder for their web forms. These templates are not part of the theme as they should exist only once for all themes and dont contain theming information or styles, otherwise it would be nescessary to edit every theme when we add a new field to a web form.

Just an example:

If you maintain a theme for ispconfig were then you would have to change your theme for every new feature that we add in ispconfig or your theme will stop to work corrcetly. And you will have to maintain different versions of your theme for ecah ispconfig version, I dont think that this is what most users want.

Nevertheless we can add themes/*theme-name*/ to the paths were the template engine searches for files, but I'm not sure if this is a good idea as many users will start complaining here in the forum if they updated their ispconfig and it stops working then due to the fact that the theme does not support new features.

cfoe 18th May 2012 14:18


Originally Posted by till (Post 279245)
... dont contain theming information or styles ...

The files in *module*/templates/ are theme files which define structure by using fieldsets, divs, hr and other html tags.
For me all tags except for framing tags (like <li>) of data output should be considered theme. Especially <br> is totally killing themability -> not best practice.
The module provides vars for output in various formats used in the theme.

I hope you understand my critique the way it is intended. As constructive input. I am really interested in ISPC and just trying to help improve it.

Since I have not heard back from you after my mail to let me say that I would be happy to do the major work for this modification as long as someone else provides the mod for the php class(es).

Beside the modification I would like to smooth out the default theme. I found a lot of minor inconsistencies and errors in the template files while rebuilding them for my theme.

cfoe 18th June 2012 20:00

Till was so nice to implement a little hook ( to be release with 3.0.5 making it unnecessary to overwrite any template files of modules by custom themes.

Is it also working for dashlets?
I have another idea to make the themability one step better:
in the dashboard.php dashlets are assigned to one of 2 columns. How about scraping the columns and defining the position by css?
That would make it possible for custom modules to post dashlets to the dashboard without hacking the dashboard.php.

till 18th June 2012 20:08

It should work for any kind of files that are processed by the templating engine.


in the dashboard.php dashlets are assigned to one of 2 columns. How about scraping the columns and defining the position by css? That would make it possible for custom modules to post dashlets to the dashboard without hacking the dashboard.php.
The current dashboard system has to be improved, using css would be quite nice.

cfoe 27th June 2012 10:20

how about making the login module/page a lot more flexible by using themes/.$_SESSION['s']['theme']./templates/login.tpl.htm instead of main.tpl.htm for the login page?

till 27th June 2012 11:05

After login, only the menus and the content is loaded into the page with ajax. So if you have a main template for the login page that differs from the normal main template, you will not see the normal main template as it is not loaded at all.

cfoe 27th June 2012 11:36

That is not good. So it is really not easy changing the login. :(

Two remarks about your switch:
  1. I would propose a code change:
    PHP Code:

    if(isset($_SESSION['s']['module']['name']) && isset($_SESSION['s']['theme'])) {
    is_file(ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/'.$_SESSION['s']['module']['name'].'/templates/'.$filename)) {

    PHP Code:

    if(isset($_SESSION['s']['module']['name']) && isset($_SESSION['s']['theme'])) {
    is_file(ISPC_THEMES_PATH.'/'.$_SESSION['s']['theme'].'/templates/'.$_SESSION['s']['module']['name'].'/'.$filename)) {

    That would save a few folders.
  2. Dashlets do not work.

All times are GMT +2. The time now is 12:12.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.