// Функция для извлечения значения доп. поля
function get_xfield_value($field_name) {
return "SUBSTRING_INDEX(SUBSTRING_INDEX(xfields, '{$field_name}=\"', -1), '\"', 1)";
}
$conditions = ["title LIKE '%{$query}%'"];
$custom_fields = ['new', 'year']; // Добавляйте новые поля сюда
foreach ($custom_fields as $field) {
$conditions[] = get_xfield_value($field) . " LIKE '%{$query}%'";
}
$where_clause = implode(' OR ', $conditions);
$db->query("SELECT id, short_story, title, date, xfields, alt_name, category FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1" . $this_date . " AND ({$where_clause}) ORDER by date DESC LIMIT 5");
$db->query( "SELECT * FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1" . $this_date . " AND (short_story LIKE '%{$query}%' OR full_story LIKE '%{$query}%' OR xfields LIKE '%{$query}%' OR title LIKE '%{$query}%') ORDER by date DESC LIMIT 5" );$db->query( "SELECT * FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1" . $this_date . " AND (title LIKE '%{$query}%') ORDER by symboy DESC LIMIT 5" );
$db->query("SELECT id, short_story, title, date, xfields, alt_name, category FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1".$this_date." AND (title LIKE '%{$query}%' OR SUBSTRING_INDEX(SUBSTRING_INDEX(xfields, 'new=\"', -1), '\"', 1) LIKE '%{$query}%' OR SUBSTRING_INDEX(SUBSTRING_INDEX(xfields, 'year=\"', -1), '\"', 1) LIKE '%{$query}%' ORDER by date DESC LIMIT 5");// Функция для извлечения значения доп. поля
function get_xfield_value($field_name) {
return "SUBSTRING_INDEX(SUBSTRING_INDEX(xfields, '{$field_name}=\"', -1), '\"', 1)";
}
$conditions = ["title LIKE '%{$query}%'"];
$custom_fields = ['new', 'year']; // Добавляйте новые поля сюда
foreach ($custom_fields as $field) {
$conditions[] = get_xfield_value($field) . " LIKE '%{$query}%'";
}
$where_clause = implode(' OR ', $conditions);
$db->query("SELECT id, short_story, title, date, xfields, alt_name, category FROM " . PREFIX . "_post WHERE " . PREFIX . "_post.approve=1" . $this_date . " AND ({$where_clause}) ORDER by date DESC LIMIT 5");
<?xml version="1.0" encoding="utf-8"?>
<dleplugin>
<name>Вывод {title} в main.tpl из полной новости</name>
<description></description>
<icon></icon>
<version></version>
<dleversion></dleversion>
<versioncompare>==</versioncompare>
<upgradeurl></upgradeurl>
<filedelete>0</filedelete>
<needplugin></needplugin>
<mnotice>0</mnotice>
<mysqlinstall><![CDATA[]]></mysqlinstall>
<mysqlupgrade><![CDATA[]]></mysqlupgrade>
<mysqlenable><![CDATA[]]></mysqlenable>
<mysqldisable><![CDATA[]]></mysqldisable>
<mysqldelete><![CDATA[]]></mysqldelete>
<phpinstall><![CDATA[]]></phpinstall>
<phpupgrade><![CDATA[]]></phpupgrade>
<phpenable><![CDATA[]]></phpenable>
<phpdisable><![CDATA[]]></phpdisable>
<phpdelete><![CDATA[]]></phpdelete>
<notice><![CDATA[]]></notice>
<file name="engine/modules/main.php">
<operation action="before">
<searchcode><![CDATA[if ($config['allow_skin_change']) {]]></searchcode>
<replacecode><![CDATA[if ( $dle_module == "showfull" AND $news_found ) {
$tpl->set( '[news-title]', "" );
$tpl->set( '[/news-title]', "" );
$tpl->set( '{news-title}', $title_buffer );
} else {
$tpl->set( '{news-title}', "" );
$tpl->set_block( "'\\[news-title\\](.*?)\\[/news-title\\]'si", "" );
}]]></replacecode>
<enabled>1</enabled>
</operation>
</file>
<file name="engine/modules/show.full.php">
<operation action="before">
<searchcode><![CDATA[$tpl->set( '{title}', str_replace("&amp;", "&", htmlspecialchars( $row['title'], ENT_QUOTES, 'UTF-8' ) ) );]]></searchcode>
<replacecode><![CDATA[$title_buffer = str_replace("&amp;", "&", htmlspecialchars( $row['title'], ENT_QUOTES, 'UTF-8' ) );]]></replacecode>
<enabled>1</enabled>
</operation>
</file>
</dleplugin>
<td align="right" style="padding-right: 3px; border-radius: 0px;">
<form method="get" action="/">
<input type="hidden" name="do" value="search">
<input type="hidden" name="subaction" value="search">
<input type="hidden" name="titleonly" value="3" name="do" value="search">
<input id="story" class="searchButton" type="text" onfocus="this.style.background = '#d6e7d4';" onblur="this.style.background = '#F9F9F9';" name="story" maxlength="80" value="" placeholder="Введите запрос" autocomplete="off" style="padding: 8px 8px; border-radius: 0px;" /><input class="searchButtonn" type="submit" value="Найти" name="submit2" style="padding: 8px 8px; border-radius: 0px;" />
</form>
</td>
$("#searchsuggestions").css({position:"absolute",top:0,left:0}).position({my:"left top",at:"left bottom",of:"#story",collision:"fit flip"})
