X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   x5 getDir vs getSkins (https://forum.x-cart.com/showthread.php?t=71605)

xgarb 03-12-2015 08:08 AM

x5 getDir vs getSkins
 
The new architecture is starting to gel in my brain.

Came across this today.

Here: http://kb.x-cart.com/display/XDD/Creating+sidebar+menu+in+customer+area the tpl file is set in the viewer class

Here: http://xcartguru.com/tutorials/x-cart-5-tutorials/building-a-custom-skin-in-x-cart-5/ the tpl is set in Main.php

Is there a rule for which one to choose?

totaltec 03-15-2015 05:32 PM

Re: x5 getDir vs getSkins
 
As you probably know by now, templates get added to the site in 3 main ways. Through Main.php by setting a new custom skin directory, through a viewer class assigning a default tpl, or through a tpl file directly adding itself to a list.

Each has its strength in certain situations. When you define your own custom skin directory in Main.php of your module, you create those new directories, and templates placed in those directories will override their counterparts in the core skin directories.

You module can also have its own skin directories in default/en/YourDevId/YourModuleName/ or in admin/en/. This is preferable when you are adding a new template to a list, not simply overriding a core template. These templates can add themselves to a list directly.

You can also build a new viewer class with a default tpl, this is preferable when you need some logic available to your template that is accessed by your view.


All times are GMT -8. The time now is 02:16 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.