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

Hans design5 at softflow.co.uk
Sun Jun 22 06:42:22 CDT 2008


Sunday, June 22, 2008, 9:08:21 AM, stevecrisp at gmail.com 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

Let us know if this helps and works for you!
I think it is interesting enough to include in the Cookbook.FoxForum page
as a possible add-on modification.


  ~Hans




More information about the pmwiki-users mailing list