News:

SMF 2.1.6 has been released! Take it for a spin! Read more.

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

Masterd

That's true, but you can use this instead:


<?php
if (!empty(
$context['show_login_bar']))
echo '
<script type="text/javascript" src="'
, $settings['default_theme_url'], '/scripts/sha1.js"></script>
<form id="guest_form" action="'
, $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
<div class="info">'
, $txt['login_or_register'], '</div>
<input type="text" name="user" size="10" class="input_text" />
<input type="password" name="passwrd" size="10" class="input_password" />
<select name="cookielength">
<option value="60">'
, $txt['one_hour'], '</option>
<option value="1440">'
, $txt['one_day'], '</option>
<option value="10080">'
, $txt['one_week'], '</option>
<option value="43200">'
, $txt['one_month'], '</option>
<option value="-1" selected="selected">'
, $txt['forever'], '</option>
</select>
<input type="submit" value="'
, $txt['login'], '" class="button_submit" /><br />
<div class="info">'
, $txt['quick_login_dec'], '</div>';

else if (!empty($modSettings['enableOpenID']))
echo '
<br /><input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />'
;

echo '
<input type="hidden" name="hash_passwrd" value="" />
</form>'
;
?>

dutchbastard

bah
I found that you we're right from the very start
global $context; Did the trick
I must have had some cookies issues because it didn't work before.

http://docs.simplemachines.org/index.php?topic=789.0#post_extras
That describes some of the solution for the redirect after.
Just have to find out how to use it since with this it still points me to smf (Home)

global $context;
$_SESSION['login_url'] = 'http://localhost' . $_SERVER['PHP_SELF'];
$_SESSION['logout_url'] = 'http://localhost' . $_SERVER['PHP_SELF'];


I'm sure I'll figure it out.
In any case, Thanks a lot! for the help, it is greatly appreciated.

Masterd


Mike Stowe

Does this not work in 2.0 RC4?

I have everything working until you start to add content. Then you get an error message on the first line you added punctuation like a period or comma or quotes.


NanoSector

Quote from: Mike Stowe on December 10, 2010, 08:52:53 PM
Does this not work in 2.0 RC4?

I have everything working until you start to add content. Then you get an error message on the first line you added punctuation like a period or comma or quotes.
It works on RC4.

You need to transfer all 's in the text only to /'. It's called 'magic quotes' ;)
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

You still need to follow proper PHP rules.  For example, if you are using echo with single quotes, you need to comment out apostrophes like in this code:
echo '';
// note the use of single quotes above

echo 'Here\'s a sentence that\'s going to need what I was talking about.';
// note the backslashes above


If you are using double quotes, you will need to comment out any double quotes within the echo like this:
echo "";
// note the use of double quotes

echo "Go to Google: <a href=\"http://www.google.com\">Click Here</a>";


As for the wrong placement of periods and/or commas, the error is telling you whatever code you have is not properly formed by PHP rules.

Otherwise, the original external manual page code should work every time.

Mike Stowe

Yay! I had a lot of > ' <. Looks like i got them all.  Thanks for your help.

Mike Stowe

Just wondering but why does the subject in this topic say manually?

Adding a custom page manually for Smf 2.0. rc 3

Is there an automatic way to do this?

NanoSector

Quote from: Mike Stowe on December 11, 2010, 10:27:37 AM
Just wondering but why does the subject in this topic say manually?

Adding a custom page manually for Smf 2.0. rc 3

Is there an automatic way to do this?
No, but I'm working on one (but don't expect it to get done right now since..well...I'm a PHP noobie.
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

Nice! I think when it's finished the suicide rate of smf users will drop off drastically lol

NanoSector

Quote from: Mike Stowe on December 11, 2010, 10:42:16 AM
Nice! I think when it's finished the suicide rate of smf users will drop off drastically lol
LOL yeah that's true.

It's build in Visual Basic, though.
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

Would you have any resources or links that might help me figure out how to add css to the content I add to the custom page I've created. I don't know very much about css and I normally get things done by making make and un making 20 changes in dreamweaver using its split screen view before i upload to the site.

The problem i have is that when I add my css to the forums it doesn't apply to my content the same way it does when its on its own page. My dreamweaver doesn't show me a preview of the forum code so i've been having to upload after each change I try to see what it changes. Its a very very painful process and so far i haven't managed to get anywhere with it.

I'm trying to set a div down the left and right side of the page with links and stuff that sit against the left or right edge of the page with another div in between in the center of the page that hold the bulk of my content. I was told I needed to clear floats and i don't really know what that means but from doing some research all it seems to do is stack the left, center, and right div one on top of the other.

NanoSector

Quote from: Mike Stowe on December 11, 2010, 11:33:28 AM
Would you have any resources or links that might help me figure out how to add css to the content I add to the custom page I've created. I don't know very much about css and I normally get things done by making make and un making 20 changes in dreamweaver using its split screen view before i upload to the site.

The problem i have is that when I add my css to the forums it doesn't apply to my content the same way it does when its on its own page. My dreamweaver doesn't show me a preview of the forum code so i've been having to upload after each change I try to see what it changes. Its a very very painful process and so far i haven't managed to get anywhere with it.

I'm trying to set a div down the left and right side of the page with links and stuff that sit against the left or right edge of the page with another div in between in the center of the page that hold the bulk of my content. I was told I needed to clear floats and i don't really know what that means but from doing some research all it seems to do is stack the left, center, and right div one on top of the other.
No, I'm sorry.

I just create pages with the code Spottedhog posted, and then I'm modifying it to my needs (only showing content to members, etc).
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

Mike Stowe, this is just my personal opinion, but you might want to consider losing Dreamweaver and replacing it with a PHP/Text/HTML editor like Crimson Editor (for windoz users) or Bluefish (for Linux desktop users).

For coding, you may want to look at some CSS tutorials, etc.  There is an excellent little book that I first used to learn with and still keep it around as a reference:

CSS in easy steps by Mike McGrath  Pub. by Barnes & Noble  ISBN: 0-7607-7859-0 and the price was $9.95

You may also want to take a look at XAMPP which turns your PC into a web server so you can work offline and be able to view your outputs.

Lastly, you can always use inline CSS.  For example:

echo '<div style="font-size:medium;color:navy;width:300px">';
...or you can add a CSS class to the theme's style.css file.

NanoSector

#74
Quote from: spottedhog on December 11, 2010, 11:50:35 AM
Mike Stowe, this is just my personal opinion, but you might want to consider losing Dreamweaver and replacing it with a PHP/Text/HTML editor like Crimson Editor (for windoz users) or Bluefish (for Linux desktop users).

For coding, you may want to look at some CSS tutorials, etc.  There is an excellent little book that I first used to learn with and still keep it around as a reference:

CSS in easy steps by Mike McGrath  Pub. by Barnes & Noble  ISBN: 0-7607-7859-0 and the price was $9.95

You may also want to take a look at XAMPP which turns your PC into a web server so you can work offline and be able to view your outputs.

Lastly, you can always use inline CSS.  For example:

echo '<div style="font-size:medium;color:navy;width:300px">';
...or you can add a CSS class to the theme's style.css file.
I usez Simple Notes 1.1 Beta 2, my own product :)

Edits HTML, HTML, SHTML, PHP, CSS, JS (plus many more, but that are the web documents) and directly let you view the following formats in a browser: SHTML, HTML and HTM!
No PHP viewing support though.

http://smftools.co.cc/download/SN1.1B2.zip
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

I'm trying to link my custom page to am image gallery, Normally I put this bit of code where I want the gallery to display.

<?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");
?>


When I add it to my custom page nothing happens. I don't even get an error message saying my path is wrong.vThe custom page is located in the forums dir. The screen shots folder that I'm trying to link to is also in the forums dir.

This the the custom page after i've added the bit of code. Do you see anything out of place?


<?php
//Set the banning active
$ssi_ban = true;

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

//Page title. This will appear in the browser
$context['page_title_html_safe'] = 'WAR ARMADA: EVE ONLINE';

//This is self explanatory
template_header();

//Here we define the link tree
$context['linktree'] = array(
 
'href' => 'http://www.wararmada.com/forums/screenschots.php',
 );

//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">War Armada: Screenshots</h3>
        </div>






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









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

//This is self explanatory too.       
template_footer();

?>

NanoSector

#76
Quote from: Mike Stowe on December 11, 2010, 03:33:29 PM
I'm trying to link my custom page to am image gallery, Normally I put this bit of code where I want the gallery to display.

<?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");
?>


When I add it to my custom page nothing happens. I don't even get an error message saying my path is wrong.vThe custom page is located in the forums dir. The screen shots folder that I'm trying to link to is also in the forums dir.

This the the custom page after i've added the bit of code. Do you see anything out of place?


<?php
//Set the banning active
$ssi_ban = true;

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

//Page title. This will appear in the browser
$context['page_title_html_safe'] = 'WAR ARMADA: EVE ONLINE';

//This is self explanatory
template_header();

//Here we define the link tree
$context['linktree'] = array(
 
'href' => 'http://www.wararmada.com/forums/screenschots.php',
 );

//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">War Armada: Screenshots</h3>
        </div>






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









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

//This is self explanatory too.       
template_footer();

?>

You don't need to have the linktree part.

And put in this line:
ob_start();
That is required not to get errors.

Place it somewhere before calling SSI.php.

Oh and why don't you just do this instead of doing path_to_blablabla:
$GALLERY_ROOT = "/images";
Remove the line right under the part that does say do not modify.

So the code does look like:
<?php
$GALLERY_ROOT
= "/images";
require(
$GALLERY_ROOT . "index.php");
?>


AND you didn't do the FULL path to your gallery. IT must be something like this:
/home/sitename/public_html/imgaes.
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

Something in this code is turning the php off.

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>

<p>Here is where the code needs to go.<p />

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


I've got a php editor and its showing my code in the wrong colors when its in place. If I add my code outside of the echo thing it works. Is there a way to turn the php back on inside the echo thing?

spottedhog

hmmmmm....  try this code:

<?php
//Set the banning active
$ssi_ban = true;
ob_start();
//Path to SSI.php
require(dirname(__FILE__) . '/SSI.php');

//Page title. This will appear in the browser
$context['page_title_html_safe'] = 'WAR ARMADA: EVE ONLINE';

//This is self explanatory
template_header();

//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">War Armada: Screenshots</h3>
        </
div></div></div>
       <
span class="lowerframe"><span></span></span>';

include("screenshots/index.php");

//This is self explanatory too.      
template_footer();

?>


The div's and span's are only for title type stuff, not for content.

Mike Stowe

#79
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.

Advertisement: