NAVIGATION
This shows you the differences between two versions of the page.
|
deutsch:ersetzer_rts:frontend_render:wrap-article-list [2010/02/23 23:03] Knut Heermann (flip-flop) |
deutsch:ersetzer_rts:frontend_render:wrap-article-list [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 7: | Line 7: | ||
| Dazu werden im jeweiligen Template zwei neue Tags benötigt **%%<!--ARTICLEX_ENTRY//-->%%** und **%%<!--ARTICLEX_END//-->%%**. | Dazu werden im jeweiligen Template zwei neue Tags benötigt **%%<!--ARTICLEX_ENTRY//-->%%** und **%%<!--ARTICLEX_END//-->%%**. | ||
| + | |||
| + | Eingebaute Alternative //(seit V1.3.3 2007-05-18)//: [[deutsch/phpwcms-system/artikel#wrapper_fuer_artikellisten_-und_detaildarstellung|Wrapper für Artikellisten -und Detaildarstellung:]] | ||
| \\ | \\ | ||
| Line 100: | Line 102: | ||
| <?php | <?php | ||
| /** | /** | ||
| - | ******************************************************************* | + | ******************************************************************* |
| * | * | ||
| * 23.02.2010 Wrap an article list | * 23.02.2010 Wrap an article list | ||
| Line 119: | Line 121: | ||
| * | * | ||
| * Forum: http://forum.phpwcms.org/viewtopic.php?p=110038#p110038 | * Forum: http://forum.phpwcms.org/viewtopic.php?p=110038#p110038 | ||
| - | *******************************************************************/ | + | *******************************************************************/ |
| // ---------------------------------------------------------------- | // ---------------------------------------------------------------- | ||
| // obligate check for phpwcms constants | // obligate check for phpwcms constants | ||
| Line 133: | Line 135: | ||
| if( ! (strpos($content["all"],'<!--ARTICLEX_ENTRY//-->') === false)) { | if( ! (strpos($content["all"],'<!--ARTICLEX_ENTRY//-->') === false)) { | ||
| + | // -----CUSTOM------------------------------------ | ||
| + | |||
| $_prefix = '<div class="whow">'; // before articles-list | $_prefix = '<div class="whow">'; // before articles-list | ||
| $_suffix = '</div>'; // behind articles-list | $_suffix = '</div>'; // behind articles-list | ||
| + | $_a_entry = '<!--ARTICLEX_ENTRY//-->'; | ||
| + | $_a_end = '<!--ARTICLEX_END//-->'; | ||
| + | |||
| + | // ----------------------------------------------- | ||
| - | $content["all"] = preg_replace('/\<!--ARTICLEX_ENTRY\/\/--\>/im',$_prefix.LF,$content["all"],1); | + | // reverting for faster replace |
| - | $content["all"] = substr_replace($content["all"], $_suffix.LF, strripos ($content["all"],'<!--ARTICLEX_END//-->'), 21); | + | $_a_end = strrev($_a_end); |
| + | $_suffix = strrev($_suffix); | ||
| + | |||
| + | // make a regex like pattern | ||
| + | $_a_entry = preg_quote($_a_entry, '/'); | ||
| + | $_a_end = preg_quote($_a_end, '/'); | ||
| + | |||
| + | |||
| + | // Only the first entry | ||
| + | // ---------------------------------- | ||
| + | $content["all"] = preg_replace('/'.$_a_entry.'/',$_prefix.LF,$content["all"],1); | ||
| + | |||
| + | // Only the last entry (reverting is much faster as REGEX (last)) | ||
| + | // ---------------------------------- | ||
| + | $content["all"] = strrev($content["all"]); | ||
| + | $content["all"] = preg_replace('/'.$_a_end.'/',$_suffix.LF,$content["all"],1); | ||
| + | $content["all"] = strrev($content["all"]); | ||
| + | |||
| } | } | ||
| ?> | ?> | ||
| </code> | </code> | ||