{{indexmenu_n>100}} ====== Quick Artikellink mit ALIAS/ID ====== Ein einfacher TAG der einen Link aufgrund der/s Artikel-ID/Alias erzeugt, welcher automatisch den Titel des Artikels als Linktext verwendet. ##**[QIDA|qIDA** Artikel-Alias oder Artikel-ID**]**## \\ ---- **rt_qida_link_to_article_alias** V1.0b 28.11.2011 Docu: -- \\ Forum: [[http://forum.phpwcms.org/viewtopic.php?p=133283]] **Autor:** K.Heermann (flip-flop) http://planmatrix.de \\ **CMS Version:** >= 1.3 \\ **Version:** V1.0b \\ TAGs: [QIDA|qIDA Artikel-Alias oder Artikel-ID] \\ Dateiname: **rt_qida_link_to_article_alias.php** Verzeichnis: ** template/inc_script/frontend_render/ ** **Bedingung:** -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\ * $phpwcms['allow_ext_render'] = 1; ---- ---- \\ ===== Script: ===== $value) { // ID or alias input?? // ID oder alias Eingabe???? if ((int)$value == $value AND (int)$value != 0) $id_i .= trim($value).','; else $id_a .= "'".strtolower(trim($value))."',"; } // Count all possible matches for a better db performance (LIMIT) $count = substr_count($id_i, ','); $count = $count + substr_count($id_a, ","); $id_i = substr($id_i, 0, -1); // Kill the last sign "," $id_a = substr($id_a, 0, -1); // Kill the last sign "," // fill up the var with minimum content for a right db search if (empty($id_i)) $id_i = 0; if (empty($id_a)) $id_a = "'!n00p!'"; // Artikel in der DB suchen // Search for the article in dba $sql = "SELECT article_id, article_cid, article_alias, article_title, article_subtitle "; $sql .= "FROM ".DB_PREPEND."phpwcms_article "; $sql .= "WHERE (article_alias IN (".$id_a.") OR article_id IN (".$id_i.")) "; $sql .= "AND article_public=1 AND article_aktiv=1 AND article_deleted=0 "; $sql .= "AND (article_archive_status=1 AND article_begin$value) { // Setup the link $link = ''.$value['article_title'].''; // Output id link $content["all"] = str_replace('[QIDA '.$value['article_id'].']',$link, $content["all"] ); $content["all"] = str_replace('[qIDA '.$value['article_id'].']',$link, $content["all"] ); // Output alias link $content["all"] = preg_replace('/\[QIDA '.$value['article_alias'].'\]/im',$link, $content["all"] ); } else { $content["all"] = preg_replace('/\[QIDA (.*?)\]/im','[[No Link set!]]', $content["all"] ); } } // END ( isset($match['1']) } ?> \\ * In "$hidden_article" können Artikel-IDs eingetragen werden, die von der Selektion ausgenommen sind. //%%('23,56,74,12,...')%% Hochkommata am Anfang und Ende verwenden!// \\