我应该怎么去写一个Joomla!模板? [英] How should I go about writing a Joomla! template?
问题描述
我使用Joomla! CMS开发网站。在不远的过去,我定制了一个模板来schlep一个网站。这是有趣和有趣的撕裂代码de-joomla! - 模板。这么有趣,事实上,我调情的想法从头开始我自己的模板。
所以,如果我要追求这个,我从哪里开始?你知道任何真正好的参考资料,或者我应该只是玩代码整天,直到事情发生了?我喜欢做吨的阅读(为概念),我去之前。
创建包含所需布局的HTML页面,包括样式表和Javascript
(1.5 / 2.5是基于Mootools的)
(Joomla 3.x是基于jQuery的)
添加Javascript
保持模板初始化非常基本。
将此页面保存为index.php页面。
默认目录布局为:
- css
- html
-
- com_< componentname> / mod_< modulename> (用于覆盖组件和模块的基本模板)
- 图片
- li>
- templateDetails.xml
- index.php
- favicon.ico
更改/添加不同的Joomla结构
同时使用位置和文件位置等更新相关的templateDetails.xml
查看当前模板以获取布局示例。
例如
;?php
//没有直接访问
defined('_JEXEC')或die('Restricted access');
?>
标题部分
< jdoc:include type =head/>
您的不同模组:
<?php if($ this-> countModules('search')):?>
< jdoc:include type =modulesname =search/>
<?php endif; ?>
< jdoc:include type =modulename =breadcrumbs/>
您的主要内容标记为:
< jdoc:include type =component/>
显示调试信息add:
< jdoc:include type =modulesname =debug/> ;
有关模板的更多高级补充在默认模板(ja_purity,Beez)。
要覆盖组件和模块布局,将组件或模块的布局文件复制到模板的html目录下类似命名的目录中,并更改它。 p>
编辑...
额外的公用程式。
- 要突出显示浏览器中使用的模块名称,请将tp = 1添加到网址ex的末尾。 yourdomain.com?tp=1
- 要查看非活动但已安装的模板,请添加template = template_name。例如。 yourdomain.com?template=Beez
这两个可以组合,像这样。 yourdomain.com?template=Beez&tp=1
有关详情,请参阅:
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.
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
Keep the template initially very basic.
Save this page as index.php page.
The default directory layout is:
- css
- html
- com_<componentname>/ mod_<modulename> (used to override the base templates of Components and Modules)
- images
- js
- templateDetails.xml
- index.php
- favicon.ico
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' );
?>
Header section:
<jdoc:include type="head" />
Your different Modules:
<?php if($this->countModules('search')) : ?>
<jdoc:include type="modules" name="search" />
<?php endif; ?>
<jdoc:include type="module" name="breadcrumbs" />
Your Main Content tag is:
<jdoc:include type="component" />
To allow your template the ability to display debug information add:
<jdoc:include type="modules" name="debug" />
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.
Edit...
Extra utilities.
- To highlight the used module names in a browser add tp=1 to the end of your URL ex. yourdomain.com?tp=1
- To View an inactive but installed Template add template=template_name. ex. yourdomain.com?template=Beez
These two can be combined, like this. yourdomain.com?template=Beez&tp=1
For more information look at:
- Joomla Template Tutorial Part 1 - Joomla Template Concepts
- How to Create Your First Joomla Template
- Joomla! Docs: Template Development
- Google Joomla templates
这篇关于我应该怎么去写一个Joomla!模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!