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?

Advertisement: