VirtueMart - 1.1 开发者指南
11
Chapter 3. Modifying the Layout
The most important part of the Layout of your Shop is the Joomla template (Joomlahut.com [http://
mambohut.com/] is a good start)!
mambohut.com/] is a good start)!
3.1. Themes and Templates
Starting with version 1.1, VirtueMart offers to style the shop using themes and templates.
3.1.1. Themes
3.1.1.1. Introduction
A theme is what defines certain parts of the look and feel of your shop. All installations of VirtueMart
should start out with the default theme. You can change the Theme in the "Site" section of the
configuration form. Usually there's only one theme available, so you can't switch. A good way to think
of themes is as "plugins", which contain a collection of page templates, images, stylesheets, javascript
and other files. While editing these files can be a bit technical, the layout is separated from the content
allowing you to make and distribute your own themes.
should start out with the default theme. You can change the Theme in the "Site" section of the
configuration form. Usually there's only one theme available, so you can't switch. A good way to think
of themes is as "plugins", which contain a collection of page templates, images, stylesheets, javascript
and other files. While editing these files can be a bit technical, the layout is separated from the content
allowing you to make and distribute your own themes.
3.1.1.2. Theme Configuration
Themes can be configured for better usability. Configuration parameters can be used to turn on and
off certain parts in templates. The configuration parameters are defined in the file
off certain parts in templates. The configuration parameters are defined in the file
/components/
com_virtuemart/themes/THEMENAME/theme.xml
and follow the common parameter
syntax for components, modules and mambots as used in Mambo >= 4.5.1 and Joomla! (Read more
about the mosinstall parameter XML syntax). When a user chooses to configure a theme (Shop
Configuration # Tab "Site # "Layout", these parameters are parsed and displayed in a nice form. Now
the user can make changes to the configuration. The current configuration values are stored in the file
about the mosinstall parameter XML syntax). When a user chooses to configure a theme (Shop
Configuration # Tab "Site # "Layout", these parameters are parsed and displayed in a nice form. Now
the user can make changes to the configuration. The current configuration values are stored in the file
/
components/com_virtuemart/themes/THEMENAME/theme.config.php
. This file is
renewed with the new configuration values each time a user saves the theme configuration.
How to use configuration values in templates
It's easy to get or set the value of a configuration parameter from inside a template. You just need
to call $this->get_cfg( 'parameterName' ) to get the value for this parameter. Example from
to call $this->get_cfg( 'parameterName' ) to get the value for this parameter. Example from
/
templates/product_details/flypage.tpl.php
:
// Show the vendor link?
if( $this->get_cfg('showVendorLink', 1)) {
echo $vendor_link;
}
The second parameter let's you predefine a "default" value, which is used when the configuration file
for this theme doesn't have a value for this parameter.
for this theme doesn't have a value for this parameter.
3.1.2. Templates
3.1.2.1. Introduction
Important
A template in VirtueMart has nothing in common with what is a "template" in Joomla!.