ich möchte bei den related-tags die verlinkung ändern, sodass er mir nicht mehr eine ID sondern einen korrekten link ausspuckt. als eingabe verwende ich beim gewöhnlichen article-listing "Caption" als Linkeingabe.
i want to change the link-source into the realated-tags and the article-listing. so i use for the link-source into the article-setup (in backend) the article_caption.
in the article-list script shows:
script hierfür (article-list):
Code: Select all
<div class="listingsub">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="310" background="http://www.bleibfit.at/picture/headbalken/1.gif">
<h1 class="articleHead">{SUB}</h1>
</td>
</tr>
</table>
<a title="{TITLE}" href="{CAPTION}" style="margin:4 5 0 0; float:left">{IMAGE}</a>
<a title="{TITLE}" href="{CAPTION}">
<h2 class="articleSubHeadsub">{TITLE}</h2>
<p class="articleSummarysub">{SUMMARY}
<span class="articleMore1">mehr</span>
</p>
</a>
</div>
so i thought, i have to change the "id" to ".$article_caption."
nun muss ich es auch hinbekommen, dass er bei den related-tags NUR "caption" einfügt. doch da kam es zu problemen:
datei: front.func.inc.php: function get_related_articles
bei der verlinkung statt:
Code: Select all
$keyword_links .= $template_default["link_before"].$template_default["link_symbol"];
$keyword_links .= '<a title="'.$article_title.'" href="index.php?id='.$row[2].','.$row[0].',0,0,1,0"';
$keyword_links .= $target.">".html_specialchars($article_title)."</a><br />";
the "id" is changed by the article_caption:
Code: Select all
$keyword_links .= $template_default["link_before"].$template_default["link_symbol"];
$keyword_links .= '<a title="'.$article_title.'" href=".$article_caption."';
$keyword_links .= $target.">".html_specialchars($article_title)."</a><br />";
ich bitte dringend um hilfe, da ich momentan alle artikel weiterleiten muss und die gefahr dass ich bei google auf die spam-liste komme immens hoch ist...
but it doesn´t work. what should i do? if I change the article_id with the article_title it works!! but not with the article_caption, why??
i hope, somebody can help me...
hier das ganze file im front.func.inc.php: function get_related_articles
here you get the total file into front.func.inc.php: funcion get_related_articles
Code: Select all
function get_related_articles($keywords, $current_article_id, $template_default, $max_cnt_links=0, $dbcon) {
// find keyword for current article used for RELATED replacementtag
// prepared and inspired by Magnar Stav Johanssen
$keyword_links = ""; $max_cnt_links = intval($max_cnt_links);
// replace unwanted chars and convert to wanted
$keywords = str_replace(";", ",", $keywords);
$keywords = str_replace("'", "", $keywords);
$keywords = str_replace(" ", ",", $keywords);
// choose comma separated keywords
$keywordarray = explode (",", $keywords);
// check for empty keywords or keywords smaller than 3 chars
if(sizeof($keywordarray)) {
foreach($keywordarray as $key => $value) {
$keywordarray[$key] = trim($value);
if(!$keywordarray[$key] || strlen($keywordarray[$key]) < 3) unset($keywordarray[$key]);
}
}
if(sizeof($keywordarray)) {
$where = "";
foreach($keywordarray as $value) {
//build where keyword = blabla
$where .= ($where) ? " OR " : "";
//replace every "'" to "''" for security reasons with aporeplace()
$where .= "article_keyword LIKE '%".aporeplace($value)."%'";
}
$limit = ($max_cnt_links) ? " LIMIT ".$max_cnt_links : "";
$sql = "SELECT article_id, article_title, article_cid, article_subtitle, article_summary ";
$sql .= "FROM ".DB_PREPEND."phpwcms_article WHERE article_deleted=0 AND ";
$sql .= "article_id<>".intval($current_article_id)." AND ";
// VISIBLE_MODE: 0 = frontend (all) mode, 1 = article user mode, 2 = admin user mode
switch(VISIBLE_MODE) {
case 0: $sql .= "article_public=1 AND article_aktiv=1 AND ";
break;
case 1: $sql .= "article_uid=".$_SESSION["wcs_user_id"]." AND ";
break;
//case 2: admin mode no additional neccessary
}
$sql .= "article_begin < NOW() AND article_end > NOW() AND (".$where.") ";
$sql .= "ORDER BY article_tstamp DESC".$limit;
// related things
$target = ($template_default["link_target"]) ? ' target="'.$template_default["link_target"].'"' : "";
if($result = mysql_query($sql, $dbcon)) {
$count_results = mysql_num_rows($result); $count = 0;
while ($row = mysql_fetch_row($result)) {
$count++;
if($template_default["link_length"] && strlen($row[1]) > $template_default["link_length"]) {
$article_title = substr($row[1], 0, $template_default["link_length"]).$template_default["cut_title_add"];
} else {
$article_title = $row[1];
}
$keyword_links .= $template_default["link_before"].$template_default["link_symbol"];
$keyword_links .= '<a title="'.$article_title.'" href="index.php?id='.$row[2].','.$row[0].',0,0,1,0"';
$keyword_links .= $target.">".html_specialchars($article_title)."</a><br />";
//try to remove possible unwanted after - if not enclosed before.link.after
if($keyword_links && !$template_default["link_before"] && $count < $count_results) {
$keyword_links .= $template_default["link_after"];
}
}
mysql_free_result($result);
}
}
//enclose whole
if($keyword_links) $keyword_links = $template_default["before"].$keyword_links.$template_default["after"];
return $keyword_links;
}
best regards from vienna
Manuel