Piwigo.org

You are not logged in. (Register / Login)

Announcement

#1 2010-03-07 18:51:31

VDigital
Former Piwigo Team
Location: Paris (FR)
Registered: 2005-05-04
Posts: 17680
Website

Template modeling

Tags: [Modeling]

On gallery side, the default template_dir is now an array.

If the template file exist as today in the template directory, no behaviour change.
But if the template file is missing...

The code checks in $themeconf['modeling'] the template model to use.

Case 1 - A new template called "newbe" as no .tpl files but in themeconf.inc.php
you have:
$themeconf['modeling'] = 'yoga';

=> all .tpl files (header.tpl, index.tpl, etc.) could be found in the yoga template.

Case 2 - A new template called "oldbe" as no .tpl files but in themeconf.inc.php
you DO NOT have:
$themeconf['modeling'] = 'yoga';

=> all .tpl files (header.tpl, index.tpl, etc.) could be found in the template-common/yoga/ directory.


Case 3 - A new template called "Advanced" as some .tpl files but in themeconf.inc.php
you have:
$themeconf['modeling'] = 'yoga';

=> .tpl files (header.tpl, index.tpl, etc.) could be found in the template/Advanced directory.
if not found (missing files)
=> .tpl files (header.tpl, index.tpl, etc.) could be found in the template/yoga directory.
if not
=> .tpl files (header.tpl, index.tpl, etc.) could be used if they are in the template-common/yoga/ directory.


New feature in trunk: [Subversion] r5071


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

Offline

#2 2010-03-09 00:52:16

plg
Piwigo Team
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11713
Website

Re: Template modeling

Hi VDigital,

By email, you have asked me to move current *.tpl files from template/yoga to template-common/yoga.

Are you sure it won't be more logic to just move them to template/default instead? (I would find this more "readable" in the directory organization) Tell me if there's something I'm missing.


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

#3 2010-03-09 07:33:21

VDigital
Former Piwigo Team
Location: Paris (FR)
Registered: 2005-05-04
Posts: 17680
Website

Re: Template modeling

My idea is to make a full copy into template-common (so people might remove yoga itself).
Distribute template/yoga/ with only frequent overridden .tpl , I mean:
- header.tpl
- picture_content.tpl
- mainpage_categories.tpl
- thumbnail.tpl

Ideally I would like a comment above each code:
{* Warning: This file is distributed as an example, core distributed tpl files are distributed in template-common/default/ *}


So I think you've reached and shared my full view on this feature.
;-)


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

Offline

#4 2010-03-09 08:54:18

plg
Piwigo Team
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11713
Website

Re: Template modeling

template-common/default is not good. Either we have *.tpl directly under template-common or we have template/default.

We only add "default" under template-common because there are other files in template-common.

I much prefer template/default


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

#5 2010-03-09 11:28:00

VDigital
Former Piwigo Team
Location: Paris (FR)
Registered: 2005-05-04
Posts: 17680
Website

Re: Template modeling

Do as you want, on that point.

I just recommend my last personnal conclusions after my personnal usage of it.

Personnaly, I dislike to see "default" in all template/theme selection boxes.
That one of reasons I recommended to locate it in template-common.


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

Offline

#6 2010-03-09 11:33:01

plg
Piwigo Team
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11713
Website

Re: Template modeling

VDigital wrote:

Personnaly, I dislike to see "default" in all template/theme selection boxes.

Of course, template/default won't be seen in the theme selection : 1) there is no theme in template/default, right? 2) we can filter the list

I don't say "rename yoga to default". I say "move template/yoga/*.tpl" to "template/default/". The themes stay in yoga/theme


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

#7 2010-03-09 17:27:47

VDigital
Former Piwigo Team
Location: Paris (FR)
Registered: 2005-05-04
Posts: 17680
Website

Re: Template modeling

Then please move *.tpl from yoga to default.

Do as you want, I wrote. No problem on my side.
;-)


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

Offline

#8 2010-03-09 21:20:07

plg
Piwigo Team
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11713
Website

Re: Template modeling

VDigital wrote:

Then please move *.tpl from yoga to default.

Job's done. It works like a charm. I think it's really a nice technical improvement and I hope it will increase template designer happiness :-)


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

#9 2010-03-09 21:57:47

VDigital
Former Piwigo Team
Location: Paris (FR)
Registered: 2005-05-04
Posts: 17680
Website

Re: Template modeling

Yes.

Following the logic of template/distributed/,
could you explain why template-common is not in template/distributed/ then
and why template-extension is not a subdirectory template/extension/ ?

Because if I want to have a template called extension I can't.
So if I want to have my own template called distributed, could I do it?
Anyway it is fine to me.

;-)

Last edited by VDigital (2010-03-09 22:02:21)


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

Offline

#10 2010-03-09 22:05:48

plg
Piwigo Team
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11713
Website

Re: Template modeling

I don't understand why you ask these questions once I did the move while you said 2 posts above : No problem on my side


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

#11 2010-03-10 00:09:53

VDigital
Former Piwigo Team
Location: Paris (FR)
Registered: 2005-05-04
Posts: 17680
Website

Re: Template modeling

You were so convinced you were right.

template-common and template-extension have been created by Chrisaga and at that time you didn't tell us any remark to move them in template.

Please consider now these basic questions. And do as you want.


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

Offline

#12 2010-03-10 06:20:24

rvelices
Piwigo Team
Registered: 2005-12-29
Posts: 1553
Website

Re: Template modeling

VDigital,
I'm concerned a bit about performance.
My web site (as most of them) use a very slow disk (NAS like). I had some gained by putting $conf['template_compile_check'] = false; (by putting this line we don't check the file modification time of the original .tpl)
With your system I have the feeling (not sure) that you are going to check the existence of the tpl in several directories ... Can you take this issue into account please ?

Tks

Offline

#13 2010-03-10 07:38:01

VDigital
Former Piwigo Team
Location: Paris (FR)
Registered: 2005-05-04
Posts: 17680
Website

Re: Template modeling

Yes, I already thought on that case.
I suggest a new option.

if (!defined('IN_ADMIN') and ($conf['modeling']==true  or !isset($conf['modeling'])) )

Then your personal template must be exhaustive if your turn it false.

Is that solution suit you?


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

Offline

#14 2010-03-10 11:42:14

plg
Piwigo Team
Location: Paris, France, Europe
Registered: 2002-04-05
Posts: 11713
Website

Re: Template modeling

VDigital wrote:

if (!defined('IN_ADMIN') and ($conf['modeling']==true  or !isset($conf['modeling'])) )

Then your personal template must be exhaustive if your turn it false.

Is that solution suit you?

As far as I understand, the webmaster can't choose to activate template_modeling or not. It's a template property. If you use yoga, you already use template modeling.

Beyond rvelices (who has enough technical skills to compute a template), forcing the user to have its "personnal" template is not possible.

To solve the potential performance issue for low disk hosting, couldn't we have a "cache" of the location of each tpl file for a given template instead?


Latest blog post on Piwigo.com: Piwigo 2.5 on Piwigo.com (March 7th, 2013)

Offline

#15 2010-03-10 14:39:38

VDigital
Former Piwigo Team
Location: Paris (FR)
Registered: 2005-05-04
Posts: 17680
Website

Re: Template modeling

First, we already have a cache.
Next, rvelices implemented a check on realpath to detect any change.
More, a standard cache process exists in Smarty and detect any file change or directory change.
(If I read well on Smarty website).
Moreover, you really need 3/4 tpl files (most used) in your template to keep at level your performance.

Finally, I think we can code (a better way than my previous proposal):
$modeling = get_themeconf('modeling');
if (!defined('IN_ADMIN') and ($modeling !== false) )


So if $themeconf['modeling'] is not set or set with a model we will take advantages of modeling.
If $themeconf['modeling']===false we will keep advantage of old behavior/performance (but its constraint is to have of all .tpl files available in the template directory).

;-)


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

Offline

Board footer

Powered by FluxBB

About this website · Donate · Contact Piwigo project © 2002-2013