[pmwiki-users] FoxForum - Auto create forum thread name

stevecrisp at gmail.com stevecrisp at gmail.com
Sun Jun 22 15:07:27 CDT 2008


2008/6/22 Hans <design5 at softflow.co.uk>:
> Sunday, June 22, 2008, 9:08:21 AM wrote:
>
>> Is there a way to auto populate the new Topic name used within the
>> Forum.CreateNewTopic form?  For example can it be configured to
>> automatically fill in the Topic name on the CreateNewTopic page with a
>> parameter that I'll pass in (either variable or URL parameter) e.g.
>> ?n=Forum.CreateNewTopic&topic=MyTopic
>
>> Finally, is it possible to get the number of posts within a specific
>> forum topic from within another page outside the forum?  Perhaps I
>> have to create a custom markup like (:FoxForum topic=MyTopic
>> query=posts:) which returns the number of posts within the
>> Forum.MyTopic page.
>
> A normal link would not pass on a parameter to fill a form field.
> So I thought that using a {[foxedit ...]} link and a modified NewTopic form
> may work. I came up with this:
>
> 1. Create an new page FoxTemplates.NewTopicForm with this content:
> (watch for those lines being wrapped by the emailing process!)
>
> (:nolinebreaks:)
> (:title Discuss {$EditSource}:)
> (:messages:)
> (:fox newtopicform formcheck=topic,heading,text,author pagecheck={$EditTarget} redirect={$EditTarget}:)
> (:input hidden target {$EditTarget} :)
> (:input hidden template FoxTemplates.FormTemplates#newtopic :)
> (:input hidden FoxCount 001:)
> (:input hidden foxfilter FoxCount:)
> (:input hidden csum 'New Topic added':)
> (:input hidden topic '{{$EditSource}$Title}':)
> || ||'''Compose your post:'''||
> || ||(:guibuttons:)||
> || ||(:input textarea id=text name=text cols=60 rows=6 class=inputtext:) ||
> (:if enabled EnableAccessCode:)
> || ||Enter value {$AccessCode} (:input text access size=3 class=inputtext:)(:input hidden accesscode {$AccessCode}:)  <- Have you entered the code number?||
> (:if enabled EnablePostCaptchaRequired:)
> || ||Enter value {$Captcha} (:input captcha class=inputtext:) <- Have you entered the code number?||
> (:if:)
> || Author:||(:input text author value='{$Author}' size=30 class=inputtext:) (:input submit post Enter:) ||
> (:foxend newtopicform:)
>
> 2. On any page you want a discussion link use this as a link:
>
> {[foxedit label=Discuss form=FoxTemplates.NewTopicForm target=Forum.{$Group}-{$Name}]}
>
> 3. On the same page you can display the number of posts on th
> ecorresponding forum page with this, using the {$FoxPostCount} page
> variable:
>
> {Forum.{$Group}-{$Name}$FoxPostCount}
>
> Note that via the NewTopicForm the 'topic' is set as the $Title of the
> base page, which calls the discussion, using this input field:
>
> (:input hidden topic '{{$EditSource}$Title}':)
>
> You might want to change that.
> Also you most likely want a backlink to the base page on its Forum
> page. For this you need to edit the template used:
>
> FoxTemplates.FormTemplates#newtopic
>
> Also you most likely want a backlink to the base page on its Forum
> page. For this you need to edit the template used:
>
> FoxTemplates.FormTemplates#newtopic
>
> you could add a hidden field to the NewTopicForm page, like
>
> (:input hidden basepage {$EditSource}:)
>
> then you can use {$$basepage} in the #newtopic template (or in a
> modified one). i.e. for a simple link [[{$$basepage}]]

OMG - I've implemented all of your recommendations (above) and it
works great!  I've put the 'Discuss' link on Site.PageActions.  This
is displayed for Wiki pages with no discussion page.  'Discuss(n)' is
displayed for posts which already have a discussion page.  'n' is the
number of posts.  I also made sure the 'Discuss' link is not displayed
when in the Forum group.  When viewing a discussion page from within
the Forum group, a backlink to the original post is displayed near the
top.

FYI, my Site.Page action Discuss configuration looks like this:

(:if [ ! exists Forum.{*$Group}-{*$Name} and ! group Forum ]:)
* {[foxedit label=Discuss form=FoxTemplates.NewTopicForm
target=Forum.{*$Group}-{*$Name}]}
(:if [ exists Forum.{*$Group}-{*$Name} and ! group Forum ]:)
* [[Forum.{*$Group}-{*$Name} | Discuss
({Forum.{*$Group}-{*$Name}$FoxPostCount})]]
(:ifend:)

Thanks very much Hans for your superb support and ideas,
-Steve.



More information about the pmwiki-users mailing list