No announcement yet.

Creating A Template That Runs Only When Threads Are Listed?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating A Template That Runs Only When Threads Are Listed?

    Small dilemma with the forum listing and thread listing templates - since they are both based off the same primary template.

    The NEW THREAD button is displayed using a template that only engages when the main template is displaying a thread listing. No worries there, the variable is empty if a forum listing is being displayed using that same template.

    However, I'm trying to also create a "text" version of that link. I'd like that variable to work the same as the graphical one - it only contains data (the link) when the forumdisplay template is displaying a thread listing, NOT when it displays a forum listing.

    I tried creating a forumdisplay_newthreadtextlink link, based on the same naming convention as the others assuming it would automatically populate if needed - that turned out not to be the case - any templates you create yourself are independant. Hmmm, only way around this I can think of is to write an if clause in the phpinclude template. The thing is, how do I detect if what is going to be displayed is a thread listing?

    I've tried various things, including <b>if ($forumdisplay[threadslist] != "") {</b>, however none seem to work. Am I missing something with the way these templates work? How can I create one that only populates if a thread listing is being displayed?

  • #2
    No way

    There does not seem to be a way to do this without changing the code.

    I use phpinclude to create substitutions for context-sensitive "fivelink" icons at the top of the forum:

    However, the variables you want to look at for template "forumdisplay" are not defined at the time phpinclude gets processed (in "global.php").

    If you can live with having both the graphic and the text visible in the same place at the same time, change template "forumdisplay_newthreadlink"

    You are correct, there is no special naming convention that automatically causes substitutions to occur - there is special code that populates the variable, or sets it to an empty string, based on context.


    • #3
      Damn, not quite the way I thought it all worked.

      Oh well, I hijacked the moderators template to do the job. I don't want to use that anyway, and it gets processed only on thread views and not forum views so is exactly what I was after. If I need the moderators list they are in a separate variable anyway, so that template isn't crucial.


      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.