News:

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

Main Menu

Custom pages in 2.0 RC3 style

Started by NanoSector, June 18, 2010, 02:52:35 PM

Previous topic - Next topic

NanoSector

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!
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

CapadY

It's the default Core Theme of SMF2RC3
Please, don't PM me for support unless invited.
If you don't understand this, you will be blacklisted.

NanoSector

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.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Deaks

look on mod site there are 4 mods that do that on search of custom pages :)
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

cicka

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.

NanoSector

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
* Yoshi2889 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.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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

NanoSector

Erhm I get this error:
Fatal error: Call to undefined function phprequire() in /home/a9406461/public_html/About.php on line 5
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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.

NanoSector

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 examplepretty coolhuh.</p>';
echo'
   </div></div>   <span class="lowerframe"><span></span></span>';
//This is self explanatory too.   
template_footer(); ?>
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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 examplepretty coolhuh.</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.

NanoSector

Hm now it works.
I replaced that line you said.

But it looks like this:


Sooo........

And like I said after that error I tried tinkering with that line and I ain't a PHP expert.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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

NanoSector

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';
?>
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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.

NanoSector

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?
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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

NanoSector

ARGH STUPID PHP

I don't know a bit....

Will add it.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NanoSector

Error:

Parse error: syntax error, unexpected ',' in /home/a9406461/public_html/Sources/Subs.php on line 3912
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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?

NanoSector

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.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka


NanoSector

Nope, still the same.

What did you modify?

EDIT:
Oh BTW if you want to see the page:
http://smftools.comlu.com/About.php
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

Can you please upload here the About.php and Modification.english.php files?

NanoSector

My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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?

NanoSector

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.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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.

NanoSector

I will try to see if that works.

EDIT: I cannot find that file.

EDIT2: I am gonna change the About to about.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

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.

NanoSector

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.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

I am at loss then. Because everything appears to be fine.

NanoSector

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.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NanoSector

No I'm also lost....

It has to be in Subs.php...

"Undefined index"...
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

TehCraw

Try uploading this file to your server. Might take care of the "Undefined Index" thing.
/forum/Themes/default/languages/index.english.php
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

NanoSector

My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

TehCraw

This one has me totally confused.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. - Martin Fowler

NanoSector

My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NanoSector

HEY HEY HEY!!

Installing a mod solved this!!

Thank you, ENotify!

And thanks for all the help, guys!
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Zagdul

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?

NanoSector

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.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NanoSector

#41
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 downloadremove or backup SMFSMFDownloader is includedit 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>';
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

deansmar

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

NanoSector

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)
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NanoSector

My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

cicka

Yes, you will have to escape the backslash characters as mentioned above.

Advertisement: