Jump to content



Photo
- - - - -

Template Engine Functionality Proposal


  • Please log in to reply
68 replies to this topic

#21   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 4,897 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 10 March 2012 - 19:06

Hi Laurent..

I will look into it on Sunday.

Kind regards,
Harald Ponce de Leon

#22   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 4,897 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 11 March 2012 - 13:55

Hi Laurent..

Does the following commit help you move forward?

https://github.com/h...d19a241c3a66504

Kind regards,
Harald Ponce de Leon

#23   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 11 March 2012 - 15:33

Hi harald,

i get an issue :

PHP Fatal error: Namespace declaration statement has to be the very first statement in the script in \osCommerce\OM\Core\Site\Admin\Controller.php on line 9


Edited by foxp2, 11 March 2012 - 15:46.

-------------------

#24   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 11 March 2012 - 15:51

lol, i've found ... have a space before the firts <?php tag ...
i confirm, it works like a charm.
thanks for your help.
Kind regards,
-------------------

#25   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 12 March 2012 - 14:04

Hi harald,

there are problems with your template engine ...
before this new structure, to customize a core source file was very easy.
example (for Dashboard) : https://github.com/f...ation/Dashboard

but if i change protected $_default_template in \osCommerce\OM\Core\Site\Admin\Template.php with 'Sail', your template engine doesn't work (normal, Custom Core File having priority in accordance with loading) /sick.gif' class='bbc_emoticon' alt=':x' />

now, if i move my Custom/Site/Admin -> Custom/Site/Admin/Template/kendo/ ... only \osCommerce\OM\Custom\Site\Admin\Template\kendo\Application\Dashboard\pages\main.php ... /wacko.png' class='bbc_emoticon' alt=':wacko:' />

what you think about it ?
have you really tested your framework in differents scenarios ?

Perhaps you could clarify that for me.

Thanks.

Kind regards.
-------------------

#26   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 4,897 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 12 March 2012 - 15:46

Hi Laurent..

It would be perfect if the Custom classes could extend the Core classes however this is not possible so Custom classes are called in preference over Core classes.

I don't know why you have a custom Admin\Controller and still want to make changes to the core version? Why not apply those changes to the custom version?

What doesn't work when you change $_default_template? Can you provide example code of what you are referring to?

Kind regards,
Harald Ponce de Leon

#27   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 12 March 2012 - 16:39

ok, in this case, what for this code ?
	  $OSCOM_DL = new DirectoryListing(OSCOM::BASE_DIRECTORY . 'Custom/Site/' . OSCOM::getSite() . '/Template');
	  $OSCOM_DL->setIncludeFiles(false);
	  $OSCOM_DL->setIncludeDirectories(true);
	  foreach ( $OSCOM_DL->getFiles() as $file ) {
	
	    if ( !in_array($file['name'], $templates) ) {
		  $templates[] = $file['name'];
	    }
	  }

-------------------

#28   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 4,897 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 12 March 2012 - 16:57

Hi Laurent..

That's where your KendoUI template should exist:

Custom/Site/Admin/Template/KendoUI

I see in your github repo it's at:

Core/Site/Admin/Template/kendo

Can you move this to the custom namespace?

Kind regards,
Harald Ponce de Leon

#29   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 12 March 2012 - 17:16

I must admit that I fail to see logic in your template engine.
for me , Core/Site/Admin/Template/kendo is only for HTML Views. (i've just changed base.html to call kendo UI lib)
I work in the same namespace in my osCommerce / OM / Custom / Site / Admin.

Edited by foxp2, 12 March 2012 - 17:19.

-------------------

#30   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 4,897 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 12 March 2012 - 17:18

Hi Laurent..

The KendoUI template should not be in the Core namespace. Try moving it to the Custom namespace. All of your changes should be in the Custom namespace.

Kind regards,
Harald Ponce de Leon

#31   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 12 March 2012 - 17:25

but why we have osCommerce / OM / Core / Site / Admin / Template / Sail ?
with this namespace :
namespace osCommerce\OM\Core\Site\Admin\Template\Sail;

Edited by foxp2, 12 March 2012 - 17:26.

-------------------

#32   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 4,897 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 12 March 2012 - 17:36

Hi Laurent..

Sail is the default template and is part of the core framework :)

Try moving all of your changes to the Custom namespace and see the possibilities of extending the framework without the need to edit 1 line in the Core namespace.

Beautiful, or not?

The classes in the Custom namespace must still be defined in the Core namespace, eg:

File: osCommerce/OM/Custom/Site/Admin/Template/KendoUI/Controller.php:

namespace osCommerce\OM\Core\Site\Admin\Template\KendoUI;

not:


namespace osCommerce\OM\Custom\Site\Admin\Template\KendoUI;

This is described here:

https://github.com/f...M/Custom/README

Kind regards,
Harald Ponce de Leon

#33   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 12 March 2012 - 17:49

yes, but in the last email, you wrote :

This is an initial commit that still needs to be worked on and also to
be cleaned up. If you create the following:
Site/Admin/Template/KendoUI/Content/base.html (wrapper)
Site/Admin/Template/KendoUI/Application/Login/pages/main.html
Site/Admin/Template/KendoUI/Application/Configuration/pages/*
You will then be able to implement a KendoUI template as an add-on
that does not duplicate any PHP code from the core.


and now, i read :

That's where your KendoUI template should exist:

Custom/Site/Admin/Template/KendoUI


/w00t.gif' class='bbc_emoticon' alt='(w00t)' /> /sick.gif' class='bbc_emoticon' alt=':x' /> /crying.gif' class='bbc_emoticon' alt=':'(' />

Edited by foxp2, 12 March 2012 - 17:50.

-------------------

#34   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 4,897 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 12 March 2012 - 17:55

Hi Laurent..

Sorry that I did not specify the namespace o:)

Add-Ons must use the Custom namespace and not make any modifications to the Core namespace.

Kind regards,
Harald Ponce de Leon

#35   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 12 March 2012 - 18:06

Sorry that I did not specify the namespace /innocent.gif' class='bbc_emoticon' alt='o:)' />

Add-Ons must use the Custom namespace and not make any modifications to the Core namespace.



in my language, we have an idiomatic expression : "essuyer les pl√Ętres" ...
I do not have any idea how to translate this expression correctly
may be :
I feel as though I was being put through a dry run... ?

Harald : I have never said that my work will become an add-on. It's just a POC.

Edited by foxp2, 12 March 2012 - 18:18.

-------------------

#36   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 15 March 2012 - 10:17

Hi Laurent..

Sorry that I did not specify the namespace /innocent.gif' class='bbc_emoticon' alt='o:)' />

Add-Ons must use the Custom namespace and not make any modifications to the Core namespace.

Kind regards,


Hi Harald,

if an add-on creates a new Application, is it really necessary being in the Custom folder ?

Kind regards,
-------------------

#37   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 4,897 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 15 March 2012 - 10:18

Hi Laurent..

Yes, that is what the Custom namespace is for. Anything not part of core (from our releases) must go in the Custom namespace.

Kind regards,
Harald Ponce de Leon

#38   foxp2

foxp2

    strong as a Twig

  • Banned
  • 310 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 15 March 2012 - 10:22

in this case, rename it AddOn folder ... /whistling.gif' class='bbc_emoticon' alt=':-' />
IMO, Custom folder was for modified Core classes, and not to get all add-on Application.
-------------------

#39   lorem_ipsum

lorem_ipsum
  • Members
  • 8 posts
  • Real Name:fred
  • Gender:Male
  • Location:Toulouse

Posted 16 March 2012 - 08:59

Yes, that is what the Custom namespace is for. Anything not part of core (from our releases) must go in the Custom namespace.

if I'm not mistaken, i think @harald sometimes you confused some ppl when you used the term "folder" and "namespace" about Custom...
The "custom" namespace don't exist at all. Maybe peoples need to understand that "custom" folder is just here for overwrite some classes or app (if they need) or to developpe their own application other than a shop... like a forum, cms... around the oscom framework.

Is it correct?

#40   Foayiid

Foayiid
  • Members
  • 50 posts
  • Real Name:fred
  • Gender:Male

Posted 19 March 2012 - 16:34

Hi Harald,

I work on an application and when the file is in /OM/Core/Site/Admin all is ok
But when I put it in /OM/Custom/Site/Admin I can't see it in the Admin.
Did I miss something ??

Regards, Fred

Edited by Foayiid, 19 March 2012 - 16:35.