Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Mick. on August 27, 2009, 06:28:07 PM

Title: Creating own HTML page between SMF header and footer ??
Post by: Mick. on August 27, 2009, 06:28:07 PM
Ive seen this somewhere here.  I searched and looked in tips and tricks but came up empty.


I thought there was a way of using SMF header and footer and able to add HTML in between.

Please post the link if you happen to know where this link is?   

...also,can it be used as:

mysite.com/mypage  instead of index.php?=action     ???


Thanx,
Mick.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: vbgamer45 on August 27, 2009, 09:08:25 PM
You can do that using SSI.php
I do a call to template_header(); and template_footer(); with my php/html code in between. Like my example site at http://www.themezone.net which is based on SMF using SSI
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Mick. on August 28, 2009, 11:46:18 AM
Thanx for the reply.

I was hoping to avoid the use of .php

I wonder if I could use something like .html at the end.

Like:

mysite.com/whatever.html

and even add a folder:

mysite.com/folder/whatever.html

but again, using the forums header and footer.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Arantor on August 28, 2009, 01:01:47 PM
You cannot do it using .html since SMF is written in PHP - and unless you simply copy/paste the code from a page in the browser, you'll have to use .php.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Kays on August 28, 2009, 06:19:32 PM
if you can edit your .htaccess file, then it might be possible to get the server to parse html pages as php

Add the folowing to your .htaccess file.

AddHandler application/x-httpd-php .html
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Mick. on August 29, 2009, 11:01:14 PM
Heres what im shooting for...

i got a wordpress page:

http://chevyavalancheclub.com/specs/

I would like to somehow integrate SMF header and footer on it.

No more no less.  Not looking to add same registered users or nothing like that. 

I used iframes and custom action but it didnt cut the cake for me.

Can it be done?
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Arantor on August 30, 2009, 07:57:24 AM
In your theme, include SSI.php as the very first line.

Then, call template_header() and template_footer() in the theme in the places you want them to be.

That's the only way it can be done.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Mick. on September 01, 2009, 10:12:00 PM
Ok.   I created a test folder/page in PHP

http://www.chevyavalancheclub.com/chevyavalanche/index.php


Ive been picking my brain on this one.   My forum is set at 100% but why this test page is in narrow?

Any ideas?


Im using this code:

<?php require("/home/**********/public_html/SSI.php"); ?>
<?php template_header(); ?>

TEST

<?php template_footer(); ?>
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Arantor on September 01, 2009, 10:17:12 PM
Because that's how the theme makes the page, just like it does in the forum and other pages.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Mick. on September 01, 2009, 10:23:07 PM
Quote from: Arantor on September 01, 2009, 10:17:12 PM
Because that's how the theme makes the page, just like it does in the forum and other pages.

Yeah but i changed the forum to 100% in the .css file.

See,...i use 2 themes (same ones).

One for the front page to keep it narrow and the other wide for the forums and all pages.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Arantor on September 01, 2009, 10:25:00 PM
If you mean the table is 100%... it's 100% of its parent - which is limited in the theme.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Mick. on September 01, 2009, 10:29:09 PM
Quote from: Arantor on September 01, 2009, 10:25:00 PM
If you mean the table is 100%... it's 100% of its parent - which is limited in the theme.

Well that sucks lol.    I love the wide look.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Arantor on September 01, 2009, 10:35:12 PM
The only way around it is to modify the parent's CSS - which means altering the rest of the theme code.
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: toobeus4u on March 31, 2010, 06:53:43 AM
Hi Guys,

first I'll have to blow the dust away for a bit.  ;)

The code:
<?php require("/home/**********/public_html/SSI.php"); ?>
<?php template_header(); ?>

TEST

<?php template_footer(); ?>


Works great for me.

However, I want the page to be viewed only bij logged in users.
Guest should get the login page.

Can I add a simple line of code, like the header and footer?

The page I want to call is http://www.mydomain.com/forum/news.php

Thanks and sorry for the big kick  ;D



Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Arantor on March 31, 2010, 06:56:53 AM
Actually, yeah you can.

Simply add the following line after the SSI.php statement.

<?php is_not_guest(); ?>

You can be cleaner by not having so many multiple <?php blocks:
<?phprequire("/home/**********/public_html/SSI.php");is_not_guest();template_header();?>

test

<?php template_footer(); ?>
Title: Re: Creating own HTML page between SMF header and footer ??
Post by: toobeus4u on March 31, 2010, 07:44:36 AM
Thanks a million!

That worked great.



Title: Re: Creating own HTML page between SMF header and footer ??
Post by: Mick. on March 31, 2010, 09:38:34 AM
You can also add a page title to it...

SMF 2.0
$context['page_title_html_safe'] = 'title of the page goes here';

SMF 1.1.x
$context['page_title']= 'title of the page goes here';