Querypath template vars
Component ID
1776522
Component name
Querypath template vars
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
This module populates template vars with html fetched by querypath.
The html can be run through different processors like:
- paths_rel2abs: Transforms relative paths to absolute.
- remove_elements: Removes elements from the DOM. Surprise :)
Other modules needs to implement a hook in order to add template vars with querypath fetched html:
function hook_querypath_tpl_vars_settings() {
return array(
'header' => array(
// By now only page is supported.
'templates' => array('page'),
'domain' => 'http://acme.com',
'selector' => '#header',
'cache' => TRUE,
'process' => array(
'paths_rel2abs' => array(),
),
),
'navigation' => array(
// By now only page is supported.
'templates' => array('page'),
'domain' => 'http://acme.com',
'selector' => '#navigation',
'cache' => TRUE,
'process' => array(
'remove_elements' => array('.region-navigation'),
'paths_rel2abs' => array(
'exclude' => array(
'href' => array('/aktiviteter'),
),
),
),
),
);
}
In this case the variables will be present in page.tpl.php :
<?php if ($qtv_header): ?>
<?php print $qtv_header; ?>
<?php endif; ?>
<?php if ($qtv_navigation): ?>
<?php print $qtv_navigation; ?>
<?php endif; ?>
