大家好!有必要确保新闻中的短标题具有与长标题相同的缩进,并且最长的标题没有缩进,因此,如何通过 CSS 实现这一点?网站:https://nppesto.ru/news/
dmitrii_mv4's questions
有一条线
$all_prices = array($data_platforms__integration_cost_agreed[0]->integration_cost);
她通过var_dump($all_prices)输出这个
array(1) {
[0]=>
string(5) "34634"
}
array(1) {
[0]=>
string(6) "200000"
}
我以显示数字 34634 和 200000 的方式访问数据库 - 这些是价格
$data_platforms__integration_cost_agreed = DataPlatformsForm::find()
->select('integration_cost')
->where(['id_blogger' => $bloggers->id])
->all();
问题
如何将这些数字 34634 和 200000 相加?
控制器中的方法
public function actionIndex()
{
$bloggers_db = BloggerForm::find()->orderBy('id desc')->all();
// Вытаскиваем клиента который привязан к проекту
$node_project_klient = NodeProjectKlient::find()->Where(['id_project' => Yii::$app->request->get("project")])->one();
$data_platforms_db = DataPlatformsForm::find()->all();
// Выводим всех клиентов которые привязаные к менеджеру
$manager_node_klient_db = User::find()
->leftJoin('node_klient_manager', '`node_klient_manager`.`id_klient` = `user`.`id`')
->where(['node_klient_manager.id_manager' => Yii::$app->user->identity->id])
->orderBy('id desc')
->all();
// Выводим всех блогеров по проекту (нейтральные)
$bloggers_neutral_projects_db = BloggerForm::find()
->leftJoin('node_project_blogger', '`node_project_blogger`.`id_blogger` = `bloggers`.`id`')
->Where([
'node_project_blogger.id_project' => Yii::$app->request->get('project'),
'node_project_blogger.long_list' => 0,
'node_project_blogger.agreed' => 0,
])
->orderBy('id desc')
->all();
// Выводим всех блогеров по проекту (отклонённые)
$bloggers_rejected_projects_db = BloggerForm::find()
->leftJoin('node_project_blogger', '`node_project_blogger`.`id_blogger` = `bloggers`.`id`')
->Where([
'node_project_blogger.id_project' => Yii::$app->request->get('project'),
'node_project_blogger.long_list' => 2,
'node_project_blogger.agreed' => 0,
])
->orderBy('id desc')
->all();
// Выводим всех блогеров по проекту (согласованные)
$bloggers_approved_projects_db = BloggerForm::find()
->leftJoin('node_project_blogger', '`node_project_blogger`.`id_blogger` = `bloggers`.`id`')
->Where([
'node_project_blogger.id_project' => Yii::$app->request->get('project'),
'node_project_blogger.long_list' => 1,
'node_project_blogger.agreed' => 0,
])
->orderBy('id desc')
->all();
// Выводим блогеров из таблицы связей для обновлений статусов
$node_project_blogger_db = NodeProjectBlogger::find()->where(['id_project' => Yii::$app->request->get('project')])->all();
if ($this->request->isPost)
{
// Обработка статусов блогеров по id
foreach ($node_project_blogger_db as $node_project_blogger)
{
// ========================== LOG CREATE ================================= //
$str_log = '================================================';
$array = array(
'Controller' => 'Manager',
'Method' => 'Index',
'id_project' => Yii::$app->request->get('project'),
'id_blogger' => $node_project_blogger->id_blogger,
'long_list' => $this->request->post('status_'.$node_project_blogger->id_blogger)
);
$log = date('Y-m-d H:i:s') . ' ' . print_r($array, true);
file_put_contents('../logs/funnel_manager.txt', PHP_EOL . $str_log . PHP_EOL . $log . PHP_EOL . $str_log, FILE_APPEND);
// ======================== END LOG CREATE =============================== //
// Массовое редактирование статусов
// BloggerForm::updateAll(['long_list_status_manager' => 0], ['id' => array('11','30','31')]);
NodeProjectBlogger::updateAll(
['long_list' => $this->request->post('status_'.$node_project_blogger->id_blogger)],
[
'id_project' => Yii::$app->request->get('project'),
'id_blogger' => $node_project_blogger->id_blogger,
//'id_blogger' => array('1','2','6')
]);
// ------ ИЗМЕНЕНИЕ БЮДЖЕТА ------ //
// Биндим всех блоггеров
foreach ($bloggers_db as $bloggers)
{
// Если статус "Согласованные"
if ($this->request->post('status_'.$bloggers->id) == 1)
{
// Выводим сумму интеграции
$data_platforms__integration_cost_agreed = DataPlatformsForm::find()
->select('integration_cost')
->where(['id_blogger' => $bloggers->id])
->all();
// Все цены блогеров в массиве
//$all_prices = array('id_blogger_'.$bloggers->id => $data_platforms__integration_cost_agreed[0]->integration_cost);
$all_prices = array($data_platforms__integration_cost_agreed[0]->integration_cost);
$summ = 0;
foreach($all_prices as $price)
{
$summ += floatval($price[0]);
}
echo $summ;
// echo '<pre>';
// var_dump($all_prices);
// echo '</pre>';
}
}
die;
}
return $this->redirect(['?project='.Yii::$app->request->get('project')]);
}
return $this->render('index', [
'bloggers_db' => $bloggers_db,
'bloggers_neutral_projects_db' => $bloggers_neutral_projects_db,
'bloggers_approved_projects_db' => $bloggers_approved_projects_db,
'bloggers_rejected_projects_db' => $bloggers_rejected_projects_db,
]);
}
有2张桌子table_links
和user
在用户窗体模型中
public static function tableName()
{
return 'user';
}
public function getTableLinksForm()
{
return $this->hasMany(TableLinksForm::className(), ['id' => 'manager_id']);
}
在 TableLinksForm 模型中
public static function tableName()
{
return 'table_links';
}
public function getUser()
{
return $this->hasOne(User::className(), ['manager_id' => 'id']);
}
在控制器中
$users = User::findOne(2);
$username = $users->username;
仅显示 1 个用户
如何显示多个用户?
像这样尝试=不想要
$users = User::findOne([2,4]);
$username = $users->username;
纯属偶然,我在一次头脑风暴会议上写了代码并且它起作用了,但我什至不知道它叫什么来谷歌它。
在托管 timeweb 上,一切都适用于 php 版本 7.4 ,但在具有相同版本的 openserv 上它不想这样做,发誓这种方法已经过时了。
这是控制器中的代码
if ($bloggers_model->load($this->request->post()) && $bloggers_model->save())
{
// загрузка доп данных для платформ
foreach ($platforms_db as $platform)
{
$model_data_platforms {$platform['id']} = new DataPlatformsForm();
//if (!empty($this->request->post('url_'.$platform['id'])))
//{
$model_data_platforms {$platform['id']}->url = $this->request->post('url_'.$platform['id']);
$model_data_platforms {$platform['id']}->id_platform = $this->request->post('platform_id_'.$this->request->post('platform_id_'.$platform['id']));
$model_data_platforms {$platform['id']}->subscribers = $this->request->post('subscribers_'.$this->request->post('platform_id_'.$platform['id']));
$model_data_platforms {$platform['id']}->coverage = $this->request->post('coverage_'.$this->request->post('platform_id_'.$platform['id']));
$model_data_platforms {$platform['id']}->integration_cost = $this->request->post('integration_cost_'.$this->request->post('platform_id_'.$platform['id']));
//$model_data_platforms {$platform['id']}->cpm = $this->request->post('cpm_'.$this->request->post('platform_id_'.$platform['id']));
//$model_data_platforms {$platform['id']}->cpv = $this->request->post('cpv_'.$this->request->post('platform_id_'.$platform['id']));
$model_data_platforms {$platform['id']}->audience_gender = $this->request->post('audience_gender_'.$this->request->post('platform_id_'.$platform['id']));
$model_data_platforms {$platform['id']}->involvement = $this->request->post('involvement_'.$this->request->post('platform_id_'.$platform['id']));
$model_data_platforms {$platform['id']}->involvement_promotional_post = $this->request->post('involvement_promotional_post_'.$this->request->post('platform_id_'.$platform['id']));
$model_data_platforms {$platform['id']}->create_user = Yii::$app->user->identity->username; // пользователь который добавил
$model_data_platforms {$platform['id']}->create_date = date("Y-m-d H:i:s"); // дата добавления
$model_data_platforms {$platform['id']}->id_blogger = $bloggers_model->id; // id блогера
$model_data_platforms {$platform['id']}->save();
//}
}
return $this->redirect(['view', 'id' => $bloggers_model->id]);
}
} else {
$bloggers_model->loadDefaultValues();
}
如何重写新版本的php?以及如何调用它到谷歌?)
我在挠头,我不知道如何实施
有一种形式,在里面多选(一次选择几个值)
查看客户端创建
<div class="form-group">
<label class="control-label">Выберите менеджера:</label>
<select class="select2 mb-3 select2-multiple select2-hidden-accessible" style="width: 100%" multiple="" data-placeholder="Выерите 1 или нескольких" name="responsible_manager[]" tabindex="-1" aria-hidden="true">
<option value="">Не привязывать</option>
<option value="3">manager1@mail.ru</option>
<option value="5">manager2@ya.ru</option>
<option value="7">manager3@mail.ru</option>
<option value="28">manager4</option>
<option value="30">manager15</option>
<option value="34">manager13</option>
<option value="35">manager156</option>
</select><span class="select2 select2-container select2-container--default select2-container--focus select2-container--below" dir="ltr" style="width: 100%;"><span class="selection"><span class="select2-selection select2-selection--multiple" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="-1"><ul class="select2-selection__rendered"><li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="0" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" aria-autocomplete="list" placeholder="Выерите 1 или нескольких" style="width: 1350.25px;"></li></ul></span></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>
<div class="help-block"></div>
</div>
此外,只需按一下按钮,我就会将其发送到控制器。在控制器中,当调用发布请求时,我得到一个数组(我在视图中选择的所有管理器)
var_dump($this->request->post('responsible_manager'));
事实证明,当 wardump 我得到了我选择的经理的所有 id
数组(3) { [0]=> 字符串(1) "7" [1]=> 字符串(2) "28" [2]=> 字符串(2) "34" }
一个任务
数据库有一个单独的表table_links
,其中有一列id_manager
。如何将收到的数组中的所有数据放入此表中?
实际上,应该在一列中为每个经理创建一条新记录,并且经理的id应该写在该列的记录中id_manager
我尝试foreach
播放并while
使用循环(计算数组中的数字并重复输入以使用不同的数组 id 加载到数据库中)。但是如果数据库已经有这样的记录并且它与编辑相关,它就可以工作。所以它总是到达最后一个记录或什么都没有
这是必要的,以便在创建客户卡时,您可以选择几个将与他一起工作的经理并将他们链接到同一个客户
你好,我不明白,请解释一下。
通过 PDO 向 MySQL 数据库发出请求:
$cmd = $this->pdo->query("SELECT id, title, category, date_added, city, in_top, language, type, building_condition, rooms, bathrooms,
MIN(price) as min($min_price), photo, photo_2, photo_3, photo_4
FROM $database_lang WHERE city = $city and in_top = $in_top
ORDER BY id $new LIMIT $entry_start, ".LIMIT_ENTRY."");
但是我无法显示最低和最高价格(价格) 即在搜索中设置了一个值,例如,50000,因此显示所有价格至少为 50000 的公寓记录
如何实施?