NAVIGATION
This shows you the differences between two versions of the page.
english:phpwcms_replacer_rts:frontend_render:link-article-alias-id [2011/11/28 17:03] Knut Heermann (flip-flop) |
english:phpwcms_replacer_rts:frontend_render:link-article-alias-id [2018/06/03 18:09] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
====== Quick Article link with ALIAS/ID ====== | ====== Quick Article link with ALIAS/ID ====== | ||
- | A single TAG that makes a link, automatically grabs the title of the destination article and inserts that as the link text. \\ | + | A single TAG that makes a link, automatically grabs the title of the destination article and insert the title as link text. |
##**[QIDA|qIDA **article-alias or article-ID**]**## \\ | ##**[QIDA|qIDA **article-alias or article-ID**]**## \\ | ||
---- | ---- | ||
- | **rt_qida_link_to_article_alias** V1.0a 28.11.2011 | + | **rt_qida_link_to_article_alias** V1.0b 28.11.2011 |
Docu: -- \\ | Docu: -- \\ | ||
Line 16: | Line 17: | ||
**Author:** K.Heermann (flip-flop) http://planmatrix.de \\ | **Author:** K.Heermann (flip-flop) http://planmatrix.de \\ | ||
**CMS Version:** >= 1.3 \\ | **CMS Version:** >= 1.3 \\ | ||
- | **Version:** V1.0a \\ | + | **Version:** V1.0b \\ |
Line 47: | Line 48: | ||
* frontend_render-Script: Link to article alias/id | * frontend_render-Script: Link to article alias/id | ||
* A single tag that makes a link, automatically grabs the title of the destination article | * A single tag that makes a link, automatically grabs the title of the destination article | ||
- | * and inserts that as the link text | + | * and insert the title as link text |
- | * TAGs: [QIDA|[qIDA article alias/article id] | + | * TAGs: [QIDA|[qIDA article alias|article id] |
********************************************************************************************* | ********************************************************************************************* | ||
*/ | */ | ||
Line 67: | Line 68: | ||
if ( isset($match['1']) AND !empty($match['1']) ) { // if match found, replace | if ( isset($match['1']) AND !empty($match['1']) ) { // if match found, replace | ||
+ | // Separate IDs and articles TAGs | ||
$id_i = ''; | $id_i = ''; | ||
$id_a = ''; | $id_a = ''; | ||
Line 73: | Line 75: | ||
// ID or alias input?? // ID oder alias Eingabe???? | // ID or alias input?? // ID oder alias Eingabe???? | ||
if ((int)$value == $value AND (int)$value != 0) | if ((int)$value == $value AND (int)$value != 0) | ||
- | $id_i .= $value.','; | + | $id_i .= trim($value).','; |
else | else | ||
- | $id_a .= "'".$value."',"; | + | $id_a .= "'".strtolower(trim($value))."',"; |
} | } | ||
- | $count = substr_count($id_i, ','); // Count the entries for a better db performance (LIMIT) | + | // Count all possible matches for a better db performance (LIMIT) |
- | $count = $count + substr_count($id_a, ","); // Count the entries 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_i = substr($id_i, 0, -1); // Kill the last sign "," | ||
Line 111: | Line 114: | ||
$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 | // Output alias link | ||
- | $content["all"] = str_replace('[QIDA '.$value['article_alias'].']',$link, $content["all"] ); | + | $content["all"] = preg_replace('/\[QIDA '.$value['article_alias'].'\]/im',$link, $content["all"] ); |
- | $content["all"] = str_replace('[qIDA '.$value['article_alias'].']',$link, $content["all"] ); | + | |
} | } | ||
else { | else { | ||
Line 125: | Line 127: | ||
\\ | \\ | ||
- | * In “$hidden_article” article IDs can be registered, which are excluded from selection. ('23,56,74,12,…') please use apostrophes at the beginning and end! | + | * In “$hidden_article” article IDs can be registered, which then will be excluded from selection. //%%('23,56,74,12,...')%% please use apostrophes at the beginning and end!// |
+ | \\ | ||
\\ | \\ |