NAVIGATION
This shows you the differences between two versions of the page.
|
english:phpwcms_replacer_rts:frontend_init:cp_trigger [2009/05/19 08:47] Knut Heermann (flip-flop) |
english:phpwcms_replacer_rts:frontend_init:cp_trigger [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| {{indexmenu_n>10}} | {{indexmenu_n>10}} | ||
| - | ====== cp_trigger ====== | + | ====== cp-trigger ====== |
| Forum: [[http://forum.phpwcms.org/viewtopic.php?p=107107#p107107]] \\ | Forum: [[http://forum.phpwcms.org/viewtopic.php?p=107107#p107107]] \\ | ||
| Line 37: | Line 37: | ||
| </code> | </code> | ||
| - | You can also limit your function to work for special [[:english:phpwcms-system:article:contentparts|content parts]] (especially [[:english:technics:internally-function-call:content-part-types|content part types]]): | + | You can also limit your function to work for special [[:english:phpwcms-system:article:contentparts|content parts]] (especially [[:english:technics:internal-function-call:content-part-types|content part types]]): |
| <code php> | <code php> | ||
| function cp_trigger_function_name($param1, & $param2) { | function cp_trigger_function_name($param1, & $param2) { | ||
| Line 98: | Line 98: | ||
| === Content Part Types === | === Content Part Types === | ||
| - | Please have a look into: [[:deutsch:technik:aufruf-interner-funktionen:content_part_typen|Content Part Types]] | + | Please have a look into: [[:/english/technics/internal-function-call/content-part-types|Content Part Types]] |
| Line 107: | Line 107: | ||
| Add a class to an image, based on the cp image <div>. The given output: | Add a class to an image, based on the cp image <div>. The given output: | ||
| - | <code html><img src="content/images/xyz.jpg" alt="Alt-Text" title="Titel-Text" **border="0"** width="120" height="90"></code> | + | <code html><img src="content/images/xyz.jpg" alt="Alt-Text" title="Titel-Text" border="0" width="120" height="90"></code> |
| The construction structurally is look like: | The construction structurally is look like: | ||
| Line 114: | Line 114: | ||
| ==== Method of resolution: ==== | ==== Method of resolution: ==== | ||
| - using a trigger to **border="0"** and replace to **class="MY_CUSTOM_CLASS" border="0"** ends in this result: \\ | - using a trigger to **border="0"** and replace to **class="MY_CUSTOM_CLASS" border="0"** ends in this result: \\ | ||
| - | <code html><img src="content/images/xyz.jpg" alt="Alt-Text" title="Titel-Text" **class="MY_CUSTOM_CLASS" border="0"** width="120" height="90"></code> | + | <code html><img src="content/images/xyz.jpg" alt="Alt-Text" title="Titel-Text" class="MY_CUSTOM_CLASS" border="0" width="120" height="90"></code> |
| Line 211: | Line 211: | ||
| \\ | \\ | ||
| + | ===== 4. example: CP_SEARCH_NO_SUMMARY ===== | ||
| + | |||
| + | |||
| + | Using the content part //search// in search result we need only the article title without the summary. | ||
| + | |||
| + | At this moment (2009/09) a non summary output is not possible. If we insert the value zero into [results per page (summary)] it is the same as an "empty" input. -> (If empty, show all). | ||
| + | |||
| + | |||
| + | The standard output encloses the found summary in each case with **<p>... Summary ...</p>**. Thus it is possible to search for **<p>...</p>** and replace all **<p>...</p>** by an empty quantity. | ||
| + | |||
| + | |||
| + | Forum: [[http://forum.phpwcms.org/viewtopic.php?p=120031#p120031]][DE] | ||
| + | |||
| + | <code php|h cp_search_no_sum.php |h> | ||
| + | <?php | ||
| + | // ------------------------------------------------------------------------------------------- | ||
| + | // obligate check for phpwcms constants | ||
| + | if (!defined('PHPWCMS_ROOT')) { | ||
| + | die("You Cannot Access This Script Directly, Have a Nice Day."); } | ||
| + | // ------------------------------------------------------------------------------------------- | ||
| + | // 01.10.09 KH (flip-flop) Kill all summary entries between <p> and </p> in search result | ||
| + | // ------------------------------------------------------------------------------------------- | ||
| + | |||
| + | function CP_SEARCH_NO_SUMMARY($text, & $data) { | ||
| + | |||
| + | if( $data['acontent_type'] == 13 ) // CP: 13 => search | ||
| + | { | ||
| + | $text = preg_replace("/\<p\>(.*?)\<\/p\>/si", '', $text); // kill all <p> ....</p> | ||
| + | } | ||
| + | return $text; | ||
| + | } | ||
| + | |||
| + | register_cp_trigger('CP_SEARCH_NO_SUMMARY'); | ||
| + | ?> | ||
| + | </code> | ||
| + | |||
| + | \\ | ||