• Welcome to Simple Machines Community Forum. Please login or sign up.
October 22, 2021, 09:26:00 PM

News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord


Integrating the forum into your site...

Started by [Unknown], November 09, 2004, 11:18:05 PM

Previous topic - Next topic

[Unknown]

Find:

$pagetitle

Replace:

$context['page_title']

-[Unknown]

Caedmon Michael

**smacks head**

Yes, it is that simple, isn't it? Thanks for returning my clue!   ;D

osckar

Hi:

This is my case:

I have this html code inserted in the template:

// The main content should go here.  A table is used because IE 6 just can't handle a div.
   echo '
   <table width="770" cellpadding="0" cellspacing="0" border="0" align="center"><tr>
      <td width="130">left menu</td>
      <td id="bodyarea" width="640" style="padding: 1ex 10px 2ex 10px;">';
}

function template_main_below()
{
   global $context, $settings, $options, $scripturl, $txt;

   echo '</td>
   </tr></table>';


Everything is fine; I have a left column :) But..

I don't get to insert an external page like footer.php or header.php into this piece of html code... In this case I'd like to have left_menu.php in my left column.

I have tried it and get a parse error in my template; this is the code I use:

// The main content should go here.  A table is used because IE 6 just can't handle a div.
   echo '
   <table width="770" cellpadding="0" cellspacing="0" border="0" align="center"><tr>
      <td width="130"><?php include('left_menu.php'); ?></td>
      <td id="bodyarea" width="640" style="padding: 1ex 10px 2ex 10px;">';
}

function template_main_below()
{
   global $context, $settings, $options, $scripturl, $txt;

   echo '</td>
   </tr></table>';


I have tried the <?php include('left_menu.php'); ?> without the <? & ?> tags like include('header.php'); but no sucess.

Thank you

A.M.A

try using:
// The main content should go here.  A table is used because IE 6 just can't handle a div.
   echo '
   <table width="770" cellpadding="0" cellspacing="0" border="0" align="center"><tr>
      <td width="130">';

include('left_menu.php');

   echo '
      </td>
      <td id="bodyarea" width="640" style="padding: 1ex 10px 2ex 10px;">';
}
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

osckar


TollyBoy

Quote from: [Unknown] on March 05, 2005, 04:28:16 AM
That is very very insecure and dependent on register_globals.  I strongly recommend using super-globals.

-[Unknown]

I have read the part about super-globals on the PHP documentation site and I realize why it is bad to use register_globals. But I still do not fully understand how to use super-globals instead of register_globals.

Lets take the following example: I use register_globals to check what page the user wants to view on my website. Let's say the users wants to view the contact page. I use the following URL: hxxp:mysite/index.php?page=contact [nonactive]

How would I apply super-globals to find out what page the user wants to view?



if(!isset($page)) {
        $page = 'home';
}
else {
        $page = strtolower(trim($page));
}

switch($page) {
        case 'home':
                include('modules/home/home.php');
                break;

        case 'biography':
                include('modules/biography/biography.php');
                break;

        case 'coups':
                include('modules/coups/coups.php');
                break;

        case 'contact':
                include('modules/contact/contact.php');
                break;

        case 'guestbook':
                include('modules/guestbook/guestbook.php');
                break;

        case 'community':
                include('modules/community/community.php');
                break;

        default:
                include('modules/home/home.php');
                break;
}



And ... another "problem" which I wouldn't know to handle would be that this link can be shared with other people. If I use sessions and use the super-global $_SESSION['page']; the link would not be able to be shared.

How could I find a solution to this simple problem? I'm sure there's something easy out for it.

How does SMF find out what page a user is willing to view? Because those links can be shared if you're not logged in AND I assume SMF is not using register_globals since it is VERY VERY VERY insecure.

crammed

Hi folks.  I'm VERY new to using PHP.  But, I really like SMF and am having some trouble integrating it into my site.

I followed the "Cooler Way".  But, clearly I'm not quite cool enough yet.  Although it's entirely possible that I made mistakes along the way, I think that I followed it pretty closely.

My forum is here: hxxp:www.gvgo.ca/mb [nonactive]

But, I created a seperate test file at hxxp:www.gvgo.ca/mb/testindex.php [nonactive]

I'm pretty competant with HTML but I haven't had a good chance to figure out PHP.  Although, I was able to figure out how to integrate Coppermine into my site and bridge it to SMF.  In any case, some help for a PHP newbie would be greatly appreciated.  I am part way there.  But, it's probably something simple that I'm missing.

Thanks

osckar

Your testindex.php is full of errors. verify you are putting the php code at the very top of your page. Will be helpful if you can paste the code you are using.

Try using SSI.php see some examples at http://www.gvgo.ca/mb/ssi_examples.php and you can integrate parts of your forum to your index page of your site.

I guess it's quite simple to integrate that design into your forum (or vice versa whatever :) ) as long as you only have a header and footer and no left or right columns. Patience is all you will need  ;)

I suggest you to read this topic: http://www.simplemachines.org/community/index.php?topic=15678.0 to understand what parts you may need edit, if you are good with html then you may understand it.

Oscar

epyon

hey, i tried doing the first method (2 times) and both times it told me that it couldn't be viewed and that i had to swithc back to the original skin, and so i tried the 2nd method and it messed my hole forum up it was able to be viewed any more, so i had to erase it and start a new one over, i've been pretty nerves at this point and so i was wondering if someone could just post the code for for the forum with a left side pannel in it, (i dont care what colors cus i can fix that)

thanx ahead of time

osckar

Quote from: epyon on July 05, 2005, 03:03:03 PM
......... so i was wondering if someone could just post the code for for the forum with a left side pannel in it, (i dont care what colors cus i can fix that)

thanx ahead of time

It has been explained here.. http://www.simplemachines.org/community/index.php?topic=19638.msg244996#msg244996

epyon

wow that was easy,  :D thank you soo much!

barnjo

July 06, 2005, 12:59:38 PM #51 Last Edit: July 06, 2005, 03:31:14 PM by barnjo
Just clarifying that i'm thinking on the right lines, whats actually ina header, is it like a picture at the top of each section?

Or is a header completely different.

So what do I put in the header.php if all I want is a different picture for each section?

[Unknown]

Quote from: TollyBoy on June 22, 2005, 02:41:53 PM
I have read the part about super-globals on the PHP documentation site and I realize why it is bad to use register_globals. But I still do not fully understand how to use super-globals instead of register_globals.

Lets take the following example: I use register_globals to check what page the user wants to view on my website. Let's say the users wants to view the contact page. I use the following URL: http://mysite/index.php?page=contact

How would I apply super-globals to find out what page the user wants to view?

Instead of your code, you want:


if (!isset($_GET['page'])) {
        $_GET['page'] = 'home';
}
else {
        $_GET['page'] = strtolower(trim($_GET['page']));
}

switch ($_GET['page']) {
        case 'home':
                include('modules/home/home.php');
                break;

        case 'biography':
                include('modules/biography/biography.php');
                break;

        case 'coups':
                include('modules/coups/coups.php');
                break;

        case 'contact':
                include('modules/contact/contact.php');
                break;

        case 'guestbook':
                include('modules/guestbook/guestbook.php');
                break;

        case 'community':
                include('modules/community/community.php');
                break;

        default:
                include('modules/home/home.php');
                break;
}


Quote
And ... another "problem" which I wouldn't know to handle would be that this link can be shared with other people. If I use sessions and use the super-global $_SESSION['page']; the link would not be able to be shared.

I wouldn't recommend using sessions, nor would I think that would work.

QuoteHow does SMF find out what page a user is willing to view? Because those links can be shared if you're not logged in AND I assume SMF is not using register_globals since it is VERY VERY VERY insecure.

Yes, it uses $_GET, $_REQUEST, $_POST, etc.

Quote from: epyon on July 05, 2005, 03:03:03 PM
hey, i tried doing the first method (2 times) and both times it told me that it couldn't be viewed and that i had to swithc back to the original skin, and so i tried the 2nd method and it messed my hole forum up it was able to be viewed any more, so i had to erase it and start a new one over, i've been pretty nerves at this point and so i was wondering if someone could just post the code for for the forum with a left side pannel in it, (i dont care what colors cus i can fix that)

"Couldn't be viewed"?  What exactly was the error?

Quote from: barnjo on July 06, 2005, 12:59:38 PM
Just clarifying that i'm thinking on the right lines, whats actually ina header, is it like a picture at the top of each section?

Or is a header completely different.

So what do I put in the header.php if all I want is a different picture for each section?

Header = the HTML to be shown for every page at the beginning.
Footer = the HTML to be shown for every page at the end.

For example, if I had:

abc
def
xyz


And:

abc
ghi
xyz


It would be logical that "abc" is the header (same for both pages) and "xyz" is the footer (same for both pages.)  The "def" and "ghi" parts are the content - different for each page.

This doesn't mean your header cannot be dynamic; quite the opposite, it can be.  I just mean the part that is basically the same HTML/PHP/whatever for every page.  If you want a random header image, use something like PHP's rand() function.

-[Unknown]

epyon

i know i posted here and said i got what i wonted but it seems that i was mistaken, its been about a month now that iv used SMF and iv gotten somewhat the hang of everything

i used method 1 and i got it working  :D although i cant seem to be able to add a left side pannel in that goes on the out side, what i have now is a left side pannel thats on the inside (so the top of it is right under the buttons and log-in imformation)

could some one please tell or show me how to or where to add the proper code so i can have a left side pannel that goes on the out side of the forum

i really appreciate it, if i confused u in any way just let me know and ill put my forums url on here so u can see what im talking about.

thanks a bunch

[Unknown]

It's just the same as HTML.  You could use a table, or a floating div, or... lots of things.

-[Unknown]

epyon

but like where?

i mean i had tryed another thing (adding a table next to the table that shows yours stats and your avatar) and i mean i was able to get it but it mest up that table (the one with the avatar etc.) it had pushed it all the way to the far right side

im realyl sorry, im sure with all the dumb questions us noobs ask it probebly gets u and your team a lil tierd but this is all i need help on and im sure ill be set

thanx

Col

Hi,

I've done this, and so far so good, except, how do I get a tiled background-image up?

I've altered the css and removed the  background-color, and added the image to the same place as I put the header image (main forum directory). What am I doing wrong?

Thanks.

[Unknown]


Col

August 04, 2005, 10:52:46 AM #58 Last Edit: December 22, 2005, 08:44:46 AM by Col
Hi Unknown,

http://www.<edit>xxxxxx</edit>.org/community

Thanks.

[Unknown]

Find:

#headerarea
{
background-color: white;
border-bottom: 1px solid gray;
}
/* This is the main area of the forum, the part that's gray. */
#bodyarea
{
background-color: #D4D4D4;
}
/* And this is the bottom, where the copyright is, etc. */
#footerarea
{
color: black;
background-color: white;
border-top: 1px solid gray;
}


Replace:

#headerarea
{
border-bottom: 1px solid gray;
}
/* This is the main area of the forum, the part that's gray. */
#bodyarea
{
}
/* And this is the bottom, where the copyright is, etc. */
#footerarea
{
color: black;
border-top: 1px solid gray;
}


-[Unknown]

Advertisement: