[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    www/media/includes/classes
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2011-05-11 21:58:00
Message-ID: 20110511215800.76902AC88B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1231439 by aacid:

and now allow to specify the $anchor in a way i don't break all kde websites


 M  +10 -5     class_faq.inc  


--- trunk/www/media/includes/classes/class_faq.inc #1231438:1231439
@@ -16,9 +16,9 @@
 	{
 	}
 
-	function addQuestion($question_text, $answer_text)
+	function addQuestion($question_text, $answer_text, $anchor = "")
 	{
-		$question = new Question($question_text, $answer_text);
+		$question = new Question($question_text, $answer_text, $anchor);
 		array_push($this->items, $question);
 	}
 
@@ -70,22 +70,27 @@
 {
 	var $question;
 	var $answer;
+	var $anchor;
 
-	function Question($question, $answer)
+	function Question($question, $answer, $anchor = "")
 	{
 		$this->question = $question;
 		$this->answer = $answer;
+		if ($anchor == "")
+			$this->anchor = ereg_replace("[^a-zA-Z]", "", $this->question);
+		else
+			$this->anchor = $anchor;
 	}
 
 	function showQuestion()
 	{
-		print "<li><a href=\"#" . ereg_replace("[^a-zA-Z]", "", $this->question) . \
"\">$this->question</a></li>\n"; +		print "<li><a \
href=\"#$this->anchor\">$this->question</a></li>\n";  }
 
 	function showAnswer()
 	{
 		global $site_locale;
-		print "<h4><a name=\"" . ereg_replace("[^a-zA-Z]", "", $this->question) . \
"\">$this->question</a></h4>\n"; +		print "<h4><a \
name=\"$this->anchor\">$this->question</a></h4>\n";  print "<p>$this->answer</p>\n";
 		print "<p><a href=\"#questions\">". i18n_var("[Up to Questions]") . "</a></p>\n";
 	}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic