Thread: variable scope
View Single Post
  #7  
Old 10-24-2005, 01:33 AM
Osterling Osterling is offline
 
Join Date: Jan 2004
Posts: 381
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i have it inserted in <?php ?> tags. the function runs in body.php but not in nav.php but i've changed it to .php now.

it maybe a sloppy way to code, i'm just beginning my coding experince with php :-/

if you want i can post each page of code so you can get a good idea, if that is what your asking for.

index.php
PHP Code:
<?php
include ("header.php");
include (
"articles/top.php");
include (
"articles/body.php");
include (
"footer.php");
?>
nav.php
PHP Code:

                <TD COLSPAN=12>
            <IMG SRC="images/layout_02.gif" WIDTH=605 HEIGHT=12 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=3>
            <IMG SRC="images/layout_03.gif" WIDTH=48 HEIGHT=23 ALT=""></TD>
        <TD>
            <IMG SRC="images/layout_04.gif" WIDTH=165 HEIGHT=23 ALT=""></TD>
        <TD>
            <IMG SRC="images/layout_05.gif" WIDTH=12 HEIGHT=23 ALT=""></TD>
        <TD COLSPAN=3>
            <IMG SRC="images/layout_06.gif" WIDTH=117 HEIGHT=23 ALT=""></TD>
        <TD COLSPAN=4>
            <IMG SRC="images/layout_07.gif" WIDTH=263 HEIGHT=23 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=3>
            <IMG SRC="images/layout_08.gif" WIDTH=48 HEIGHT=48 ALT=""></TD>
        <TD COLSPAN=4>
            <IMG SRC="images/layout_09.gif" WIDTH=283 HEIGHT=48 ALT=""></TD>
        <TD COLSPAN=2>
            <IMG SRC="images/layout_10.gif" WIDTH=177 HEIGHT=48 ALT=""></TD>
        <TD COLSPAN=3>
            <IMG SRC="images/layout_11.gif" WIDTH=97 HEIGHT=48 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=2>
            <IMG SRC="images/layout_12.gif" WIDTH=36 HEIGHT=47 ALT=""></TD>
        <TD COLSPAN=4 align=left>
                <?php echo pagetitle(); ?></td>
        <td colspan=4 align=right>Table Row 2</td>

        <TD COLSPAN=2>
            <IMG SRC="images/layout_14.gif" WIDTH=86 HEIGHT=47 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=12>
            <IMG SRC="images/layout_15.gif" WIDTH=605 HEIGHT=23 ALT=""></TD></TR><tr>
body.php
PHP Code:
<td colspan=3 background="images/layout_16.gif">
    <img src="images/layout_16.gif" width=48 height=12 alt="">
</td>
<td name=body colspan=7 rowspan=2 bgcolor="#0000FF" valign="top" style="padding-left: 4; padding-right: 4; padding-top: 4; padding-bottom: 4">
<?php

if (!$_GET['article'])
{
     include (
'article/home.php');
}
else
{
     
$pagetitle=$_GET['article'];
     
     switch(
$pagetitle)
     {
     case 
"home":
     include (
'article/home.php');
     break;
     
     case 
"theaccident":
     include (
'article/theaccident.php');
     break;
     
     
 default: }
}
?>
</td>
<TD COLSPAN=2 background="images/layout_18.gif">
            <IMG SRC="images/layout_18.gif" WIDTH=86 HEIGHT=12 ALT=""></TD>
    </TR>
    <TR>
        <TD COLSPAN=3 background="images/layout_19.gif">
            <IMG SRC="images/layout_19.gif" WIDTH=48 HEIGHT=236 ALT=""></TD>
article.php
PHP Code:
<?php
$titleofpage 
"The Accident";

function 
pagetitle()
{
  global 
$titleofpage;

  echo 
"Where You're At: <br>&nbsp;&nbsp;&nbsp;&nbsp;<strong>Index > The Guide >&nbsp;".$titleofpage."</strong>";
}
?>
<p class="MsoNormal" style="text-indent:.5in;line-height:150%">
I think we all have a moment when we see and acknowledge that we are
            indeed exposed to the real possibility of something extremely bad
            happening to us. That if we don?t start considering the consequences
            to our actions, we may regret what happens to us as a ripple affect
            from them. For me, It was never like I thought I was immune to the
            bad things, I just never thought it would happen to me.&nbsp; It was too
            unlikely in my eyes, so when the truck swerved I never could have
            guessed what would be coming next.&nbsp; I have always learned best by
            experience, and I guess this lesson was no different. </p>
            <p class="MsoNormal" style="text-indent:.5in;line-height:150%">It
            was Friday, and school had just let out. Instead of taking a ride
            from Brain I decided to get a ride from Ben.&nbsp; In the truck there was
            Ben, Matt, Chad and me.&nbsp; Ben and Matt were sitting in the front,
            while Chad and I sat in the back. We pulled out onto Fifth Street
            and I looked out my window. I remember seeing kids and then I felt a
            jerk.&nbsp; I slide to the middle of the back seat, and began to look
            through the windshield to see what was going on.&nbsp; It had been a van
            that pulled out in front of us that had caused Ben to swerve.&nbsp; I
            remember thinking to myself; I hope I make it out alright and then
            time slowed down dramatically.&nbsp; Looking through the windshield I
            could see the kids ahead, and before I had time to think ?what?s
            going to happen? I felt it. It felt as if we were hitting trees and
            running them over, but instead of trees they were kids. Then I felt
            the kids under the truck as it rolled over on them, and I remember
            hearing the screams from the people witnessing it.&nbsp; The sound of the
            screaming made me think back to Columbine, so when the truck finally
            stopped I was terrified of what just happened.&nbsp; I knew it was bad,
            if not from what I felt, what I saw but just from what I heard.</p>
            <p class="MsoNormal" style="text-indent:.5in;line-height:150%">It
            was then I realized how fast things can change, and without your
            control.&nbsp; How important it is to understand your actions may affect
            someone else and how unfair that might be to them.&nbsp; I?ve learned
            that I am mortal, that bad things can happen to me and that I need
            to be aware of the dangers and do my best to prevent them.&nbsp;
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01823 seconds
  • Memory Usage 1,830KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete