NAVIGATION
As a result of the content part SEARCH often unwanted text will be shown.
This problem occurs for example in search results from CPs containing images, especially, if they are placed at the very beginning thusly aren't cut off by word count settings of CP search.
Here is an example, how you can filter file names of pictures off the text with a simple trigger.
- All the displayed image file name (xxxxxxx.jpg/gif/png) can be filtered and deleted from the search results.
Docu: –
Forum: Suchergebnisse anpassen
Author: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.4x
Version: V1.0 (02.09.2010)
Condition: → /config/phpwcms/conf.inc.php
File: /template/inc_script/frontend_init/cp_trig_search_filter.php
<?php // ------------------------------------------------------------------------------------------- // obligate check for phpwcms constants if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");} // ------------------------------------------------------------------------------------------- /** * ***************************************************************************** * CP search trigger * Delete all images xxxx.jpg/gif/png from the search result * V1.0 02.09.10 K.Heermann http://planmatrix.de * * ***************************************************************************** */ function CP_SEARCH_FILTER($text, & $data) { if( $data['acontent_type'] == 13 ) { // content type search = 13 $search = '/[^\s]+(?=\.(jpg|gif|png))\.\w{3}/i'; // $search = '/[^\s]+(?=\.(jpg|gif|png))\.(jpg|gif|png)/i'; $text = preg_replace($search,'', $text); // Delete image text (xxxx.jpg/gif/png) } return $text; } // ---- END function register_cp_trigger('CP_SEARCH_FILTER'); ?>