简体   繁体   中英

Can we create Joomla custom template with HTML

I'm new to Joomla. I'm having a small doubt coming to creating Joomla templates. In the file structure provided by joomla I can see only index.php file. My doubt is can we create a Joomla template using HTML also. so that in the file structure it reads index.html.

Thanks in Advance and Merry Christmas.

It is important here to distinguish between "can" and "should" here. 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. 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. 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.

You definitely should take advantage of Joomla's capabilities with php, so use the php file. If you want to include some html files into that document, that's just fine.

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. For example templates/beez3/index.php Joomla includes the index.php file of the chosen template during it's execution cycle. 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. 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:

/**
 * 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来提供所需的任何扩展名。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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