|
|
| Line 489: |
Line 489: |
|
| |
|
| ==比较版本== | | ==比较版本== |
| 如果您的代码需要根据 Dolibarr 版本的不同而执行不同的操作,您可以使用以下技巧来检测和比较版本: | | 如果您的代码需要根据 Dolibarr 版本的不同而执行不同的操作,您可以使用以下技巧来判断和比较版本: |
|
| |
|
| <syntaxhighlight lang="PHP"> | | <syntaxhighlight lang="PHP"> |
| Line 596: |
Line 596: |
| * / | | * / |
| </pre> | | </pre> |
| 它后面是V (Vue)(视图)代码,通过如下标记与C代码分隔开: | | 它后面是V (Vue)(视图)代码,通过如下标记与C代码隔离开: |
| <pre> | | <pre> |
| /* | | /* |
| Line 603: |
Line 603: |
| </pre> | | </pre> |
|
| |
|
| This mode of separation has had a neutral effect on new developments but has made it possible to reduce the time required for maintenance and fixing bugs so significantly that it is not envisaged to switch to another type of separation (yes the findings made in real life are not always those expected by school theory). The important thing remains that there is always a separation between C and V, no matter how this separation is materialized, as long as it is (Reminder: Do not confuse the notion of separation of C and V with the notion of separation of the code to feed the data of a View and of the code to format the View, this a principle of separation relating to the Design Pattern of Vue, see next point).
| | 这种隔离模式对新增需求的开发产生了中性影响,但大大减少了维护和修复错误所需的时间,因此不打算切换到另一种类型的隔离(确实,现实生活中的观察结果并不总是学术理论所期望的)。重要的是,C和V之间总是存在隔离,无论这种隔离是如何实现的,只要它存在(提醒:不要将C和V的隔离概念与为视图提供数据的代码和格式化视图的代码的分离概念混淆,这是视图设计模式的分离原则,请参阅下一节)。 |
|
| |
|
| ==Design pattern for Views - Presentation== | | ==视图 - 展现的设计模式== |
| There are frameworks that specialize in Vue Design Pattern, the part of formatting the screen seen by the user.
| | 有专门用于视图设计模式的框架,这部分涉及格式化用户看到的屏幕。 |
| Old versions of Dolibarr used Smarty. This framework is an overlay to an already very powerful screen formatting framework called ... PHP. The benefits being much lower than the disadvantages, it has been abandoned in favor of PHP templates (.tpl.php file) which remain the simplest, the most universal, the most scalable and the most efficient, of the presentation frameworks.
| |
|
| |
|
| Its only flaw is that it cannot guarantee 100% the deviations of a developer who would integrate into the View, a logic unrelated to the presentation (therefore other than code intended for generation, formatting, HTML output , test or loop logic). This point is however controlled by the validation mechanism of the project managers' code.
| | 旧版本的Dolibarr使用Smarty。这个框架是一个已经非常强大的屏幕格式化框架的覆盖层,名为...PHP。由于优点远小于缺点,它已被放弃,取而代之的是PHP模板(.tpl.php文件),PHP模板仍然是最简单、最通用、最可扩展和最高效的展现框架。 |
|
| |
|
| Here again, it is the experience and the observation of a better productivity performance that has motivated the abandonment of the external Presentation frameworks in favor of the PHP framework.
| | 它唯一的缺陷是,它不能100%保证开发人员不会在视图中集成与展现无关的逻辑(除了用于生成、格式化、HTML输出、判断逻辑或循环的其它代码)。然而,这一点应该由项目经理代码验证机制控制。 |
| | |
| | 另一方面,正是经验和“在现场”观察到的更高生产率,促使人们放弃了外部展现框架,转而使用PHP框架。 |
|
| |
|
| [[Category:开发]] | | [[Category:开发]] |