简体   繁体   English

我们可以用HTML创建Joomla自定义模板吗

[英]Can we create Joomla custom template with HTML

I'm new to Joomla. 我是Joomla的新手。 I'm having a small doubt coming to creating Joomla templates. 我对创建Joomla模板存有疑问。 In the file structure provided by joomla I can see only index.php file. 在joomla提供的文件结构中,我只能看到index.php文件。 My doubt is can we create a Joomla template using HTML also. 我的疑问是我们是否也可以使用HTML创建Joomla模板。 so that in the file structure it reads index.html. 以便在文件结构中读取index.html。

Thanks in Advance and Merry Christmas. 在此先感谢您和圣诞快乐。

It is important here to distinguish between "can" and "should" here. 在这里区分“ can”和“ should”很重要。 I believe you "can" make a template in an html file without losing all of the Joomla functionality because Joomla places modules using tags like <jdoc:include type="modules" name="user4" /> which it will parse. 我相信您可以在html文件中创建模板而不会丢失所有Joomla功能,因为Joomla使用<jdoc:include type="modules" name="user4" />这样的标签来放置模块,它将对其进行解析。 I'm not positive, but fairly certain that the template does require a php to bootstrap it, but you could just have the php file include the html you want to use. 我不是很肯定,但是可以肯定地说模板确实需要PHP来引导它,但是您可以让php文件包含要使用的html。 The major drawback is that you will be losing all of the php helper methods that Joomla makes available for you, like JURI::base() for dealing with paths for your scripts/css, etc. 主要缺点是,您将失去Joomla为您提供的所有php帮助程序方法,例如用于处理脚本/ css路径的JURI::base()

You definitely should take advantage of Joomla's capabilities with php, so use the php file. 您绝对应该利用php的Joomla功能,因此请使用php文件。 If you want to include some html files into that document, that's just fine. 如果您想在该文档中包含一些html文件,那就很好。

I don't think you can do that. 我认为您无法做到。 The index.php file you are referring to is the root index file, while each template has its own index.php file inside their folder inside templates folder. 您要引用的index.php文件是索引文件,而每个模板在模板文件夹内的文件夹中都有自己的index.php文件。 For example templates/beez3/index.php Joomla includes the index.php file of the chosen template during it's execution cycle. 例如, templates/beez3/index.php Joomla在执行期间包含所选模板index.php文件。 Failing to find such a file it will fall back to a preinstalled template throwing an error: The template for this display is not available. 找不到此类文件,它将退回到预安装的模板,并引发错误: 该显示的模板不可用。 Also the frontend requests start by loading the root index.php file first and then proceed to other calls and <jdoc:include type="component" /> won't load anything as it won't have any framework loaded or any joomla functionality at all. 另外,前端请求首先从加载 index.php文件开始,然后继续进行其他调用,并且<jdoc:include type="component" />将不会加载任何内容,因为它将不会加载任何框架或任何joomla功能完全没有 Finally no extension will work since they all require the _JEXEC constant to be defined as it's being defined in the root index.php file: 最后,没有扩展将起作用,因为它们都需要定义_JEXEC常量,因为它是在根index.php文件中定义的:

/**
 * Constant that is checked in included files to prevent direct access.
 * define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
 */
define('_JEXEC', 1);

它必须用php编写,您当然可以将创建的主题保留在template文件夹中,因为要保留.html,您可以始终使用htaccess来提供所需的任何扩展名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM