Page 1 of 1

Inluding a header and footer

Posted: November 5th, 2007, 2:24 pm
by Stargater59
Hello, I'm wondering how I would go about adding an include to include a header and footer.

In the header I would have my site's links, and banner, etc.. And the footer would contain a few links, and close all the DIV tags opened in the header. I do the same thing with SMF, and it works perfectly, however, when I try to add an include to the very top of the skins template file, it doesn't work. It's as if though nothing was added at all.

Is there a way to do this? I'm using GuMax 3.2.1, as the design will work better within my site's template.

Thanks for any help.

Re: Inluding a header and footer

Posted: November 6th, 2007, 12:26 am
by Paul
I believe you could do that by editing GuMax.php. Make sure your header and footer files are in the right place in order to make it work properly.

Re: Inluding a header and footer

Posted: November 6th, 2007, 1:19 am
by Stargater59
Where would be the right place? I've tried putting the include in this spot:

Code: Select all

<body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
<?php if($this->data['body_onload'    ]) { ?>onload="<?php     $this->text('body_onload')     ?>"<?php } ?>
 class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">

<?php include('header.php');?>

    <!-- =================== gumax-page =================== -->
    <div id="gumax-page">
    <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>

    <!-- Header -->
    <div id="gumax-header">
        <a name="top" id="contentTop"></a>

        <!-- Site Logo -->
        <div id="gumax-p-logo">
But it doesn't work. The header.php file is in the skins folder. Should it be somewhere else?

Re: Inluding a header and footer

Posted: November 6th, 2007, 1:35 am
by Paul
It should work, the file should be in the folder where GuMax.php is in.

Re: Inluding a header and footer

Posted: November 6th, 2007, 2:30 am
by Stargater59
Well, that's how I have it. However I noticed when I looked at the page's source, it looked like this:

Code: Select all

<body  class="mediawiki ns-0 ltr page-Main_Page">

    <!-- =================== gumax-page =================== -->
    <div id="gumax-page">
    
    <!-- Header -->
    <div id="gumax-header">
        <a name="top" id="contentTop"></a>
include('header.php');
        <!-- Site Logo -->
        <div id="gumax-p-logo">

            <a style="background-image: url(/wiki/skins/common/images/wiki.png);" href="/wiki/index.php/Main_Page" title="Main Page"></a>
        </div>
        <!-- end of Site Logo -->

        <!-- Login -->
        <div id="gumax-p-login">
            <ul>
Why would it be doing that? I'm not entirely sure how it's doing that when I have the include above
<!-- =================== gumax-page =================== -->

But when viewing the page's source, it shows up several lines below that.. And why isn't the PHP getting executed?

Re: Inluding a header and footer

Posted: November 6th, 2007, 8:15 am
by Paul
You need put PHP tag for your include, try this:

Code: Select all

<?php include('header.php'); ?>
Let me know if it works.

Re: Inluding a header and footer

Posted: November 6th, 2007, 2:14 pm
by Stargater59
Yes, that's how it is in the actual code. But when I view it in Firefox's 'View page Source' it comes out like that.

Re: Inluding a header and footer

Posted: November 7th, 2007, 3:17 am
by Stargater59
Ok, I have resolved my issue.

To clear up my last post, what I meant was, in GuMax.php I had

Code: Select all

<?php include('header.php');?>
But when I viewed the page's source via 'View Page Source' in Firefox, what I saw was

Code: Select all

include('header.php');
Which didn't make any sense. So, I just went to the wiki, to see if I could figure anything out, and my header was there. I remember my cache being cleared. So I added the footer, and my CSS. But nothing changed. That is until I cleared my cache. And now everything is there.

Short answer: Clear cache. :D

So, thank you for your help. And I really like your themes. Keep it up!