NAVIGATION
This shows you the differences between two versions of the page.
english:phpwcms_replacer_rts:frontend_render:article-move-into-archive [2009/07/27 14:28] Knut Heermann (flip-flop) |
english:phpwcms_replacer_rts:frontend_render:article-move-into-archive [2018/06/03 18:09] (current) |
||
---|---|---|---|
Line 10: | Line 10: | ||
The Target- or archive category //(where the articles at expiration to be kept)// please register in ** $my_archive_cat **. | The Target- or archive category //(where the articles at expiration to be kept)// please register in ** $my_archive_cat **. | ||
+ | If the switch **[x] archives** is set in category and a visitor accesses the category where the article list is, the expired article is still indicated. At the same time it was shifted into archives. The script is only running if a user visits this category. | ||
+ | |||
+ | If you don´t like this behavior, please open the switch **[ ] Archive** in category. Thus the script runtime increases a little, since the database must be addressed immediately. With small sides (number of articles < 300) that is uncritical. | ||
+ | |||
+ | |||
+ | A navigation for terminated articles in archive are available: [[english/phpwcms_replacer_rts/frontend_render/article-menu-archive]] | ||
**Condition:** | **Condition:** | ||
- | * Source category must be run in article list-mode: **top article count > 1** | + | * Source category must be run in article list-mode: //Site structure - categoriy// --> **top article count > 1** |
- | * Articles in this category **[x](available after end date (archive))** | + | * Articles in this category: //edit article basis information// --> **[x](available after end date (archive))** |
\\ | \\ | ||
+ | |||
**Recommended:** | **Recommended:** | ||
- | * Source category **archive [x]** | + | * Source category = **archive [x]** //(faster processing)// |
* Target category = **archive [x]** | * Target category = **archive [x]** | ||
Line 32: | Line 39: | ||
**CMS version:** >= 1.3.x \\ | **CMS version:** >= 1.3.x \\ | ||
**Version:** V1.0 \\ | **Version:** V1.0 \\ | ||
+ | <code txt|h Update |h> | ||
+ | **27.12.09 KH** | ||
+ | $content['list_mode'] == true | ||
+ | changed to | ||
+ | $content['struct'][$content['cat_id']]['acat_topcount'] > 1 | ||
+ | </code> | ||
Line 54: | Line 67: | ||
/* ***************************************************************************** | /* ***************************************************************************** | ||
Autom. Verschieben von abgelaufenen Artikeln in eine Archivkategorie | Autom. Verschieben von abgelaufenen Artikeln in eine Archivkategorie | ||
- | autom. expired article move into a archive category | + | autom. move of expired article into a archive category |
- | 26.07.09 Knut Heermann (flip-flop) http://planmatrix.de | + | 26.07.09 V1.0 Knut Heermann (flip-flop) http://planmatrix.de |
+ | |||
+ | 27.12.09 Update KH: | ||
+ | $content['listmode'] == true | ||
+ | changed to | ||
+ | $content['struct'][$content['cat_id']]['acat_topcount'] > 1 | ||
Bedingung // Condition: | Bedingung // Condition: | ||
Line 63: | Line 81: | ||
- Artikel in dieser Kategorie "[x](verfuegbar nach Enddatum (archivieren))" | - Artikel in dieser Kategorie "[x](verfuegbar nach Enddatum (archivieren))" | ||
- // Articles in this category "[x](available after end date (archive))" | - // Articles in this category "[x](available after end date (archive))" | ||
- | |||
Empfohlen // Recommended: | Empfohlen // Recommended: | ||
- | Quellkategorie // Source category = Archiv [x] | + | Quellkategorie // Source category = Archiv [x] (Schnellere Abarbeitung // faster processing) |
Zielkategorie // Target category = Archiv [x] | Zielkategorie // Target category = Archiv [x] | ||
Line 82: | Line 99: | ||
// Kategorie-ID in der das Artikel-Listing laeuft (Quelle) | // Kategorie-ID in der das Artikel-Listing laeuft (Quelle) | ||
// Category-ID where the article listing is running (source) | // Category-ID where the article listing is running (source) | ||
- | $my_article_cat = 14; | + | $my_article_cat = 4; |
// ID der Archiv-Kategorie in die verschoben werden soll (Ziel) | // ID der Archiv-Kategorie in die verschoben werden soll (Ziel) | ||
// ID of the archive category (target) | // ID of the archive category (target) | ||
- | $my_archive_cat = 35; | + | $my_archive_cat = 70; |
// USERINPUT END ================================================== | // USERINPUT END ================================================== | ||
Line 94: | Line 111: | ||
// Nur ausfuehren wenn der Listenmodus in der Kategorie eingeschaltet und die angegebene Kategorie aktiv ist | // Nur ausfuehren wenn der Listenmodus in der Kategorie eingeschaltet und die angegebene Kategorie aktiv ist | ||
// Only run if list mode in category is true and the specified category is active | // Only run if list mode in category is true and the specified category is active | ||
- | if( $content['list_mode'] == true && $content['cat_id'] == $my_article_cat) { | + | // if( $content['list_mode'] == true && $content['cat_id'] == $my_article_cat) { |
+ | |||
+ | // Update 27.12.09 KH: | ||
+ | // Nur ausfuehren wenn in der Kategorie "Anzahl an Top-Artikeln:" > 1 und die angegebene Kategorie aktiv ist | ||
+ | // Only run if in category "top article count:" > 1 and the specified category is active | ||
+ | if( ($content['struct'][$content['cat_id']]['acat_topcount'] > 1) && ($content['cat_id'] == $my_article_cat) ) { | ||
- | // Gibt es einen Artikel bei dem das Datum abgelaufen ist? | ||
- | // Is there an article with expired date? | ||
$article = array(); | $article = array(); | ||
- | $my_time = time(); // for faster processing | ||
- | foreach($content['articles'] as $key => $value) { | + | // Kategorie-Schalter [x] Archive gesetzt? (fuer schnellere Abarbeitung) |
+ | // Category switch [x] archive set? (for faster prcessing) | ||
+ | |||
+ | if ( $content['struct'][$content['cat_id']]['acat_archive'] == 1 ) { | ||
- | if ($content['articles'][$key]['article_killdate'] < $my_time ) { | + | $my_time = time(); // for faster processing |
+ | |||
+ | |||
+ | // Gibt es einen Artikel bei dem das Datum abgelaufen ist? | ||
+ | // Is there an article with expired date? | ||
+ | |||
+ | foreach($content['articles'] as $key => $value) { | ||
+ | |||
+ | if ($content['articles'][$key]['article_killdate'] < $my_time ) { | ||
$article[] = $value['article_id']; | $article[] = $value['article_id']; | ||
- | } | + | } |
- | } | + | } |
- | + | ||
+ | // Kategorie-Schalter [ ] Archive offen ? - etwas langsamere Verarbeitung | ||
+ | // Category switch [x] archive unset? - slow down prcessing a little bit | ||
+ | } else | ||
+ | { | ||
+ | $article[0] = 0; // Fuer Aktivierung sql-Update // for activating sql-update | ||
+ | } | ||
+ | |||
// Wenn mindestens ein Artikel vorhanden ist | // Wenn mindestens ein Artikel vorhanden ist | ||
// If minimum one article exists | // If minimum one article exists | ||
- | if(count($article)) { | + | if(count($article)) { |
$sql = 'UPDATE '.DB_PREPEND.'phpwcms_article SET '; | $sql = 'UPDATE '.DB_PREPEND.'phpwcms_article SET '; | ||
Line 121: | Line 159: | ||
} | } | ||
} | } | ||
+ | |||
?> | ?> | ||
</code> | </code> | ||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | <note> | ||
+ | **If you liked to have the version for several categories and archives, please donate or write wiki articles or translate some.** \\ | ||
+ | \\ | ||
+ | ..... The IDs of the source categories //(where the article list is)// please register in the array **$my_article_cat_id['source']**. | ||
+ | The Target- or archive categories //(where the articles at expiration to be kept)// please register in **$my_article_cat_id['archive']**. | ||
+ | |||
+ | These are registered as pairs into the two arrays, every source category with one target category. | ||
+ | |||
+ | $my_article_cat_id['source'] = array( 4, 71, 90, 230) article-listing-categories | ||
+ | | | | | | ||
+ | $my_article_cat_id['archive'] = array(70, 72, 95, 150) article-archive-categories | ||
+ | |||
+ | ..... An assignable number of years can be add and stored to the end-date, in order to be able to navigate in archives with the built-in function article menu. The number of years should be added registered into the variable **$boost_year**. \\ | ||
+ | E.g. ##$boost_year = '10';## //(for +10 years: 2009-05-07 20:34:00 --> 2019-05-07 20:34:00) ....// | ||
+ | |||
+ | </note> | ||
+ | |||
+ |