Welcome, Guest. Please Login or Register.
September 29, 2024, 01:37:00 AM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  A couple of questions « previous next »
Pages: [1] Reply Ignore Print
Author Topic: A couple of questions  (Read 2099 times)
Dude
Guest
A couple of questions
« on: December 23, 2001, 07:48:34 AM »
Reply with quote

Before I can move my board over to Yabbse I need to have the ability to use several templates. It's an easy mod in perl, but I don't know crap about php.

Anyway, I was looking thru the code in subs.php hoping to find something familiar and came across the line

   $yytemplate = file ('template.html');

Now just guessing but that line reads the contents of template.html into $yytemplate, right? It seems to me that if I knew the name of the variable that held the current catagory I could use a line like

  $template_file = $current_cat."_"."template.html"

or whatever you use in php to connect two strings. That way the current catagory's template file would be read in to $yytemplate as long as the template files would be named - catagory_template.html

Is this doable or am I way off base?

Logged
Joseph Fung
Global Moderator
YaBB God
*****
Posts: 4512


Keep smiling: it makes others nervous.

WWW
Re:A couple of questions
« Reply #1 on: December 23, 2001, 04:22:48 PM »
Reply with quote

Actually you're right on base :)
Logged

Dude
Guest
Re:A couple of questions
« Reply #2 on: December 24, 2001, 05:50:10 AM »
Reply with quote

Well I thought this would work.

if($currentboard == "") {
  $yytemplate = file ('template.html');
}
else {
  $tempfile = $currentboard."_"."template.html";
    $yytemplate = file ('$tempfile');
}

The problem is $currentboard never evaluates to anything but "". Is there another variable I should be using?
Logged
Joseph Fung
Global Moderator
YaBB God
*****
Posts: 4512


Keep smiling: it makes others nervous.

WWW
Re:A couple of questions
« Reply #3 on: December 24, 2001, 05:56:29 AM »
Reply with quote

$board should work.
Logged

Dude
Guest
Re:A couple of questions
« Reply #4 on: December 29, 2001, 05:05:54 AM »
Reply with quote

Quote from: Joseph Fung on December 24, 2001, 05:56:29 AM$board should work.

You would think  :( however it doesn't. But I did finally figure it out. This code will work. However you have to set it up first.

I had to assign $board to $diffboard and then declare it in the global statement at the top of the template_header function. I didn't assign $board cuz I don't know where else it is used.

if (($diffboard != "")){
  $tempfile = $diffboard."_"."template.html";
  if (is_file( $tempfile)) {
      $yytemplate = file ($tempfile);
  }
  else {
    $yytemplate = file ('template.html');
  }
}
else {
    $yytemplate = file ('template.html');
}


I also added the if statement to check if the *_template file exists and if it doesn't then use the default. So now it works [/sigh of relief][/sigh]

Thanks for pointing me in the right direction. Now I just have to set up the templates. Life is good.  ;D
Logged
KingDutka
Jr. Member
**
Posts: 52


Whatever...

ICQ - 143872821 WWW
Re:A couple of questions
« Reply #5 on: December 29, 2001, 09:53:25 AM »
Reply with quote

Hey man, for us end users/non mod writers, could you turn that into a mod so that anyone and everyone can easily set which board categories uses which templates via the admin center? That'd rock!
Logged

"I'm Sorry, Did I Kill You?"-KingDutka, King of the RPG MANIACS
Matt Siegman
Super Duper Developer
YaBB God
*****
Posts: 927


Red Hot!

ICQ - 95930457 WWW
Re:A couple of questions
« Reply #6 on: December 29, 2001, 10:15:50 PM »
Reply with quote

making the admin side of that would be a bitch....
Logged

Dude
Guest
Re:A couple of questions
« Reply #7 on: December 30, 2001, 03:39:05 AM »
Reply with quote

Quote from: Matt Siegman on December 29, 2001, 10:15:50 PMmaking the admin side of that would be a bitch....

And seeing how I just barely figured out how to do the easy part........... ;D

Also, Mr. Fung asked that we don't make any changes to admin.php yet.

Seriously, all you need to do is to make templates for the boards you want and the rest will default to the original template. So the admin function would kind of be overkill. But then, you like that overkill stuff, don't you King.  ;D
« Last Edit: December 30, 2001, 03:42:09 AM by Dude » Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Mod Ideas and Creation  |  A couple of questions « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.065 seconds with 21 queries.