Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: MLM on December 11, 2010, 07:48:17 PM

Title: Using functions from index.template.php
Post by: MLM on December 11, 2010, 07:48:17 PM
I am wanting to make a homepage for my forum that matches the rest of my forum. The header part and footer part are both functions in the index.template.php in the theme folder. How do i use the functions from their outside of forums folder.

Do i link it like a css?

Also, any thread links with this kind of idea will be greatly appreciated!
Title: Re: Using functions from index.template.php
Post by: Illori on December 11, 2010, 07:57:22 PM
How do I integrate SMF into my PHP coded website? (http://docs.simplemachines.org/index.php?topic=461.0)
Title: Re: Using functions from index.template.php
Post by: MLM on December 11, 2010, 08:03:40 PM
Quote from: Illori on December 11, 2010, 07:57:22 PM
How do I integrate SMF into my PHP coded website? (http://docs.simplemachines.org/index.php?topic=461.0)

Looks great but I am using SMF 2.0 RC4 and the functions i am talking about are like:


those are in the index.template.php and that controls the stuff that stays the same for whatever page you are on...

I have never heard of the header.php and footer.php files.
Title: Re: Using functions from index.template.php
Post by: IceXaos on December 12, 2010, 02:30:56 AM
Unsure of how much difference RC4 is than 3, but you may give this a try.  If it's anywhere close, you should understand it by what's around it, just using copy & paste.

http://www.simplemachines.org/community/index.php?topic=402675

You will then have to change the forum over to a new tab, update the action for forum to take you to the tab, update the default action to be your new home, and anything I may have forgotten to type. :)
Title: Re: Using functions from index.template.php
Post by: Hj Ahmad Rasyid Hj Ismail on December 12, 2010, 04:58:19 AM
Just use a mod to do that. Search in the mod section (as I am currently too lazy, Sunday morning...). Btw, almost all portal mod can do that.
Title: Re: Using functions from index.template.php
Post by: IceXaos on December 12, 2010, 04:59:01 AM
Quote from: ahrasis on December 12, 2010, 04:58:19 AM
Just use a mod to do that. Search in the mod section (as I am currently too lazy, Sunday morning...). Btw, almost all portal mod can do that.
Ugh, I forgot to say that.  It was on my mind.  >_<
Title: Re: Using functions from index.template.php
Post by: MLM on December 12, 2010, 10:58:36 AM
Quote from: ahrasis on December 12, 2010, 04:58:19 AM
Just use a mod to do that. Search in the mod section (as I am currently too lazy, Sunday morning...). Btw, almost all portal mod can do that.

Yes but I need it to be up a folder from the forums. Those portals just have whatever you set your install root for the forums be the home and the ?forums or whatever forums.

I want forums to be in its own folder and the home to be the base:

Home: www.example.com
Forums: www.example.com/forums

I have not taken a look at the thing IceXaos posted but I am about to. I am addressing this comment first.


EDIT:

Thanks for the post IceXaos. It has gotten me one step closer but I still do not either understand that enough or it isnt what I am looking for. Once I create this source of my page. How do i call that homepage function on a index.php file outside of the forums folder.
Title: Re: Using functions from index.template.php
Post by: MLM on December 12, 2010, 04:47:56 PM
Can I just make a ssi function with the html_above/below and body above/below?

I want it to look the same as my forum and and I just need that stuff and then I can edit the middle.
Title: Re: Using functions from index.template.php
Post by: MLM on December 12, 2010, 05:59:29 PM
Alright. After doing some in depth research and going through many threads, I finally found a solution.

Just make a index.php page and put this in it:

Credit to cicka (http://www.simplemachines.org/community/index.php?action=profile;u=256420) : http://www.simplemachines.org/community/index.php?topic=390247

<?php
//Set the banning active
$ssi_ban = true;

//Path to SSI.php
require("forums/SSI.php");

//Page title. This will appear in the browser
$context['page_title_html_safe'] = 'Page title';

//This is self explanatory
template_header();

//Here we define the link tree
$context['linktree'] = array(
 
'href' => $scripturl,
 );
 
//Here is the content, such as the title and the body message of the custom page.

echo'
<span class="clear upperframe"><span></span></span>
<div class="roundframe"><div class="innerframe">'
;
echo'
<div class="cat_bar">
<h3 class="catbg">Hello everyone</h3>
</div>
   <p>This is a custom page example. pretty cool, huh.</p>'
;
echo'
  </div></div>
 <span class="lowerframe"><span></span></span>'
;


//This is self explanatory too.  
template_footer();

?>



Thanks for all of the help ;)

My only problem now is that the current class is not on my Home tab. It continues to go on the forums tab. I have set up the subs.php and added it to index.template.php. It works fine but isnt selected.