<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://katlas.org/index.php?action=history&amp;feed=atom&amp;title=IfPageExists.php</id>
	<title>IfPageExists.php - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://katlas.org/index.php?action=history&amp;feed=atom&amp;title=IfPageExists.php"/>
	<link rel="alternate" type="text/html" href="https://katlas.org/index.php?title=IfPageExists.php&amp;action=history"/>
	<updated>2026-04-21T07:06:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://katlas.org/index.php?title=IfPageExists.php&amp;diff=1688741&amp;oldid=prev</id>
		<title>Scott at 13:55, 15 July 2007</title>
		<link rel="alternate" type="text/html" href="https://katlas.org/index.php?title=IfPageExists.php&amp;diff=1688741&amp;oldid=prev"/>
		<updated>2007-07-15T13:55:04Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:55, 15 July 2007&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This is now deprecated, replaced by mediawiki&#039;s ParserFunction extension, in particular the parser function #ifexist:&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;?php&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;?php&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Scott</name></author>
	</entry>
	<entry>
		<id>https://katlas.org/index.php?title=IfPageExists.php&amp;diff=110492&amp;oldid=prev</id>
		<title>Scott at 01:11, 30 August 2005</title>
		<link rel="alternate" type="text/html" href="https://katlas.org/index.php?title=IfPageExists.php&amp;diff=110492&amp;oldid=prev"/>
		<updated>2005-08-30T01:11:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
# Example WikiMedia extension&lt;br /&gt;
# with WikiMedia&amp;#039;s extension mechanism it is possible to define&lt;br /&gt;
# new tags of the form&lt;br /&gt;
# &amp;lt;TAGNAME&amp;gt; some text &amp;lt;/TAGNAME&amp;gt;&lt;br /&gt;
# the function registered by the extension gets the text between the&lt;br /&gt;
# tags as input and can transform it into arbitrary HTML code.&lt;br /&gt;
# Note: The output is not interpreted as WikiText but directly&lt;br /&gt;
#       included in the HTML output. So Wiki markup is not supported.&lt;br /&gt;
# To activate the extension, include it from your LocalSettings.php&lt;br /&gt;
# with: include(&amp;quot;extensions/YourExtensionName.php&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
$wgExtensionFunctions[] = &amp;quot;wfIfPageExistsExtension&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
function wfIfPageExistsExtension() {&lt;br /&gt;
    global $wgParser;&lt;br /&gt;
    # register the extension with the WikiText parser&lt;br /&gt;
    # the first parameter is the name of the new tag.&lt;br /&gt;
    # In this case it defines the tag &amp;lt;example&amp;gt; ... &amp;lt;/example&amp;gt;&lt;br /&gt;
    # the second parameter is the callback function for&lt;br /&gt;
    # processing the text between the tags&lt;br /&gt;
    $wgParser-&amp;gt;setHook( &amp;quot;ifpageexists&amp;quot;, &amp;quot;ifPageExists&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# The callback function for converting the input text to HTML output&lt;br /&gt;
function ifPageExists( $input ) {&lt;br /&gt;
    global $wgTitle;&lt;br /&gt;
&lt;br /&gt;
    # first, let&amp;#039;s replace {{PAGENAME}} wherever it appears.&lt;br /&gt;
    $input = str_replace(&amp;quot;{{PAGENAME}}&amp;quot;, $wgTitle-&amp;gt;getText(), $input);&lt;br /&gt;
&lt;br /&gt;
    # let&amp;#039;s try to extract a transclusion&lt;br /&gt;
    if(ereg (&amp;quot;\{\{([^|}]*)&amp;quot;, $input, $regs)) {&lt;br /&gt;
        # okay, we&amp;#039;ve found a likely looking target.&lt;br /&gt;
        $targetpage = $regs[1];&lt;br /&gt;
        # now ask the database if the page exists&lt;br /&gt;
        $article = &amp;amp; new Article( Title::newFromText($targetpage) );&lt;br /&gt;
        $content = $article-&amp;gt;getContent( false );&lt;br /&gt;
        if( $content == &amp;quot;(There is currently no text in this page)&amp;quot; ) return &amp;quot;&amp;quot;;&lt;br /&gt;
        if( $content == &amp;quot;&amp;quot; ) return &amp;quot;&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
     global $wgParser, $wgUser;&lt;br /&gt;
     $parserOptions = ParserOptions::newFromUser( $wgUser );&lt;br /&gt;
     $parser = &amp;amp; new Parser();&lt;br /&gt;
     $output = &amp;amp; $parser-&amp;gt;parse($input, $wgTitle, $parserOptions);&lt;br /&gt;
     return $output-&amp;gt;getText();&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[Category:Source Code]]&lt;/div&gt;</summary>
		<author><name>Scott</name></author>
	</entry>
</feed>