Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: NanoSector on June 18, 2010, 02:52:35 PM

Title: Custom pages in 2.0 RC3 style
Post by: NanoSector on June 18, 2010, 02:52:35 PM
Like here on SM.

I really like how everything is styled, and that the pages are actually custom pages.
I really want it too! :P

I could not find a "Powered by ..." link, so I guess it's a mod that does not add it :P

Thanks in advance for finding it!
Title: Re: Custom pages in 2.0 RC3 style
Post by: CapadY on June 18, 2010, 03:33:52 PM
It's the default Core Theme of SMF2RC3
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on June 18, 2010, 03:42:00 PM
Quote from: capady on June 18, 2010, 03:33:52 PM
It's the default Core Theme of SMF2RC3
*facepalms

I want to know how they do that custom pages, like the themes.
Title: Re: Custom pages in 2.0 RC3 style
Post by: Deaks on July 11, 2010, 09:04:48 AM
look on mod site there are 4 mods that do that on search of custom pages :)
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 10:19:12 AM
You can do it manually too and in a much easier way than the mods. Let me know if you would be interested and I will post the codes here.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 12:28:12 PM
Quote from: cicka on July 11, 2010, 10:19:12 AM
You can do it manually too and in a much easier way than the mods. Let me know if you would be interested and I will post the codes here.
Yes I'm interested
/me awaits code

Quote from: Runic on July 11, 2010, 09:04:48 AM
look on mod site there are 4 mods that do that on search of custom pages :)
I'm sorry but I don't want it INSIDE the SMF forum.
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 12:36:59 PM
Quote from: Yoshi2889 on July 11, 2010, 12:28:12 PM
Quote from: cicka on July 11, 2010, 10:19:12 AM
You can do it manually too and in a much easier way than the mods. Let me know if you would be interested and I will post the codes here.
Yes I'm interested
/me awaits code

Quote from: Runic on July 11, 2010, 09:04:48 AM
look on mod site there are 4 mods that do that on search of custom pages :)
I'm sorry but I don't want it INSIDE the SMF forum.


Create a file and rename it custom.php or give it whatever name you want. Then open it up with a php editor and enter this code
<?php
//Set the banning active
$ssi_ban = 1;

//Path to SSI.php
require(dirname(__FILE__) . '/SSI.php');

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

//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();

?>


In comments is explained what each code does. Change the title and message with your own that you want to use at your custom page. If you want to add permissions for groups then please post here.

To enter the button at the menu for the custom page, at the Subs.php file in the Sources folder find this code

'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),


And add this code

'custompage' => array(
'title' => $txt['cpage'],
'href' => 'custom.php',
'show' => true,
// 'target' => '_blank',
'sub_buttons' => array(
),
),

         
This will add it after the Search button. If you want it to add it somewhere else, then place the code above after or before the menu button code that you want the custom page to appear.         

If you want the custom page button to open in a new window , uncomment this part

// 'target' => '_blank',

Then as last we will add the language text. At the Modification.english.php file place this code.

$txt['cpage'] = 'Announcement';

And replace Announcement with whatever word you want your custom page button to say.

Save the changes and upload the custom.php file in the root of your forum folder.

If you want to have it outside the forum, then change this code

require(dirname(__FILE__) . '/SSI.php');

to this

require("/full/path/to/SSI.php");

And enter your full path to SSI.php

Below you can see a screenshot how the custom page will look like.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 12:47:17 PM
Erhm I get this error:
Fatal error: Call to undefined function phprequire() in /home/a9406461/public_html/About.php on line 5
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 12:51:33 PM
Quote from: Yoshi2889 on July 11, 2010, 12:47:17 PM
Erhm I get this error:
Fatal error: Call to undefined function phprequire() in /home/a9406461/public_html/About.php on line 5

Can you post here how you did it? I have tested both methods, inside and outside forums, and they work.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 12:53:37 PM
I tried tinkering with the code and now my site is busy =.="

Here:

<?php
//Set the banning active
$ssi_ban = 1;
//Path to SSI.
$phprequire(SSI.php'); //The error occures right here.
//Page title. This will appear in the browser
$context['
page_title_html_safe'] = 'Custom Page';
//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(); ?>
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 12:57:27 PM
Quote from: Yoshi2889 on July 11, 2010, 12:53:37 PM
I tried tinkering with the code and now my site is busy =.="

Here:

<?php
//Set the banning active
$ssi_ban = 1;
//Path to SSI.
$phprequire(SSI.php'); //The error occures right here.
//Page title. This will appear in the browser
$context['
page_title_html_safe'] = 'Custom Page';
//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(); ?>


This line is not right. I never posted it like this.

$phprequire(SSI.php');

It should be like this instead, if you want to have the custom page outside the forum.

require("/full/path/to/SSI.php");

And replace /full/path/to/SSI.php with the actual full path to your SSI.php file.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 12:59:44 PM
Hm now it works.
I replaced that line you said.

But it looks like this:
(http://img684.imageshack.us/img684/198/aboutak.png) (http://img684.imageshack.us/i/aboutak.png/)

Sooo........

And like I said after that error I tried tinkering with that line and I ain't a PHP expert.
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 01:01:29 PM
It looks like you did not add the language text at the Modification.english.php file. Please read carefully my whole post above and follow all the instructions :)
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 01:05:13 PM
Quote from: cicka on July 11, 2010, 01:01:29 PM
It looks like you did not add the language text at the Modification.english.php file. Please read carefully my whole post above and follow all the instructions :)
Yes I did... ???

Code (Modifications.english.php) Select
<?php
// Version: 2.0 RC3; Modifications

// Important! Before editing these language files please read the text at the top of index.english.php.
$txt['cpage'] = 'About';
?>
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 01:08:46 PM
What about the Subs.php file, did you enter the codes for the button there? Because I do not see the custom button at the menu bar at the screenshot you posted.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 01:10:25 PM
Quote from: cicka on July 11, 2010, 01:08:46 PM
What about the Subs.php file, did you enter the codes for the button there? Because I do not see the custom button at the menu bar at the screenshot you posted.
Yes that's weird uh.... ???

This is where I put it:


$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
'custompage' => array(
'title' => $txt['cpage'],
'href' => 'About.php',
'show' => true,
// 'target' => '_blank',
'sub_buttons' => array(
),
),


Must I put it at an other place?
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 01:14:32 PM
Quote from: Yoshi2889 on July 11, 2010, 01:10:25 PM
Quote from: cicka on July 11, 2010, 01:08:46 PM
What about the Subs.php file, did you enter the codes for the button there? Because I do not see the custom button at the menu bar at the screenshot you posted.
Yes that's weird uh.... ???

This is where I put it:


$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
'custompage' => array(
'title' => $txt['cpage'],
'href' => 'About.php',
'show' => true,
// 'target' => '_blank',
'sub_buttons' => array(
),
),


Must I put it at an other place?

You have not done it as it should. You have left out a  ), for the closing of search array. And you said that you read my post carefully and followed all the instructions :D
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 01:17:18 PM
ARGH STUPID PHP

I don't know a bit....

Will add it.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 01:18:37 PM
Error:

Parse error: syntax error, unexpected ',' in /home/a9406461/public_html/Sources/Subs.php on line 3912
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 01:28:13 PM
Quote from: Yoshi2889 on July 11, 2010, 01:18:37 PM
Error:

Parse error: syntax error, unexpected ',' in /home/a9406461/public_html/Sources/Subs.php on line 3912

Can you please upload here the Subs.php file?
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 01:31:17 PM
Quote from: cicka on July 11, 2010, 01:28:13 PM
Quote from: Yoshi2889 on July 11, 2010, 01:18:37 PM
Error:

Parse error: syntax error, unexpected ',' in /home/a9406461/public_html/Sources/Subs.php on line 3912

Can you please upload here the Subs.php file?
I changed the code again, it's booting now but back again at that other error.

Here goes.

I'm away for a moment so take your time.
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 01:36:08 PM
Can you try this?
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 01:49:18 PM
Nope, still the same.

What did you modify?

EDIT:
Oh BTW if you want to see the page:
http://smftools.comlu.com/About.php
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 01:52:56 PM
Can you please upload here the About.php and Modification.english.php files?
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 01:57:25 PM
Here goes

Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 02:04:17 PM
Everything appears ok. I just tested them also at my test site to double check them. I do not understand why you are getting that error.

Did you upload the Subs.php file I attached above to your Sources folder?
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 02:07:20 PM
Quote from: cicka on July 11, 2010, 02:04:17 PM
Everything appears ok. I just tested them also at my test site to double check them. I do not understand why you are getting that error.

Did you upload the Subs.php file I attached above to your Sources folder?
Yes...

It is a new install, no mods, I can confirm that...
Only did add a few boards and removed the Welcome topic.

And the button is displayed as a little space, for your interest.
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 02:12:24 PM
Quote from: Yoshi2889 on July 11, 2010, 02:07:20 PM
Quote from: cicka on July 11, 2010, 02:04:17 PM
Everything appears ok. I just tested them also at my test site to double check them. I do not understand why you are getting that error.

Did you upload the Subs.php file I attached above to your Sources folder?
Yes...

It is a new install, no mods, I can confirm that...
Only did add a few boards and removed the Welcome topic.

And the button is displayed as a little space, for your interest.

That tells me that the language text is not added properly. What language are you using as a default language for your forum? English or English utf-8? because if it is the latter, then you must add the language text to the Modification.english.utf-8.php file too.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 02:13:29 PM
I will try to see if that works.

EDIT: I cannot find that file.

EDIT2: I am gonna change the About to about.
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 02:16:18 PM
Quote from: Yoshi2889 on July 11, 2010, 02:13:29 PM
I will try to see if that works.

EDIT: I cannot find that file.

What language are you using as default? If you are using some other than english, try to set the default langauge to english and see if it would help.

That file should be in the languages folder. And it is for sure a language problem.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 02:17:51 PM
Quote from: cicka on July 11, 2010, 02:16:18 PM
Quote from: Yoshi2889 on July 11, 2010, 02:13:29 PM
I will try to see if that works.

EDIT: I cannot find that file.

What language are you using as default? If you are using some other than english, try to set the default langauge to english and see if it would help.

That file should be in the languages folder. And it is for sure a language problem.
I cannot find the utf-8 file and I am using English as default.
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 11, 2010, 02:22:55 PM
I am at loss then. Because everything appears to be fine.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 02:24:44 PM
Quote from: cicka on July 11, 2010, 02:22:55 PM
I am at loss then. Because everything appears to be fine.
Hm...

I'll try fixing it...in my own.

As I said, I'm no PHP expert.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 02:27:56 PM
No I'm also lost....

It has to be in Subs.php...

"Undefined index"...
Title: Re: Custom pages in 2.0 RC3 style
Post by: TehCraw on July 11, 2010, 03:44:37 PM
Try uploading this file to your server. Might take care of the "Undefined Index" thing.
/forum/Themes/default/languages/index.english.php
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 11, 2010, 03:58:45 PM
*sigh

Nothing works.....
Title: Re: Custom pages in 2.0 RC3 style
Post by: TehCraw on July 11, 2010, 05:50:15 PM
This one has me totally confused.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 12, 2010, 02:47:53 AM
Quote from: ScottyBoy on July 11, 2010, 05:50:15 PM
This one has me totally confused.
I've already tried everything...
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 12, 2010, 03:42:57 AM
HEY HEY HEY!!

Installing a mod solved this!!

Thank you, ENotify!

And thanks for all the help, guys!
Title: Re: Custom pages in 2.0 RC3 style
Post by: Zagdul on July 13, 2010, 08:47:44 AM
Quote from: Yoshi2889 on July 12, 2010, 03:42:57 AM
HEY HEY HEY!!

Installing a mod solved this!!

Thank you, ENotify!

And thanks for all the help, guys!
what mod?
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 14, 2010, 06:44:43 AM
Quote from: Omalina on July 13, 2010, 08:47:44 AM
Quote from: Yoshi2889 on July 12, 2010, 03:42:57 AM
HEY HEY HEY!!

Installing a mod solved this!!

Thank you, ENotify!

And thanks for all the help, guys!
what mod?
ENotify, but others may also help.
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 14, 2010, 08:15:38 AM
Argh can someone help me this time?

Error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/a9406461/public_html/about.php on line 19

Source:
<?php
//Set the banning active
$ssi_ban = true;
//Path to SSI.
require(dirname(__FILE__) . '/SSI.php');
//Page title. This will appear in the browser
$context['page_title_html_safe'] = 'About SMFTools';
//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">About SMFTools</h3> </div>
<p>SMFTools is a simple Batch file that can operate with SMF.</p>'
;
echo
'
<p>Once SMFTools has started, you can use the default options. It has a build-in file checker so you don'
t have to worry about missing files.</p>';
echo'
<p>With the build-in features you can download, remove or backup SMF. SMFDownloader is included, it can download SMF for you with the help of WGet.</p>';
echo'
<p>If you are ready to try SMFTools, <a href="/download" title="Download SMFTools now!">you can download SMFTools from this page</a>.</p>';
echo'
  </div></div>  <span class="lowerframe"><span></span></span>';
Title: Re: Custom pages in 2.0 RC3 style
Post by: deansmar on July 14, 2010, 08:24:02 AM
a silly error on line 19

"don't" is not allowed to be spelt like that it has to be spellt like this: don\'t
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 14, 2010, 08:30:35 AM
Quote from: deansmar on July 14, 2010, 08:24:02 AM
a silly error on line 19

"don't" is not allowed to be spelt like that it has to be spellt like this: don\'t
Hm.
I'm trying to do that now :)

(still don't get it...it has always worked for me)
Title: Re: Custom pages in 2.0 RC3 style
Post by: NanoSector on July 14, 2010, 08:33:00 AM
Thanks, it works now.
Title: Re: Custom pages in 2.0 RC3 style
Post by: cicka on July 14, 2010, 11:11:34 AM
Yes, you will have to escape the backslash characters as mentioned above.