<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>module NewPage doesn&#039;t honour template selection</title>
		<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection</link>
		<description>Posts in the discussion thread &quot;module NewPage doesn&#039;t honour template selection&quot; - When user creates new page via the NewPage module, and selects a template from the list provided, the selection is ignored and the last option in the list of templates is chosen instead.</description>
				<copyright></copyright>
		<lastBuildDate></lastBuildDate>
		
					<item>
				<guid>http://community.wikidot.com/forum/t-22246#post-198552</guid>
				<title>Re: module NewPage doesn&#039;t honour template selection</title>
				<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection#post-198552</link>
				<description></description>
				<pubDate>Tue, 17 Jun 2008 12:31:10 +0000</pubDate>
				<wikidot:authorName>andrewescott</wikidot:authorName>				<wikidot:authorUserId>35136</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Hi Gabrys.</p> <p>I note that this is still not fixed (using the test page at <a href="http://sandbox.wikidot.com/show-templates">http://sandbox.wikidot.com/show-templates</a>). Surely it can't take this long to make the changes. If it were complex, I could understand, but this should take, literally, 30 seconds to modify the two lines of code in the three places required, and it would be done.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://community.wikidot.com/forum/t-22246#post-155523</guid>
				<title>Re: module NewPage doesn&#039;t honour template selection</title>
				<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection#post-155523</link>
				<description></description>
				<pubDate>Wed, 30 Apr 2008 19:32:06 +0000</pubDate>
				<wikidot:authorName>Gabrys</wikidot:authorName>				<wikidot:authorUserId>2462</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Thank you for this, we will adapt this patch (if you don't mind) soon.</p> <p>Sorry for long inactivity from us, we're working on it now.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://community.wikidot.com/forum/t-22246#post-128255</guid>
				<title>Re: module NewPage doesn&#039;t honour template selection</title>
				<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection#post-128255</link>
				<description></description>
				<pubDate>Thu, 20 Mar 2008 11:29:23 +0000</pubDate>
				<wikidot:authorName>andrewescott</wikidot:authorName>				<wikidot:authorUserId>35136</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Ok. I think I've found the bug. Looking in the Wikidot v1 source, the template file at /templates/modules/misc/NewPageHelperModule.tpl has the following code fragment:</p> <div class="code"> <pre> <code>{foreach from=$templates item=template} &lt;option value="{$template-&gt;getPageId()}"&gt;{$template-&gt;getTitleOrUnixName()|escape}&lt;/option&gt; {/foreach} &lt;/select&gt; {/if} &lt;input type="submit" class="button" value="{if $button}{$button|escape}{else}{t}create page{/t}{/if}" style="margin: 1px"/&gt; {if $categoryName} &lt;input type="hidden" name="categoryName" value="{$categoryName}"/&gt; {/if} {if $template} &lt;input type="hidden" name="template" value="{$template-&gt;getPageId()}"/&gt;</code> </pre></div> <br /> In the <tt>foreach</tt> loop, the variable <tt>$template</tt> is set to each of the entries of the <tt>$templates</tt> variable. Then, at the end of the code fragment, <tt>$template</tt> is still set to the last entry, so the hidden field is written out. <p>A solution would be to use a different variable name in the <tt>foreach</tt> loop instead of <tt>template</tt>, e.g. <tt>templateoption</tt>.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://community.wikidot.com/forum/t-22246#post-127646</guid>
				<title>Re: module NewPage doesn&#039;t honour template selection</title>
				<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection#post-127646</link>
				<description></description>
				<pubDate>Wed, 19 Mar 2008 11:04:32 +0000</pubDate>
				<wikidot:authorName>andrewescott</wikidot:authorName>				<wikidot:authorUserId>35136</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I've looked at the HTML generated by Wikidot for the <a href="http://sandbox.wikidot.com/show-templates">http://sandbox.wikidot.com/show-templates</a> page, and the problem becomes clearer..</p> <div class="code"> <pre> <code>&lt;form action="dummy.html" method="get" onsubmit="WIKIDOT.modules.NewPageHelperModule.listeners.create(event)"&gt; &lt;input class="text" name="pageName" type="text" size="30" maxlength="60" style="margin: 1px"/&gt; &lt;select name="template" style="margin: 1px"&gt; &lt;option value="" selected="selected"&gt;-- Select a template --&lt;/option&gt; &lt;option value="254926"&gt;Cat1&lt;/option&gt; &lt;option value="294735"&gt;Breads&lt;/option&gt; &lt;option value="294768"&gt;Wines&lt;/option&gt; &lt;option value="5848"&gt;Rateit&lt;/option&gt; &lt;/select&gt; &lt;input type="submit" class="button" value="create page" style="margin: 1px"/&gt; &lt;input type="hidden" name="template" value="5848"/&gt; &lt;/form&gt;</code> </pre></div> <p>Note that there are <strong>two</strong> form fields with the name "template": there's the select list and the hidden field. The hidden field is specifying the templateId for the last template in the list (Rateit), and over-rides any choice made by the user in the select list. The hidden field is normally used when there is a single template, pre-specified in the NewPage module, but should not be included when there are multiple templates.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://community.wikidot.com/forum/t-22246#post-123523</guid>
				<title>Re: module NewPage doesn&#039;t honour template selection</title>
				<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection#post-123523</link>
				<description></description>
				<pubDate>Wed, 12 Mar 2008 11:04:23 +0000</pubDate>
				<wikidot:authorName>andrewescott</wikidot:authorName>				<wikidot:authorUserId>35136</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Bit slow about responding, as I sort of hoped someone would fix this in the meantime, but that hasn't happened.</p> <p>The problem still happens with two templates, but it doesn't happen with one template, i.e. this works fine:</p> <div class="code"> <pre> <code>[[module NewPage template="template:blah"]]</code> </pre></div> <p>but this does not:</p> <div class="code"> <pre> <code>[[module NewPage template="template:blah, template:blah2"]]</code> </pre></div> <p>In fact, after a bit of experimenting, it seems that if you provide multiple templates in the list, the last template is always the one used, no matter which one is chosen. (It doesn't matter whether there is a space after the comma or not.)</p> <p>I've confirmed this using both Firefox 2 and IE 7.</p> <p>If anyone else wants to test this, and assuming it's still there, I've got a scratch page up on the sandbox for this at <a href="http://sandbox.wikidot.com/show-templates">http://sandbox.wikidot.com/show-templates</a></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://community.wikidot.com/forum/t-22246#post-55380</guid>
				<title>Re: module NewPage doesn&#039;t honour template selection</title>
				<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection#post-55380</link>
				<description></description>
				<pubDate>Sun, 07 Oct 2007 10:48:18 +0000</pubDate>
				<wikidot:authorName>hartnell</wikidot:authorName>				<wikidot:authorUserId>10978</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>It's seems you did everything correctly. What happens when you include two or rather than three templates? —hartnell</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://community.wikidot.com/forum/t-22246#post-55379</guid>
				<title>Re: module NewPage doesn&#039;t honour template selection</title>
				<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection#post-55379</link>
				<description></description>
				<pubDate>Sun, 07 Oct 2007 10:41:32 +0000</pubDate>
				<wikidot:authorName>hartnell</wikidot:authorName>				<wikidot:authorUserId>10978</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Let me check the docs. :) —hartnell</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://community.wikidot.com/forum/t-22246#post-55378</guid>
				<title>module NewPage doesn&#039;t honour template selection</title>
				<link>http://community.wikidot.com/forum/t-22246/module-newpage-doesn-t-honour-template-selection#post-55378</link>
				<description></description>
				<pubDate>Sun, 07 Oct 2007 10:02:24 +0000</pubDate>
				<wikidot:authorName>andrewescott</wikidot:authorName>				<wikidot:authorUserId>35136</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>In the nav:side panel of my wiki at 99sauces.wikidot.com, I have some code to allow users to quickly create a new page:</p> <div class="code"> <pre> <code>[[module NewPage size="15" template="template:person,template:place,template:producer" button="new page"]]</code> </pre></div> <br /> There are three templates listed, as users are meant to create only those pages relating to those templates. However, no matter which template the user selects, the Producer template is always used by the NewPage module.
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>