Extension talk:LiquidThreadsOverview

About this board

Check on existing pages

2
Tschijv (talkcontribs)

Hi,

Thank you for this extension. Really helpful. The only thing is that it also returns links to already deleted pages. So, I've added some code to prevent from showing these pages. Could you please review this?

		foreach( $res as $row ) {
			$namespace=$lang->getNsText($row->thread_article_namespace);
			$article=str_replace("_"," ",$row->thread_article_title);
			$pagelink=Linker::link(Title::newFromText($namespace.':'.$article),$article);
			$threadlink=Linker::link(Title::newFromText($namespace.':'.$article.'#'.$row->thread_subject.'_'.$row->thread_id),$row->thread_subject);
			$userlink=Linker::link(Title::newFromText($lang->getNsText(NS_USER).':'.$row->thread_author_name),$row->thread_author_name);
			$icontitletext=$lang->getNsText(NS_FILE).':Icon '.$namespace.'.'.$wglqtoIconType;
			$icontitle=Title::newFromText($icontitletext);
			//$iconlink= Linker::makeImageLink($wgParser,$icontitle,wfLocalFile($icontitle),null,Array('height'=>'20px','width'=>'20px'));
			$iconlink="";//$wgParser->parse("[[$icontitletext|20x20px|link=]]",$wgParser->getTitle(),new ParserOptions())->getText();
			

			$titleArticle = Title::newFromText($article);	
			$title = new Article ($titleArticle);
			if ( is_null( $title ) ) {
				print "Couldn't create article";
				return false;
			}
			
			// Only show existing articles
			if($title->exists()) {

				$output.="</tr><tr>";
				if($wglqtoUseIcons) {
					$output.="<td>$iconlink</td>";
				}
	
				$output.="<td>$pagelink</td>";
				$output.="<td>$threadlink</td>";
				$output.="<td>$userlink</td>";
				$output.="<td>".$row->thread_replies.'</td>';
				$output.="<td>".$this->formattime($row->thread_created).'</td>';
				$output.="<td>".$this->formattime($row->thread_modified).'</td>';
				if($summarized=='') {
					$s=wfMessage( 'lqto-summaryno');
					if($row->thread_summary_page!=null)
						$s=wfMessage( 'lqto-summaryyes');
					$output.="<td>$s</td>";
				}
			}
		}
		$output.="</tr></table>";
 
		$wgOut->addHTML( $output );
	}
VolkoV (talkcontribs)

Thanks for the contribution, this looks good, you just forgot about the namespace. Sorry for the late answer, I did not work on this for a long while. In the meanwhile I updated to the actual version and I am facing other problems with the parser which I repaired by now and will upload in conjunction with your contribution.

Reply to "Check on existing pages"
There are no older topics
Return to "LiquidThreadsOverview" page.