• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Custom Forum Headers

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Always! Wait. Never. Shut up. Look at this tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic