News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Using functions from index.template.php

Started by MLM, December 11, 2010, 07:48:17 PM

Previous topic - Next topic

MLM

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!

My Themes:

My Mods:

Unsolved Threads:
  • None atm...


MLM

Quote from: Illori on December 11, 2010, 07:57:22 PM
How do I integrate SMF into my PHP coded website?

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


  • function template_init()
  • function template_html_above()
  • function template_body_above()
  • function template_body_below()
  • function template_html_below()

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.

My Themes:

My Mods:

Unsolved Threads:
  • None atm...

IceXaos

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. :)

Hj Ahmad Rasyid Hj Ismail

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.

IceXaos

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.  >_<

MLM

#6
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.

My Themes:

My Mods:

Unsolved Threads:
  • None atm...

MLM

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.

My Themes:

My Mods:

Unsolved Threads:
  • None atm...

MLM

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?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.

My Themes:

My Mods:

Unsolved Threads:
  • None atm...

Advertisement: