•  » Engine
  •  » Completely remove HTML from PHP scripts

#1 2009-03-05 00:57:31

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

Completely remove HTML from PHP scripts

After [Bugtracker] ticket 929 submission, P@t has written:

I propose to remove (step by step) all functions in library functions_html.inc.php

Thanks to Smarty, I think this library should disappear and it will simplify customization thanks to template extensions.

In my crusade, first step is to remove get_html_menu_category

Offline

 

#2 2009-03-05 00:59:28

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

Re: Completely remove HTML from PHP scripts

I think you're perfectly right P@t and when I read the Smarty code you wrote to replace get_html_menu_category PHP function, I really think you took the right decision!

I think this change will make [extension by rvelices] RV Menutree simpler to code, don't you think rvelices?

Offline

 

#3 2009-03-05 01:21:27

rvelices
Former Piwigo Team
2005-12-29
1960

Re: Completely remove HTML from PHP scripts

I would say yes and no because moving complex php code (such as menu category) into smarty is just rewriting it in "pseudo" php which will make it less readable, less performant (usually because of the restrictions in smarty) and theme dependent ...

Note that if you start calling pwg functions from the template (which is perfectly feasible and it will probably happen) - it will just make things difficult for developers; not to talk about people who develop new themes

Offline

 

#4 2009-03-05 01:41:25

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

Re: Completely remove HTML from PHP scripts

rvelices wrote:

I would say yes and no because moving complex php code (such as menu category) into smarty is just rewriting it in "pseudo" php which will make it less readable, less performant (usually because of the restrictions in smarty) and theme dependent ...

I don't think that new smarty code for menu category is really complex... I don't find it less readable than older php code (I'd like to say more readable!)
In the future, I'd like to create complex javascript template like smugmug... and for that, I think it's a good thing to remove all html code from php files.

rvelices wrote:

Note that if you start calling pwg functions from the template (which is perfectly feasible and it will probably happen) - it will just make things difficult for developers; not to talk about people who develop new themes

I know... but for menu category, I only use smarty functions (assign and if/else), and only one php function (str_repeat).
I think that it prove we can code "complex php code" in smarty with few things...


P@t

Offline

 

#5 2009-03-05 04:02:16

rvelices
Former Piwigo Team
2005-12-29
1960

Re: Completely remove HTML from PHP scripts

In fact your last commit is not bad at all or ... rather really good :-)

I like the result - it is pretty simple indeed.

Offline

 

#6 2009-03-05 07:05:10

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

Re: Completely remove HTML from PHP scripts

The HTLM chasing is open.

It will be nicer after. But you did the blocking point.


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

Offline

 

#7 2009-03-05 22:36:43

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

Re: Completely remove HTML from PHP scripts

rvelices wrote:

In fact your last commit is not bad at all or ... rather really good :-)

I like the result - it is pretty simple indeed.

Thanks!

[Subversion] r3172
I created a navigation_bar.tpl file... and move create_navigation_bar function to functions.inc.php

Last edited by P@t (2009-03-05 22:37:06)


P@t

Offline

 
  •  » Engine
  •  » Completely remove HTML from PHP scripts

Board footer

Powered by FluxBB