add title to shortcode

This commit is contained in:
Thibault GUILLAUME 2015-10-27 14:56:01 +01:00
parent d9f5569c48
commit 473b92ce8b
3 changed files with 43 additions and 13 deletions

View File

@ -72,17 +72,17 @@ class PostCmsControllerCore extends FrontController
'---FIN---',
),
array('h2', '</h2>',
'<div class="info warning">',
'<div class="info truc">',
'<div class="info truc">',
'<div class="info asavoir">',
'<div class="info anoter">',
'<div class="info warning"><h5>Attention</h5>',
'<div class="info truc"><h5>Trucs</h5>',
'<div class="info truc"><h5>Trucs</h5>',
'<div class="info asavoir"><h5>A savoir</h5>',
'<div class="info anoter"><h5>A noter</h5>',
'</div>',
'<div class="info warning">',
'<div class="info truc">',
'<div class="info truc">',
'<div class="info asavoir">',
'<div class="info anoter">',
'<div class="info warning"><h5>Attention</h5>',
'<div class="info truc"><h5>Trucs</h5>',
'<div class="info truc"><h5>Trucs</h5>',
'<div class="info asavoir"><h5>A savoir</h5>',
'<div class="info anoter"><h5>A noter</h5>',
'</div>',
),
$article->content);

View File

@ -365,15 +365,37 @@ class CmsPsPost extends ObjectModel {
foreach ($keywords as $key => $keyword) {
$query_posts.= 'AND (
pl.`title` LIKE "%'.pSql($keyword).'%"
OR pl.`content` LIKE "%'.pSql($keyword).'%"
)';
}
$query_posts.= '
ORDER BY p.`note` DESC
LIMIT '.(int)$limit
;
$ids = Db::getInstance()->executeS($query_posts);
$ids_title = Db::getInstance()->executeS($query_posts);
$ids_exclude = array_map(function($elem) {
return $elem['id_post'];
}, $ids_title);
$query_posts_content = '
SELECT p.`id_post`
FROM `'._DB_PREFIX_.'cmsps_posts` p
LEFT JOIN `'._DB_PREFIX_.'cmsps_posts_lang` pl ON(p.`id_post` = pl.`id_post`)
WHERE p.`active` = 1
';
$query_posts_content .= ' AND p.`id_post` NOT IN ("'.implode(',', $ids_exclude).'")';
foreach ($keywords as $key => $keyword) {
$query_posts_content.= 'AND (
pl.`content` LIKE "%'.pSql($keyword).'%"
)';
}
$query_posts_content.= '
ORDER BY p.`note` DESC
LIMIT '.(int)$limit
;
$ids_content = Db::getInstance()->executeS($query_posts_content);
$ids = array_merge($ids_title, $ids_content);
if ($ids) {
foreach ($ids as $key => $id) {
$result[] = new CmsPsPost($id['id_post'], $id_lang);

View File

@ -1249,7 +1249,7 @@ body .ac_results {
/* contenu articles */
.article_content .content {
color: #4d4d4d;
font-size: 16px;
font-size: 15px;
line-height: 24px;
}
.article_content .content h2 strong { font-weight: normal;}
@ -1260,12 +1260,20 @@ body .ac_results {
font-family: 'vidaloka';
letter-spacing: -1px;
}
.article_content .content h3 {
font-size: 18px;
}
.article_content .content p {margin-bottom: 0;}
.article_content .content .info {
background: #ccc;
padding: 15px;
border-radius: 5px;
margin-bottom: 15px;
}
.article_content .content .info h5 {
}
.article_content .content .info.truc{ background-color: #d7e9e7;}
.article_content .content .info.warning{ background-color: #efd2d4;}
.article_content .content .info.asavoir{ background-color: #ebebd9;}