From 251c012555464c864670c3d059b8fe4039922965 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sun, 2 Nov 2008 04:21:44 -0500 Subject: [PATCH] Add support for long news entries that display less than they actually have. Signed-off-by: Edward Z. Yang --- XHTMLCompiler/DOMFilter/News.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/XHTMLCompiler/DOMFilter/News.php b/XHTMLCompiler/DOMFilter/News.php index b92a5cd..478a4cd 100644 --- a/XHTMLCompiler/DOMFilter/News.php +++ b/XHTMLCompiler/DOMFilter/News.php @@ -38,6 +38,7 @@ class XHTMLCompiler_DOMFilter_News extends XHTMLCompiler_DOMFilter if (!$limit) $limit = 5; $header = $this->confiscateAttr($container, $this->ns, 'header'); if (!$header) $header = 'h2'; + $increase = $header[1] - 1; // amount increase sub-headings // Recursively glob for source files // :TODO: add DI for this @@ -98,7 +99,12 @@ class XHTMLCompiler_DOMFilter_News extends XHTMLCompiler_DOMFilter // Grab the content // :WARNING: This code apparently leaves behind an // xmlns statement, although we're not quite sure why. - $node = $subdom->getElementById('content'); + $node = $subdom->getElementById('short-content'); + $permText = 'Read more...'; + if (!$node) { + $node = $subdom->getElementById('content'); + $permText = 'Permalink'; + } $node = $dom->importNode($node, true); $this->confiscateAttr($node, 'id'); $node->setAttribute('class', 'body'); @@ -109,7 +115,7 @@ class XHTMLCompiler_DOMFilter_News extends XHTMLCompiler_DOMFilter $permalink->setAttribute('class', 'permalink'); $a = $dom->createElement('a'); $a->setAttribute('href', $entryFile->getAbsolutePath()); - $a->appendChild($dom->createTextNode('Permalink')); + $a->appendChild($dom->createTextNode($permText)); $permalink->appendChild($a); $entryNode->appendChild($permalink); -- 2.11.4.GIT