function appozitiv_get_testimonial() {
// База данных настраивается в settings.php
//$databases['appozitiv']['default'] = array(
// 'database' => 'del_appozitiv',
// 'username' => '', // assuming this is necessary
// 'password' => '', // assuming this is necessary
// 'host' => 'localhost', // assumes localhost
// 'driver' => 'mysql', // replace with your database driver
//);
db_set_active('appozitiv');
$comments = db_select('comments', 'c')
->fields('c', array('id', 'text'))
->execute()
->fetchAll();
dpm($comments);
db_set_active();
}
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'del_appozitiv.variable' doesn't exist: SELECT 1 AS expression FROM {variable} variable WHERE ( (name = :db_condition_placeholder_0) ); Array ( [:db_condition_placeholder_0] => cron_last ) in variable_set() (line 991 of includes/bootstrap.inc).
По этому мануалу и делал.
function appozitiv_get_testimonial() {
// База данных настраивается в settings.php
db_set_active('appozitiv');
$comments = db_select('comments', 'c')
->fields('c', array('id', 'text'))
->execute()
->fetchAll();
dpm($comments);
drupal_static_reset();
db_set_active();
}
$ewrapper = entity_metadata_wrapper('node', $entity);
$ewrapper->title->set('Отзыв от ' . $user->name);
$ewrapper->body->set(array('value' => $comment->text));
// как только не делал - все равно текущая )
$date = new DateTime($comment->date);
$entity->date = $comment->date;
$entity->created = $date->getTimestamp();
$entity->changed = $date->getTimestamp();
$entity->timestamp = $date->getTimestamp();
$ewrapper->save();
с помощью domain_entity это решается
например делаем два термина таксономии и указываем, где они отображаются.
Term1_domain1
Term1_subdomain
<?php if ($secondary_menu): ?>
<div id="secondary-menu" class="navigation">
<?php print theme('links__system_secondary_menu', array(
'links' => $secondary_menu,
'attributes' => array(
'id' => 'secondary-menu-links',
'class' => array('links', 'inline', 'clearfix'),
),
'heading' => array(
'text' => t('Secondary menu'),
'level' => 'h2',
'class' => array('element-invisible'),
),
)); ?>
</div> <!-- /#secondary-menu -->
<?php endif; ?>