[Scummvm-cvs-logs] SF.net SVN: scummvm:[49218] web/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue May 25 21:25:33 CEST 2010
Revision: 49218
http://scummvm.svn.sourceforge.net/scummvm/?rev=49218&view=rev
Author: fingolfin
Date: 2010-05-25 19:25:33 +0000 (Tue, 25 May 2010)
Log Message:
-----------
WEB: Rewrote FAQ code so that the numerical anchors are always present, even if a FAQ entry gets an explicit name/id (so that existing links are not broken)
Modified Paths:
--------------
web/trunk/include/Objects/QAEntry.php
web/trunk/templates/faq.tpl
Modified: web/trunk/include/Objects/QAEntry.php
===================================================================
--- web/trunk/include/Objects/QAEntry.php 2010-05-25 18:48:50 UTC (rev 49217)
+++ web/trunk/include/Objects/QAEntry.php 2010-05-25 19:25:33 UTC (rev 49218)
@@ -5,7 +5,7 @@
* F.A.Q. page.
*/
class QAEntry extends BasicObject {
- private $_href;
+ private $_hrefs;
private $_question;
private $_answer;
private $_xref;
@@ -19,23 +19,29 @@
* @param array $xref reference to xref map
*/
public function __construct($data, $section_number, $entry_number, &$xref) {
- if (empty($data['href'])) {
- $this->_href = "{$section_number}_{$entry_number}";
- } else {
- $this->_href = $data['href'];
+ $this->_hrefs = array();
+ if (! empty($data['href'])) {
+ array_push($this->_hrefs, $data['href']);
$xref[$data['href']] = $data['question'];
}
+ array_push($this->_hrefs, "{$section_number}_{$entry_number}");
+
$this->_question = $data['question'];
$this->_answer = $data['answer'];
/* Save a reference to the xref table for later use. */
$this->_xref = &$xref;
}
- /* Get the anchor name for this entry. */
+ /* Get the primary anchor name for this entry. */
public function getHref() {
- return $this->_href;
+ return $this->_hrefs[0];
}
+ /* Get all anchor names for this entry. */
+ public function getHrefs() {
+ return $this->_hrefs;
+ }
+
/* Get the question for this entry. */
public function getQuestion() {
return $this->_question;
Modified: web/trunk/templates/faq.tpl
===================================================================
--- web/trunk/templates/faq.tpl 2010-05-25 18:48:50 UTC (rev 49217)
+++ web/trunk/templates/faq.tpl 2010-05-25 19:25:33 UTC (rev 49218)
@@ -31,7 +31,11 @@
</dl>
{foreach from=$section->getEntries() item=entry name='entry_loop'}
{assign var='entry_num' value=$smarty.foreach.entry_loop.iteration}
- <div class="question">{$section_num}.{$entry_num}. <a name="{$entry->getHref()}"></a>{$entry->getQuestion()}</div>
+ <div class="question">{$section_num}.{$entry_num}.
+ {foreach from=$entry->getHrefs() item=href name='href_loop'}
+ <a name="{$href}"></a>
+ {/foreach}
+ {$entry->getQuestion()}</div>
<div class="answer">{$entry->getAnswer()}</div>
{/foreach}
</div>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list