News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Adding a custom page manually for Smf 2.0. rc 3

Started by cicka, July 11, 2010, 12:40:47 PM

Previous topic - Next topic

spottedhog

Take a closer look at your code...  You did not end the echo ...  also, there is no need to end/start PHP with the code you listed.

wodada

change this:

$ssi_ban = 1;

...to this:

$ssi_ban = true;

NanoSector

Quote from: Mike Stowe on December 11, 2010, 05:08:12 PM
Are you sure?

It looks like its the horizontal bar that goes across the top over the contact and the a background box that expands with your content.

It works fine when i add my code out side of the divs.

echo'
         <span class="clear upperframe"><span></span></span>
         <div class="roundframe"><div class="innerframe">';
         echo'
         <div class="cat_bar">
         <h3 class="catbg">War Armada: Screenshots</h3>
         </div>

Content goes here to fit inside the box

         </div></div>
        <span class="lowerframe"><span></span></span>';

I think i just need to know the code to turn php back on in that spot.
The code should be this:

echo'
        <span class="clear upperframe"><span></span></span>
        <div class="roundframe"><div class="innerframe">'
;
        echo
'
        <div class="cat_bar">
        <h3 class="catbg">War Armada: Screenshots</h3>
        </div>

Content goes here to fit inside the box'
;
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."

Mike Stowe

echo'
         <span class="clear upperframe"><span></span></span>
         <div class="roundframe"><div class="innerframe">';
         echo'
         <div class="cat_bar">
         <h3 class="catbg">War Armada: Screenshots</h3>
         </div>

include("screenshots/index.php");  <<<<<<<<<<<<<This is still showing up as plain code instead of php code.
echo'
         </div></div>    <<<<<<<<<<<<< I get an error on this line Parse error: syntax error, unexpected '/' in /home/barons/public_html/forums/screenshots.php on line 29
        <span class="lowerframe"><span></span></span>';


I also tried using my code in place of the include code with the same effect.

<?php
$path_to_minigalnano
= "screenshots/"; //     <- Enter RELATIVE path to MiniGal Nano here (eg. "subfolder/minigalnano") - DO NOT END WITH /

// DO NOT EDIT BELOW THIS LINE!
define("GALLERY_ROOT", $path_to_minigalnano);
require(
GALLERY_ROOT . "index.php");
?>


and

$path_to_minigalnano = "screenshots/";
define("GALLERY_ROOT", $path_to_minigalnano);
require(GALLERY_ROOT . "index.php");

NanoSector

Quote from: Mike Stowe on December 12, 2010, 02:22:54 PM
echo'
         <span class="clear upperframe"><span></span></span>
         <div class="roundframe"><div class="innerframe">';
         echo'
         <div class="cat_bar">
         <h3 class="catbg">War Armada: Screenshots</h3>
         </div>

include("screenshots/index.php");  <<<<<<<<<<<<<This is still showing up as plain code instead of php code.
echo'
         </div></div>    <<<<<<<<<<<<< I get an error on this line Parse error: syntax error, unexpected '/' in /home/barons/public_html/forums/screenshots.php on line 29
        <span class="lowerframe"><span></span></span>';


I also tried using my code in place of the include code with the same effect.

<?php
$path_to_minigalnano
= "screenshots/"; //     <- Enter RELATIVE path to MiniGal Nano here (eg. "subfolder/minigalnano") - DO NOT END WITH /

// DO NOT EDIT BELOW THIS LINE!
define("GALLERY_ROOT", $path_to_minigalnano);
require(
GALLERY_ROOT . "index.php");
?>


and

$path_to_minigalnano = "screenshots/";
define("GALLERY_ROOT", $path_to_minigalnano);
require(GALLERY_ROOT . "index.php");

You may NOT end the path with a /, either begin with it and have it in the midway as you wish, but do NOT end with it.

And use this:
<?php
$GALLERY_ROOT
= "/screenshots";
require(
$GALLERY_ROOT . "index.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."

spottedhog

This:
echo'
         <span class="clear upperframe"><span></span></span>
         <div class="roundframe"><div class="innerframe">';
         echo'
         <div class="cat_bar">
         <h3 class="catbg">War Armada: Screenshots</h3>
         </div>


...needs to be this:
echo'
         <span class="clear upperframe"><span></span></span>
         <div class="roundframe"><div class="innerframe">';
         echo'
         <div class="cat_bar">
         <h3 class="catbg">War Armada: Screenshots</h3>
         </div>';


In other words, you did not close out the echo

MLM

Thank you so much! ;)

Confirmed works on 2.0 RC4

I used this exact code:
<?php
//Set the banning active
$ssi_ban = true;

//Path to SSI.php
require("forums/SSI.php");

//Page title. This will appear in the browser
$context['page_title_html_safe'] = '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();

?>

My Themes:

My Mods:

Unsolved Threads:
  • None atm...

NanoSector

I've managed to build an autenticating (or however you write it lol) system, like if an admin is logged on it transforms into a control panel and for members/guests it shows page content.

It will require a bit of php knowledge since many things can go wrong.

if ($context['user']['is_admin'])
echo
'
<p>Your content here. Only showed for ADMINS.</p>'
;
elseif (
$context['user']['is_logged'])
echo
'
<p>Your content here. Only showed for NORMAL MEMBERS.</p>'
;
elseif (
$context['user']['is_guest'])
echo
'
<p>Your content here. Only showed for GUESTS.</p>'
;
else
echo
'
<p>Acts the same as the code for guests; if the user ain\'t admin, nor member, it must be a guest.</p>'
;


You will need to global CONTEXT, like here;
require('/home/yoursite/www/smf/SSI.php');
global
$context;
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."

spottedhog

Here, let us get everything included:

global $user_info, $context;
$memberGroupID = '';  // insert the memberGroup ID # you wish to be able to view the page.
// Multiple Groups use an array. Example:  $memberGroupID = array(1, 7, 10, 12, 15);

if (in_array($memberGroupID, $user_info['groups']) || $context['user']['is_admin'])
{

// content for Member Group and/or Admin

} elseif ($context['user']['is_admin']) {

// content for Admin only

} elseif($context['user']['is_logged']) {

// content for registered and logged in users

} else {

// content for Guests

}

NanoSector

Quote from: spottedhog on December 14, 2010, 08:07:07 AM
Here, let us get everything included:

global $user_info, $context;
$memberGroupID = '';  // insert the memberGroup ID # you wish to be able to view the page.
// Multiple Groups use an array. Example:  $memberGroupID = array(1, 7, 10, 12, 15);

if (in_array($memberGroupID, $user_info['groups']) || $context['user']['is_admin'])
{

// content for Member Group and/or Admin

} elseif ($context['user']['is_admin']) {

// content for Admin only

} elseif($context['user']['is_logged']) {

// content for registered and logged in users

} else {

// content for Guests

}

The code I posted works perfectly fine.

http://smftools.co.cc/forums/docs/index.php

Admin has a few more wrench icons (to allow easy editing of the pages).
Member has "paperclip" icons (to download the documentation in RTF format).
Guest has neither.

Don't mind the database error -- I'll get that sorted out later.
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."

spottedhog

I never said your code did not work. I just added another permission layer so the code would be complete.  Your code did not allow for permissions for MemberGroups. 

Since you put up code for permissions, I thought it would be best to add an additional parameter so that all permissions would be covered.

The code I posted works "perfectly fine" also.  :)  ...without any database error... ;)

NanoSector

Quote from: spottedhog on December 14, 2010, 10:44:11 AM
I never said your code did not work. I just added another permission layer so the code would be complete.  Your code did not allow for permissions for MemberGroups. 

Since you put up code for permissions, I thought it would be best to add an additional parameter so that all permissions would be covered.

The code I posted works "perfectly fine" also.  :)  ...without any database error... ;)
That database error comes from a few tweaks I made elsewhere (like the tweak I added to integrate SMFTools Page Manager).
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."

spottedhog

apples and oranges...

This thread is about adding a custom page manually for SMF, not how to use it with your custom code.

NanoSector

Quote from: spottedhog on December 14, 2010, 11:27:34 AM
apples and oranges...

This thread is about adding a custom page manually for SMF, not how to use it with your custom code.
It is a custom page :P

require('/home/smftools/public_html/smftoolspm/integrate.php');
global
$pagemanagerpath, $pagemanagerindex, $user_enabled, $use, $currentpage;
require(
$pagemanagerindex);
$use(createpageindex_$currentpage);
if (
$user_enabled(pagegroup_admin)) {
echo
'
<p>SMFTools Page Manager '
, $smftpm_ver, ' notice: ACP enabled for remote access.</p>';
}


That is almost the correct code to merge SMFTools Page Manager into your page (and let it build 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."

spottedhog

Quoterequire('/home/smftools/public_html/smftoolspm/integrate.php');
global $pagemanagerpath, $pagemanagerindex, $user_enabled, $use, $currentpage;
require($pagemanagerindex);
$use(createpageindex_$currentpage);
if ($user_enabled(pagegroup_admin)) {
echo'
<p>SMFTools Page Manager ', $smftpm_ver, ' notice: ACP enabled for remote access.</p>';
}

That is almost the correct code to merge SMFTools Page Manager into your page (and let it build it).

Thank you for making my point.

Yoshi, you may need to consider who is reading these posts.  You keep bringing up unrelated code which in turn can confuse some users.

NanoSector

Quote from: spottedhog on December 14, 2010, 01:01:03 PM
Quoterequire('/home/smftools/public_html/smftoolspm/integrate.php');
global $pagemanagerpath, $pagemanagerindex, $user_enabled, $use, $currentpage;
require($pagemanagerindex);
$use(createpageindex_$currentpage);
if ($user_enabled(pagegroup_admin)) {
echo'
<p>SMFTools Page Manager ', $smftpm_ver, ' notice: ACP enabled for remote access.</p>';
}

That is almost the correct code to merge SMFTools Page Manager into your page (and let it build it).

Thank you for making my point.

Yoshi, you may need to consider who is reading these posts.  You keep bringing up unrelated code which in turn can confuse some users.
I know I know, just saying that SMFTPM is indeed related to custom pages :)
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."

spottedhog

Yoshi,

What you are talking about is off topic.  If you wish to discuss your specific code in relation to what can be done with a custom manual page, please start a new topic.

EpicS

Hello, sorry for the bump.
I'm new here, and I have a small mistake wile creating a new page..

I made a page, and I edited everything in Subs, but it gave me this too..:

Notice: Use of undefined constant Donate - assumed 'Donate' in /home/joker/public_html/Sources/Subs.php on line 4089

Notice: Use of undefined constant Wiki - assumed 'Wiki' in /home/joker/public_html/Sources/Subs.php on line 4098

Please help me,
Thanks.

NanoSector

Ughh, the code I posted in here is ugly :-\
Please ignore my posts in here.

EpicS: You should put the button names in single quotes like 'Donate' instead of Donate and 'Wiki' instead of Wiki
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."

Advertisement: