- Joomla! 1.5 Templates Cookbook
- Richard Carter
- 495字
- 2021-08-05 16:14:05
Understanding jdoc statements
Any Joomla! template will need to insert content managed by Joomla! into your website. This is done with the jdoc
statements in the Joomla! template.
Getting ready
Open the index.php
file of the rhuk_milkyway template, which is located in the templates\rhuk_milkyway
directory of your Joomla! installation.
How to do it...
Each "block" of content within Joomla! is inserted with a different jdoc
statement within the index.php
file. There are four fundamental statements that we'll look at:
- Component
jdoc
statements - Head
jdoc
statements Module
andmodules
statements
Component jdoc statements
Component jdoc
statements insert the main content for the current component into your Joomla! template. You can insert the primary page content for a particular page in Joomla! with this jdoc
statement, within the<body>
element of your page:
<jdoc:include type="component" />
Simple! This statement ensures that any page title and content associated with the page is inserted into your template.
Head jdoc statements
The head jdoc
statement inserts relevant code into the<head>
element of your page. This includes:
- The current page's title
- The current page's metadata; in particular, the
keywords
anddescription
fields for the page - The
robots
metadata field that tells search engines whether they should take notice of the current page or not - Links to your template's favicon (the icon that appears near the address bar in your browser)
- Links to alternate feeds for your content (that is, RSS and Atom feeds)
<jdoc:include type="head" />
Typically, this produces code similar to the following code snippet in your template:
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="keywords" content="joomla, Joomla" />
<meta name="description" content="Joomla! - the dynamic portal engine and content management system" />
<meta name="generator" content="Joomla! 1.5 - Open Source Content Management" />
<title>Welcome to the Frontpage</title>
<link href="/joomla/index.php?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0" />
<link href="/joomla/index.php?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0" />
<!—some code omitted -->
</head>
How it works...
When Joomla! loads a page, it uses the index.php
file to generate the page that is displayed. The jdoc
statements tell Joomla! where in the (X)HTML document content is required.
There's more...
There are quite a few different types of jdoc
statements available to Joomla! templates that aren't used very frequently.
Installation jdoc statement
The installation jdoc
statement is used only in Joomla!'s installer template, so it is not of much use to the frontend Joomla! templates:
<jdoc:include type="installation" />
Message jdoc statement
The message jdoc
statement inserts any system messages or error messages that Joomla! needs to display:
<jdoc:include type="message" />
It may be worth surrounding this in a<div>
tag made collapsible by using JavaScript so that your visitors can close the message once it has been read.
jdoc statements and the style attribute
If you have looked at other Joomla! template files, you may have come across jdoc
statements similar to this one:
<jdoc:include type="modules" name="top" style="xhtml" />
The style
attribute refers to the module chrome so that if no value for this attribute is given, the attribute takes a default value of None
(that is, no additional styling is provided).
Note
You can use the style
attribute on module
and modules-type jdoc
statements, but not components
. As a general rule, xhtml
or no value is fine for most purposes in your Joomla! template. More information on the style
attribute is available from Joomla!'s documentation at http://docs.joomla.org/What_is_module_chrome?.
See also
- Understanding the templateDetails.xml file
- Understanding Joomla! template positions
- Styling Joomla! error messages
- Sakai CLE Courseware Management
- Midjourney AI繪畫藝術創作教程:關鍵詞設置、藝術家與風格應用175例
- ImageMagick Tricks
- 零基礎學數碼攝影后期
- 3ds Max 2015中文版從入門到精通
- Google App Engine Java and GWT Application Development
- 老郵差·Photoshop數碼照片處理技法:人像篇(修訂版)
- Photoshop CC入門與提高
- 數碼攝影修圖師完全手冊(第2卷)
- 零基礎學Procreate萌物繪
- 中文版Photoshop 2020基礎培訓教程
- Moodle 1.9 E/Learning Course Development
- Inkscape 0.48 Essentials for Web Designers
- Photoshop CC APP UI設計從入門到精通
- MySQL for Python