我应该如何编写 Joomla!模板? [英] How should I go about writing a Joomla! template?
问题描述
我正在使用 Joomla!CMS 来开发网站.在不久的过去,我定制了一个模板来构建一个网站.将代码分解为 de-joomla!-fy 模板非常有趣.非常有趣,事实上,我正在考虑从头开始制作我自己的模板.
I am using Joomla! CMS to develop a website. In the not-so-distant past I customized a template to schlep up a website. It was fun and interesting to tear apart the code to de-joomla!-fy the template. So interesting that in fact, I am flirting with the idea of making my own template from scratch.
所以,如果我要追求这个,我从哪里开始?你知道任何非常好的参考资料,还是我应该整天玩代码直到事情解决?在开始之前,我更喜欢大量阅读(对于概念).
So, if I am to pursue this, where do I start? Do you know of any really good reference material, or should I just play with the code all day until things work out? I prefer to do tons of reading (for the concepts) before I go at it.
推荐答案
使用您想要的布局创建 HTML 页面,包括样式表和 Javascript
(1.5/2.5 是基于 Mootools)
(Joomla 3.x 基于 jQuery)
添加Javascript
Create a HTML page with the layout you want, inclusive of stylesheets and Javascript
(1.5/2.5 is Mootools based)
(Joomla 3.x is jQuery based)
Adding Javascript
保持模板最初非常基本.
将此页面另存为 index.php 页面.
Keep the template initially very basic.
Save this page as index.php page.
默认目录布局为:
- css
- html
- com_
/mod_ (用于覆盖组件和模块的基本模板)
更改/添加不同的 Joomla 结构
还使用位置和文件位置等更新相关的 templateDetails.xml
有关布局示例,请参阅当前模板.
例如Change/Add the different Joomla constructs
Also updating the related templateDetails.xml with positions and file locations etc.
See a current template for an example of the layout.
Ex.<?php // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<小时>
标题部分:
<jdoc:include type="head" />
<小时>
您的不同模块:
<?php if($this->countModules('search')) : ?> <jdoc:include type="modules" name="search" /> <?php endif; ?> <jdoc:include type="module" name="breadcrumbs" />
您的主要内容标签是:
<jdoc:include type="component" />
<小时>
要让您的模板能够显示调试信息,请添加:
<jdoc:include type="modules" name="debug" />
<小时>
要对模板进行更高级的添加,请查看默认模板(ja_purity、Beez).
要覆盖组件和模块布局,请将组件或模块的布局文件复制到模板 html 目录下的类似名称的目录中并进行更改.
For more advanced additions to a template have a look at the default templates (ja_purity, Beez).
To override component and module layouts copy the layout files of the component or module into a similarly named directory below the html directory of your template and change it.编辑...
额外的实用程序.- 要在浏览器中突出显示使用的模块名称,请将 tp=1 添加到 URL ex 的末尾.yourdomain.com?tp=1
- 要查看非活动但已安装的模板,请添加 template=template_name.前任.yourdomain.com?template=Beez
这两个可以结合,像这样.yourdomain.com?template=Beez&tp=1
These two can be combined, like this. yourdomain.com?template=Beez&tp=1
欲了解更多信息,请查看:
For more information look at:
这篇关于我应该如何编写 Joomla!模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- com_