News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Adding custom pages

Started by UberMouse, December 14, 2009, 10:49:52 PM

Previous topic - Next topic

UberMouse

How do I add custom pages to SMF (Kind of like the custom pages in simple portal you can add), Since I need to add some new pages but I would to use the SMF themes so the site looks like the same in it.

Matthew K.

For better support, please add more information like what version you're using, custom or default theme.
You'll get a lot faster and more accurate support.

Labradoodle-360

UberMouse

Smf 2.0
Custom theme that is basically the default curve theme with a few minor changes.

Matthew K.


Nick Whetstone

In your (blank) file, add the following:
<?php
    
require_once('./path/to/smf/SSI.php');
    
template_header();
?>

Your content here
<?php
    template_footer
();
?>



Note that the <head> information is already filled out in template_head(); such as the DTD, title, stylesheets, etc...

See HERE for more info.
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

Matthew K.

**thinks that haha's solution may not be the best option for inline SMF**

UberMouse

Quote from: Labradoodle-360 on December 14, 2009, 11:00:49 PM
Why not go with SimplePortal?
Am using simple portal, I just want a slightly more advanced page then can be created using the custom page function (Specially since whenever I use PHP it rages at me for some random error when it trys to eval() it).

Someone posted a post that is now not here, In reply to that anyway http://custom.simplemachines.org/mods/index.php?mod=1347 that mod is just want simple portal does.

Matthew K.

Unless you want to mess around with trying to manually add Custom Pages to RC2, which it isn't yet compatible and may take some major tweaking, I'd go with what ha2 suggested.

Labradoodle-360

UberMouse

Yup I'll try that now it should do what I want.

Matthew K.

If you feel comfortable editing files that won't match up completely with the edits, go for it! (It may not, haven't taken a peak at the edits compared to SMF 2.0 RC2 yet)

UberMouse

Don't really need to that gets the page layout thats all I needed.

Anyone else having problems with the verification in the quick reply? It always goes to reply and tells me to enter when I have, All I need to do is click submit again.

Matthew K.

Why I stated you need to add the mod manually, is because it's not compatible with SMF 2.0 RC2, which is what you're using. Which means to install correctly, you'd need to make sure all of the edits are the same and don't leave anything out.

UberMouse

Don't need to install any mods, Since I'm not going to use the custom page one since using ha2's  way works fine.

Matthew K.

Okay, sorry when you said
QuoteYup I'll try that now it should do what I want.
I didn't know which method you were referring to.

Let us know how it goes, and let us know if there is anything else we can do.
Labradoodle-360

UberMouse

Well one thing, How do you get it to auto tick "Return to topic"? Since in my forum it returns you to the board instead of the topic since I always forget to tick the bloody box. I see that it doesn't here.

No wait nvm that only does it for edits, Is there anyway to do it for posting new posts not just edits?

Nick Whetstone

Admin> Configuration> Member options> Configure guest and new user options for this theme> {check} Return to topics after posting by default.> Save


See if that works :)
The artist formerly known as (Ha)²

Former Support Specialist

Please do not solicit support via PM. Here's why!

Matthew K.

That should work for you TS. I knew there was an option just couldn't remember where it was.

Labradoodle-360

UberMouse

I don't have members under configuration.
Nvm I see it was under the current theme.

Xolkiyr

I tried Haha's way and it doesn't seem to output the footer.

I'm using a custom theme which is based off of the default theme and running SMF 2 RC1.2

UberMouse

Well I can say it works perfectly, How much did you change the footer area?

Matthew K.

How much you changed the footer has nothing to do with the footer not showing up in SSI.

Xolkiyr

Yeah, it's not showing up at all.

This is the code verbatim on the page I'm trying to create:
<?php
    
require_once('SSI.php');
    
template_header();
echo "This will be where you create your avatar.";
    
template_footer();
?>


Header shows up fine, just not the footer. Copyright included.

Arantor

Copyright doesn't on SSI pages.

Xolkiyr

Ah, so technically that'd mean there really is nothing in the footer?

Side note, and sorry for bringing more trouble to this topic, but how would I go about adding to the whole:

Board Name > Custom Page

bit?

Arantor

For the linktree, make sure $context is in scope (global $context) then populate $context['linktree'] with indexed arrays.

The first item, forum name, amounts to:
$context['linktree'][0] = array(
  'url' => $scripturl,
  'name' => $forum_name,
)

Then you just add new ones. For example, from my Buddy Page mod to add the last item being a link to action=buddypage:
$context['linktree'][] = array(
'url' => $scripturl . '?action=buddypage',
'name' => $txt['buddypage']
);


You just define as many entries in $context['linktree'] as you need, however if you're going into making custom pages to fit in, you almost may as well define an action and do it that way.

Xolkiyr

And how do I change the title that appears at the top of the browser, since as it stands it says the browser name and that's it.

Matthew K.

I BELIEVE it's
Code (Find) Select
      'url' => $scripturl . '?action=buddypage',
Code (After) Select
      'title' => $txt['page_title']

Xolkiyr

Quote from: Labradoodle-360 on December 15, 2009, 12:43:02 PM
I BELIEVE it's
Code (Find) Select
      'url' => $scripturl . '?action=buddypage',
Code (After) Select
      'title' => $txt['page_title']
Slightly confused. Do you mean like this:
$context['linktree'][] = array(
'url' => 'avatar.php',
'title' => $txt['page_title'],
'name' => 'Avatar'
);

Matthew K.

If I am correct that it's 'title' =>, then yes.

(Remember to define $txt['strand_name'])

Xolkiyr


Arantor

To change the name isn't in $context['linktree']. It is, as the name implies, the link tree.

$context['page_title'] should be it though - set it after including SSI.php but before the template_* functions.

* Arantor thinks looking at the mod he mentioned might not be a bad idea.

Xolkiyr

Quote from: Arantor on December 15, 2009, 12:48:54 PM
To change the name isn't in $context['linktree']. It is, as the name implies, the link tree.

$context['page_title'] should be it though - set it after including SSI.php but before the template_* functions.

* Arantor thinks looking at the mod he mentioned might not be a bad idea.
Had to also add the page_title_html_safe version too to get it working, but otherwise it's working like a dream now. Thanks again Arantor. You've been the biggest help to me overall in my venture into SMF.

Arantor

It depends where you are in SMF; often page_title_html_safe gets magically set up for you, but I guess not from SSI.php.

Glad to know you're making inroads into working with SMF though :)

Advertisement: