• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Custom Forum Headers

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering if there was a way to have a custom Masthead for each forum. I understand that I can include an image in the initial entries of each topic but that doesn't fit my purposes as I'm hacking the default JForum theme within an inch of its life (I'll post the URL when I'm done). I was thinking something more along the lines of:

If forum ="forum name" then display "forum div" or else display nothing.

Is this possible?

Thanks in advance for any help.

Eric


[originally posted on jforum.net by slowhome]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Freemarker lets you wrap includes inside if statements. Also on the forum and view topic pages, there is generally a "forum" object in the FreeMarker context. You can probably combine these two in the correct template files to do something like:



Where id is the id number of the forum (database key).
[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Didn't work. Here's what I put in forum_show.htm

<#if forum.id == {1} >
<#include "includes/customMasthead.htm" />
<#elseif forum.id == {1} >
<#include "includes/customMasthead.htm" />
<#else>
<#include "includes/defaultMasthead.htm" />
</#if>


This is what the console barfed out:


freemarker.core.ParseException: Encountered "}" at line 57, column 20.
Was expecting one of:
"," ...
":" ...
"." ...
"[" ...
"(" ...
"?" ...
"!" ...
"??" ...
"+" ...
"-" ...
"*" ...
"/" ...
"%" ...
"!=" ...
"=" ...
"==" ...
"=" ...
ESCAPED_GTE ...
"" ...
ESCAPED_GT ...
LESS_THAN_EQUALS ...
LESS_THAN ...
".." ...
AND ...
OR ...


I've verified that the forum.id is correct. The includes work if not wrapped in the statement.

Thanks for any help.

Eric
[originally posted on jforum.net by slowhome]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, the {} part was just my way to indicate a replacement item. Just put the number there and no curly braces.
[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Works perfectly! Thanks for your help.
[originally posted on jforum.net by slowhome]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FWIW, Looking at your sample.. you don't need the second

<#elseif forum.id == {1} >
<#include "includes/customMasthead.htm" />

part unless you are doing more than one custom mastHead. E.g., Forum id 2 has a different one from 1.

I was just trying to indicate that you can string together a bunch of different forum id's and mastheads with the elseif statements if you need to.
[originally posted on jforum.net by monroe]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!