Customizing SMF > Graphics and Templates

Heh, can't really phrase this question in one sentence... please read :)

(1/3) > >>

jpaq:
Ok, so my entire site is written in PHP.  I have a template for my site, written in PHP, that basically has all the menu code, the top graphics, and everything else in it.  In the template, there's a function called disp_content() that basically calls back to the original file, looking for the content.

So the flow of the site is like this:

User goes to /index.php

Index.php basically contains this code:


--- Code: ---include('templates/main.php');

function disp_content {
some content here
}
--- End code ---

My template file basically does this:

1) Display the header information....
2) Start a table, in the left column, display the menu
3) Open up the right column of the table
4) Call disp_content, to grab the contents from the calling file
5) Close the right colum, and the table
6) Cleanup and display copyright, etc.

Now, this worked out really well with the old template system.  Basically, my template file simply enclosed the "default" template in a disp_content() function, and the whole thing worked like a charm.

However, I want to use SMF in the same way, but I am not sure exactly how the new Theme system works, and where/when the functions in the new theme files get called.  How would I set up a Theme that does the same thing as my current system works?

Thanks for the help,

Jeff


[Unknown]:
I guess the easiest, but also most inefficient, solution would be to have main_above empty, except for a ob_start();.  Then have main_below contain something like:

global $main;
$main = ob_get_contents();
ob_end_clean();

include_once('/path/to/templates/main.php');

And then have a function disp_content that just did:

global $main;
echo $main;

But I really think it would be better - efficiency-wise - if you copied the stuff from your existing template system to SMF's - above content and below.

-[Unknown]

jpaq:
Heh, the goal here is really to eliminate having two versions of the template...

Maybe what I'll do is to create a sub-template called templates/main-split.php

Then I can have a top and bottom section in main-split, and my templates/main.php can simply call template_top(), disp_content(), template_bottom() and I'll just have the forum link to the main-split directly...  We'll see how it goes tomorrow (off to bed now)

jpaq:
Actually, as it turns out a LOT of things have changed about the user verification and the flow of SMF vs. YaBBSE...  Bah, looks like I'm gonna have to rewrite most of my template from scratch...   Hopefully further updates don't change too much :P

On the plus side, things'll be a lot cleaner when I'm done.  (Under the current template I load SSI.php at the top so I can process logins and such, but can't do that on the forum pages so I have an if SCRIPT_URI is forum then don't load SSI, there's login verifications in two places, and a security level verification...)  Should be able to condense that all into 1 login verification and 1 security verification, and *SHOULD* if I'm reading the new code correctly be able to load SSI even on the forum pages without too much problem (as long as I load them in the correct order) ;)

[Unknown]:
Wait, you can't load SSI.php in your templates?  Why not?

-[Unknown]

Navigation

[0] Message Index

[#] Next page

Go to full version