Link to category below the rating box

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
EnaDva
Posts: 6
Joined: Sat Sep 03, 2005 1:57 am

Link to category below the rating box

Post by EnaDva »

I need a category specified under the rating box "You cannot comment on this entry | Content Overview: Category" to work as a link to this category/subcategory. Now there's just the name of a category specified.

What should I change. Can someone help, please? I use phpMyFAQ 1.4.11.
Thorsten
Posts: 15834
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

this was lost during one of the 1.4.x versions... :-(

I'll work on a fix for that!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
EnaDva
Posts: 6
Joined: Sat Sep 03, 2005 1:57 am

Post by EnaDva »

Thank you. What exactly do you mean?
Will you try to fix this with the new version or will you provide instructions on how to fix this in my version 1.4.11?
Thorsten
Posts: 15834
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

both. :-)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
EnaDva
Posts: 6
Joined: Sat Sep 03, 2005 1:57 am

Post by EnaDva »

Hi,

Any news?
When can I expect your instructions on how to fix this in version 1.4.11?
Thorsten
Posts: 15834
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

please try the following code for artikel.php:

Code: Select all

<?php
/******************************************************************************
 * Datei:				artikel.php
 * Autor:				Thorsten Rinne <thorsten@phpmyfaq.de>
 * Contributors:		Meikel Katzengreis <meikel@katzengreis.com>
 * Datum:				2002-08-27
 * Letzte Änderung:		2005-01-09
 * Copyright:           (c) 2001-2005 Thorsten Rinne
 * 
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 ******************************************************************************/

if (isset($_REQUEST["cat"]) && checkIntVar($_REQUEST["cat"]) == TRUE) {
	$rubrik = $_REQUEST["cat"];
	}
if (isset($_REQUEST["id"]) && checkIntVar($_REQUEST["id"]) == TRUE) {
	$id = $_REQUEST["id"];
	}
if (isset($_GET["artlang"])) {
	$lang = $_GET["artlang"];
	}
if (isset($_POST["artlang"]) && $_POST["artlang"] != "") {
	$lang = $_POST["artlang"];
	}

Tracking("artikelview", $id);

$comment = "";
$result = $db->query("SELECT id, rubrik, content, datum, author, email, comment FROM ".SQLPREFIX."faqdata WHERE id = '".$id."' AND lang = '".$lang."' AND active = 'yes'");
while ($row = $db->fetch_object($result)) {
	$id = $row->id;
	$comment = $row->comment;
	logViews($id, $lang);
    $output = stripslashes($row->content);
	if (@is_dir("attachments/")  && @is_dir("attachments/".$id) && isset($PMF_CONF["disatt"])) {
		$files = 0;
		$outstr = "";
		$dir = opendir("attachments/".$id);
		
		while ($dat = readdir($dir)) {
			if ($dat != "." && $dat != "..") {
				$files++;
				$outstr .= "<a href=\""."attachments/".$id."/".$dat."\" target=\"_blank\">".$dat."</a>, ";
				}
			}
		if ($files > 0) {
			$output .= "<p>".$PMF_LANG["msgAttachedFiles"]." ".substr($outstr, 0, -2)."</p>";
			}
		}
	$writeDateMsg = makeDate($row->datum);
	$writeAuthor = $row->author;
    $categoryName = $tree->getPath($row->rubrik);
    $parent = $tree->categoryName[$row->rubrik]["parent_id"];
	}

$writePrintMsg = "<a href=\"javascript:printarticle('".$id."','".$lang."');\">".$PMF_LANG["msgPrinterFriendly"]."</a>";
$writePDF = "<a target=\"_blank\" href=\"pdf.php?id=".$id."&lang=".$lang."\"> ".$PMF_LANG["msgPDF"]."</a>";
$writeSend2FriendMsg = "<a href=\"".$_SERVER["PHP_SELF"]."?".$sids."action=send2friend&cat=".$rubrik."&id=".$id."&artlang=".$lang."\">".$PMF_LANG["msgSend2Friend"]."</a>";
$writeXMLMsg = "<a href=\"".$_SERVER["PHP_SELF"]."?".$sids."action=xml&id=".$id."&artlang=".$lang."\">".$PMF_LANG["msgMakeXMLExport"]."</a>";
$changeLanguagePATH = $_SERVER["PHP_SELF"]."?".$sids."action=artikel&cat=".$rubrik."&id=".$id;
$writeCommentMsg = $PMF_LANG["msgYouCan"]."<a href=\"".$_SERVER["PHP_SELF"]."?".$sids."action=writecomment&id=".$id."&artlang=".$lang."\">".$PMF_LANG["msgWriteComment"]."</a>";
$writeCategory = stripslashes($categoryName)."<br />\n";
$writeCategory_2 = "<a href=\"".$_SERVER["PHP_SELF"]."?".$sids."action=show&cat=".$parent."\">".stripslashes($categoryName)."</a><br />\n";
$saveVotingPATH = $_SERVER["PHP_SELF"]."?".$sids."action=savevoting";

$content = preg_replace_callback("{(<pre>.*</pre>)}siU", "pre_core", $output);
$content = preg_replace_callback("{(<pre+.*</pre>)}siU", "pre_core", $output);

if (isset($_REQUEST["highlight"]) && $_REQUEST["highlight"] != "/" && $_REQUEST["highlight"] != "<" && $_REQUEST["highlight"] != ">") {
    $highlight = $_REQUEST["highlight"];
    $highlight = str_replace("/", "\/", $highlight);
    $content = preg_replace('/(((href|src)="[^"]*)?'.$highlight.'(?(1).*"))/mies', "highlight_no_links(\"\\1\")", $content);
	}

$arrLanguage = check4Language($id);
$switchLanguage = "";
$check4Lang = "";
$num = count($arrLanguage);
if ($num > 1) {
	foreach ($arrLanguage as $language) {
		$check4Lang .= "<option value=\"".$language."\">".$languageCodes[strtoupper($language)]."</option>\n";
		}
	$switchLanguage .= "<p>\n";
    $switchLanguage .= "<fieldset>\n";
    $switchLanguage .= "<legend>".$PMF_LANG["msgLangaugeSubmit"]."</legend>\n";
	$switchLanguage .= "<form action=\"".$changeLanguagePATH."\" method=\"post\" style=\"display: inline;\">\n";
	$switchLanguage .= "<select name=\"artlang\" size=\"1\">\n";
	$switchLanguage .= $check4Lang;
	$switchLanguage .= "</select>\n";
	$switchLanguage .= "&nbsp;\n";
	$switchLanguage .= "<input class=\"submit\" type=\"submit\" name=\"submit\" value=\"".$PMF_LANG["msgLangaugeSubmit"]."\" />\n";
    $switchLanguage .= "</fieldset>\n";
	$switchLanguage .= "</form>\n";
	$switchLanguage .= "</p>\n";
	}

$myComment = $writeCommentMsg;
if ($comment == "n") {
	$myComment = $PMF_LANG["msgWriteNoComment"];
	}

$tpl->processTemplate ("writeContent", array(
				"writeRubrik" => $writeCategory,
				"writeThema" => stripslashes(getThema($id, $lang)),
				"writeContent" => $content,
				"writeDateMsg" => $PMF_LANG["msgLastUpdateArticle"].$writeDateMsg,
				"writeAuthor" => $PMF_LANG["msgAuthor"].$writeAuthor,
				"writePrintMsg" => $writePrintMsg,
				"writePDF" => $writePDF,
				"writeSend2FriendMsg" => $writeSend2FriendMsg,
				"writeXMLMsg" => $writeXMLMsg,
				"saveVotingPATH" => $saveVotingPATH,
				"saveVotingID" => $id,
				"saveVotingIP" => $_SERVER["REMOTE_ADDR"],
				"msgAverageVote" => $PMF_LANG["msgAverageVote"],
				"printVotings" => generateVoting($id),
				"switchLanguage" => $switchLanguage,
				"msgVoteUseability" => $PMF_LANG["msgVoteUseability"],
				"msgVoteBad" => $PMF_LANG["msgVoteBad"],
				"msgVoteGood" => $PMF_LANG["msgVoteGood"],
				"msgVoteSubmit" => $PMF_LANG["msgVoteSubmit"],
				"writeCommentMsg" => $myComment,
				"writeListMsg" => $PMF_LANG["msgShowCategory"].$writeCategory_2,
				"writeComments" => generateComments($id)
				));

$tpl->includeTemplate("writeContent", "index");
?>
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
EnaDva
Posts: 6
Joined: Sat Sep 03, 2005 1:57 am

Post by EnaDva »

Hi,

It works. Thank you.
If I'm reading one of the questions in "Category/Subcategory/5 questions" I can see under the rating box "You cannot comment on this entry | Content Overview: Category>>Subcategory" which works as a link.

But there's one problem:
If I click to this link Category>>Subcategory I expect to see those 5 questions specified under Subcategory (to take me 1 step back). Instead of this I'm linked to questions specified under Category (instead of under Subcategory) whick takes me 2 steps back. It's not logical.
Can you do something about it?
Thorsten
Posts: 15834
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

please check this code:

Code: Select all

<?php
/******************************************************************************
 * Datei:				artikel.php
 * Autor:				Thorsten Rinne <thorsten@phpmyfaq.de>
 * Contributors:		Meikel Katzengreis <meikel@katzengreis.com>
 * Datum:				2002-08-27
 * Letzte Änderung:		2005-01-09
 * Copyright:           (c) 2001-2005 Thorsten Rinne
 * 
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 * 
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 ******************************************************************************/

if (isset($_REQUEST["cat"]) && checkIntVar($_REQUEST["cat"]) == TRUE) {
	$rubrik = $_REQUEST["cat"];
	}
if (isset($_REQUEST["id"]) && checkIntVar($_REQUEST["id"]) == TRUE) {
	$id = $_REQUEST["id"];
	}
if (isset($_GET["artlang"])) {
	$lang = $_GET["artlang"];
	}
if (isset($_POST["artlang"]) && $_POST["artlang"] != "") {
	$lang = $_POST["artlang"];
	}

Tracking("artikelview", $id);

$comment = "";
$result = $db->query("SELECT id, rubrik, content, datum, author, email, comment FROM ".SQLPREFIX."faqdata WHERE id = '".$id."' AND lang = '".$lang."' AND active = 'yes'");
while ($row = $db->fetch_object($result)) {
	$id = $row->id;
	$comment = $row->comment;
	logViews($id, $lang);
    $output = stripslashes($row->content);
	if (@is_dir("attachments/")  && @is_dir("attachments/".$id) && isset($PMF_CONF["disatt"])) {
		$files = 0;
		$outstr = "";
		$dir = opendir("attachments/".$id);
		
		while ($dat = readdir($dir)) {
			if ($dat != "." && $dat != "..") {
				$files++;
				$outstr .= "<a href=\""."attachments/".$id."/".$dat."\" target=\"_blank\">".$dat."</a>, ";
				}
			}
		if ($files > 0) {
			$output .= "<p>".$PMF_LANG["msgAttachedFiles"]." ".substr($outstr, 0, -2)."</p>";
			}
		}
	$writeDateMsg = makeDate($row->datum);
	$writeAuthor = $row->author;
    $categoryName = $tree->getPath($row->rubrik);
    $parent = $tree->categoryName[$row->rubrik]["parent_id"];
    $parentName = $tree->categoryName[$parent]["name"];
	}

$writePrintMsg = "<a href=\"javascript:printarticle('".$id."','".$lang."');\">".$PMF_LANG["msgPrinterFriendly"]."</a>";
$writePDF = "<a target=\"_blank\" href=\"pdf.php?id=".$id."&lang=".$lang."\"> ".$PMF_LANG["msgPDF"]."</a>";
$writeSend2FriendMsg = "<a href=\"".$_SERVER["PHP_SELF"]."?".$sids."action=send2friend&cat=".$rubrik."&id=".$id."&artlang=".$lang."\">".$PMF_LANG["msgSend2Friend"]."</a>";
$writeXMLMsg = "<a href=\"".$_SERVER["PHP_SELF"]."?".$sids."action=xml&id=".$id."&artlang=".$lang."\">".$PMF_LANG["msgMakeXMLExport"]."</a>";
$changeLanguagePATH = $_SERVER["PHP_SELF"]."?".$sids."action=artikel&cat=".$rubrik."&id=".$id;
$writeCommentMsg = $PMF_LANG["msgYouCan"]."<a href=\"".$_SERVER["PHP_SELF"]."?".$sids."action=writecomment&id=".$id."&artlang=".$lang."\">".$PMF_LANG["msgWriteComment"]."</a>";
$writeCategory = stripslashes($categoryName)."<br />\n";
$writeCategory_2 = "<a href=\"".$_SERVER["PHP_SELF"]."?".$sids."action=show&cat=".$parent."\">".stripslashes($parentName)."</a><br />\n";
$saveVotingPATH = $_SERVER["PHP_SELF"]."?".$sids."action=savevoting";

$content = preg_replace_callback("{(<pre>.*</pre>)}siU", "pre_core", $output);
$content = preg_replace_callback("{(<pre+.*</pre>)}siU", "pre_core", $output);

if (isset($_REQUEST["highlight"]) && $_REQUEST["highlight"] != "/" && $_REQUEST["highlight"] != "<" && $_REQUEST["highlight"] != ">") {
    $highlight = $_REQUEST["highlight"];
    $highlight = str_replace("/", "\/", $highlight);
    $content = preg_replace('/(((href|src)="[^"]*)?'.$highlight.'(?(1).*"))/mies', "highlight_no_links(\"\\1\")", $content);
	}

$arrLanguage = check4Language($id);
$switchLanguage = "";
$check4Lang = "";
$num = count($arrLanguage);
if ($num > 1) {
	foreach ($arrLanguage as $language) {
		$check4Lang .= "<option value=\"".$language."\">".$languageCodes[strtoupper($language)]."</option>\n";
		}
	$switchLanguage .= "<p>\n";
    $switchLanguage .= "<fieldset>\n";
    $switchLanguage .= "<legend>".$PMF_LANG["msgLangaugeSubmit"]."</legend>\n";
	$switchLanguage .= "<form action=\"".$changeLanguagePATH."\" method=\"post\" style=\"display: inline;\">\n";
	$switchLanguage .= "<select name=\"artlang\" size=\"1\">\n";
	$switchLanguage .= $check4Lang;
	$switchLanguage .= "</select>\n";
	$switchLanguage .= "&nbsp;\n";
	$switchLanguage .= "<input class=\"submit\" type=\"submit\" name=\"submit\" value=\"".$PMF_LANG["msgLangaugeSubmit"]."\" />\n";
    $switchLanguage .= "</fieldset>\n";
	$switchLanguage .= "</form>\n";
	$switchLanguage .= "</p>\n";
	}

$myComment = $writeCommentMsg;
if ($comment == "n") {
	$myComment = $PMF_LANG["msgWriteNoComment"];
	}

$tpl->processTemplate ("writeContent", array(
				"writeRubrik" => $writeCategory,
				"writeThema" => stripslashes(getThema($id, $lang)),
				"writeContent" => $content,
				"writeDateMsg" => $PMF_LANG["msgLastUpdateArticle"].$writeDateMsg,
				"writeAuthor" => $PMF_LANG["msgAuthor"].$writeAuthor,
				"writePrintMsg" => $writePrintMsg,
				"writePDF" => $writePDF,
				"writeSend2FriendMsg" => $writeSend2FriendMsg,
				"writeXMLMsg" => $writeXMLMsg,
				"saveVotingPATH" => $saveVotingPATH,
				"saveVotingID" => $id,
				"saveVotingIP" => $_SERVER["REMOTE_ADDR"],
				"msgAverageVote" => $PMF_LANG["msgAverageVote"],
				"printVotings" => generateVoting($id),
				"switchLanguage" => $switchLanguage,
				"msgVoteUseability" => $PMF_LANG["msgVoteUseability"],
				"msgVoteBad" => $PMF_LANG["msgVoteBad"],
				"msgVoteGood" => $PMF_LANG["msgVoteGood"],
				"msgVoteSubmit" => $PMF_LANG["msgVoteSubmit"],
				"writeCommentMsg" => $myComment,
				"writeListMsg" => $PMF_LANG["msgShowCategory"].$writeCategory_2,
				"writeComments" => generateComments($id)
				));

$tpl->includeTemplate("writeContent", "index");
?>
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
EnaDva
Posts: 6
Joined: Sat Sep 03, 2005 1:57 am

Post by EnaDva »

Thank you, but this is not what I need.

Using your last code under the rating box is now specified:
"You cannot comment on this entry | Content Overview: Category" (instead of Category>>Subcategory)
What I need is the previous code:
Category>>Subcategory to be linked to Subcategory questions.
Can you help?
EnaDva
Posts: 6
Joined: Sat Sep 03, 2005 1:57 am

Post by EnaDva »

Hi,

Any possible solution available?
Thorsten
Posts: 15834
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

I hadn't have the time yet to do it. Please write me a mail so I can't forget it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply