Announcement

  •  » Engine
  •  » New architecture for themes

#31 2010-03-17 14:54:48

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: New architecture for themes

flop25 wrote:

Now to talk about "le fond du probleme" :
I don't think that the new system is bad because it does not take into account of local css : as it was said, we can do it with plugins or maybe a futur feature

That can be solve with a small code review. It is far from a blocker.
I will try some new php lines asap to integrate local css (global and/or specific changes).

;-)


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#32 2010-03-18 07:16:00

rub
Former Piwigo Team
Lille
2005-08-26
5019

Re: New architecture for themes

[Forum, post 112392 by rub in topic 14925] [evolution] Management of the template/theme

rub wrote:

What's happen when I install a theme T2 inherited from T1 but T1 is not installed or activated?

An error is raised? Theme try to work like this?

Last edited by rub (2010-03-18 07:16:34)

Offline

 

#33 2010-03-18 20:21:34

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: New architecture for themes

rvelices, I've seen you [Subversion] r5177.

So I think you have studied the new architecture, and I suppose you feel concerned the same way about multiple "is_file" for finding the right template. I'll discuss with P@t about this issue.

Offline

 

#34 2010-03-18 20:37:20

rvelices
Former Piwigo Team
2005-12-29
1960

Re: New architecture for themes

plg wrote:

So I think you have studied the new architecture, and I suppose you feel concerned the same way about multiple "is_file" for finding the right template. I'll discuss with P@t about this issue.

Yes there is a performance issue. However I find the solution elegant and I think it will generate quite some themes (partial ones) on the PEM.
As for my site - I think I will just duplicate default+dark into "mytheme" so there will be no parent theme ...

Offline

 

#35 2010-03-18 20:39:00

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: New architecture for themes

rvelices wrote:

However I find the solution elegant and I think it will generate quite some themes (partial ones) on the PEM.

Happy to read this point of view :-)

rvelices wrote:

As for my site - I think I will just duplicate default+dark into "mytheme" so there will be no parent theme ...

mytheme will have "default" as parent.

Offline

 

#36 2010-03-18 20:44:59

rvelices
Former Piwigo Team
2005-12-29
1960

Re: New architecture for themes

But still I find annoying the missing local-layout. My thumbs are 150x150 and they do not show up correctly in the user view nor in the admin theme -> I will have to make 2 changes ...

Offline

 

#37 2010-03-19 12:10:36

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: New architecture for themes

rvelices wrote:

But still I find annoying the missing local-layout. My thumbs are 150x150 and they do not show up correctly in the user view nor in the admin theme -> I will have to make 2 changes ...

Two possibilities for the common local-layout.css:

- We can have the common local-layout.css at the root of themes directory.
- We can have a "Local layout" tab in themes admin pannel, with a big textarea (like LocalFiles Editor) where the user can write his own css rules (saved in config table)

For local-layout.css of each theme, we can keep them, but I don't like the idea...

PS: thanks for the corrections on template.class.php (I didn't understand why $theme could be empty... now I do!)

PS2: there is no performance issues with template modeling.
file_exists function is called only first time, after, cache files are used.
Example, select clear theme, and go on home page. Then, create template directory in clear theme, and create index.tpl file with modifications. Reload home page: changes are not effective until you purge compiled templates.


P@t

Offline

 

#38 2010-03-19 13:03:43

rvelices
Former Piwigo Team
2005-12-29
1960

Re: New architecture for themes

P@t wrote:

PS2: there is no performance issues with template modeling.
file_exists function is called only first time, after, cache files are used.
Example, select clear theme, and go on home page. Then, create template directory in clear theme, and create index.tpl file with modifications. Reload home page: changes are not effective until you purge compiled templates.

Well... I didn't try it but if the described behaviour is yours, then it is perfect...

By the way, a small change wouls be required .... in header.tpl we link the css to ...{$theme.name}/theme.css

I would rather have {$theme.id}/theme.css . $theme.id would be automatically generated from the directory name ...

We should keep the name (if required) only for user display choices. Like this we would have the same things as for the plugins: id=directory, name=whatever you like ...

Offline

 

#39 2010-03-19 13:11:05

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: New architecture for themes

rvelices wrote:

I would rather have {$theme.id}/theme.css . $theme.id would be automatically generated from the directory name ...

You're right. As a consequence to grum's request, I've made a difference between the theme.id (the directory name) and the theme.name (whatever you want, it is displayed in the "select your interface theme" listbox), this way grum can have theme.id=gally-grum-dark-2 and theme.name = "Gally with the superb Grum Dark, release 2"

Offline

 

#40 2010-03-19 14:31:06

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: New architecture for themes

rvelices wrote:

I would rather have {$theme.id}/theme.css . $theme.id would be automatically generated from the directory name ...

Done, in [Subversion] r5190

Offline

 

#41 2010-03-19 14:38:51

VDigital
Former Piwigo Team
Paris (FR)
2005-05-04
17680

Re: New architecture for themes

P@t wrote:

rvelices wrote:

But still I find annoying the missing local-layout. My thumbs are 150x150 and they do not show up correctly in the user view nor in the admin theme -> I will have to make 2 changes ...

Two possibilities for the common local-layout.css:

- We can have the common local-layout.css at the root of themes directory.
- We can have a "Local layout" tab in themes admin pannel, with a big textarea (like LocalFiles Editor) where the user can write his own css rules (saved in config table)

For local-layout.css of each theme, we can keep them, but I don't like the idea...

PS: thanks for the corrections on template.class.php (I didn't understand why $theme could be empty... now I do!)

PS2: there is no performance issues with template modeling.
file_exists function is called only first time, after, cache files are used.
Example, select clear theme, and go on home page. Then, create template directory in clear theme, and create index.tpl file with modifications. Reload home page: changes are not effective until you purge compiled templates.

May I suggest optional files:
local/rules.css (for all themes)
local/clear-rules.css
local/dark-rules.css
local/Sylvia-rules.css
...
This could be extended later to include languages, and all local files.

So they are in single directory out of all distributed packages.


On PS2: It's perfect!


Piwigo.com: Start and run your own photo gallery. Signup and get 30 days to try for free, no commitment.
8-)

Offline

 

#42 2010-03-19 14:57:07

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: New architecture for themes

VDigital wrote:

May I suggest optional files:
local/rules.css (for all themes)
local/clear-rules.css
local/dark-rules.css
local/Sylvia-rules.css
...
This could be extended later to include languages, and all local files.

So they are in single directory out of all distributed packages.

YES. Really good. P@t told me he was implementing it.

Offline

 

#43 2010-03-19 15:54:45

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: New architecture for themes

Great idea VDigital...
There is only one problem:

- If css load is hard coded in header.tpl, this can make apache errors on servers.
- If we use file_exists to load css, there will be performance issues.

Here what I purpose: use prefilter.

Code:

if ( !empty($theme) )
{
  $this->set_theme($root, $theme, $path);
  $this->set_prefilter( 'header', array('Template', 'prefilter_local_css') );
}

Code:

static function prefilter_local_css($source, &$smarty)
{
  global $conf;

  $root = get_root_url();
  $css = array();

  foreach ($smarty->get_template_vars('themes') as $theme)
  {
    if (file_exists($root.$conf['local_dir'].'/'.$theme['id'].'-rules.css'))
    {
      array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}'.$conf['local_dir'].'/'.$theme['id'].'-rules.css">');
    }
  }
  if (file_exists($root.$conf['local_dir'].'/rules.css'))
  {
    array_push($css, '<link rel="stylesheet" type="text/css" href="{$ROOT_URL}'.$conf['local_dir'].'/rules.css">');
  }

  if (!empty($css))
  {
    $source = str_replace("\n</head>", "\n".implode( "\n", $css )."\n</head>", $source);
  }

  return $source;
}

file_exists is used once with prefilter... what do you think about that?


P@t

Offline

 

#44 2010-03-19 17:47:53

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: New architecture for themes

local directory could be like that:

Code:

local
|
|-- css
|   |-- rules.css
|   |-- clear-rules.css
|   `-- dark-rules.css
|
|-- language
|   |
|   |-- fr_FR
|   |   `-- local.lang.php
|   |-- en_EN
|       `-- local.lang.php
|
|-- config_database.inc.php
`-- config_local.inc.php

During next upgrades, users will have to be careful with local directory only...
Upgrade will be much easier.

Thanks VDigital for this great idea...


P@t

Offline

 

#45 2010-03-19 17:49:52

tosca
Former Piwigo Team
Cévennes (France)
2006-09-23
567

Re: New architecture for themes

P@t wrote:

During next upgrades, users will have to be careful with local directory only...
Upgrade will be much easier.

Thanks VDigital for this great idea...

+1


My galleries : Photos, Watercolours, Recipes

Offline

 
  •  » Engine
  •  » New architecture for themes

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact