The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
variable scope
Well I running into a problem and I could use some advice. Let me explain how I'm setting up my site and what exactly it is that is giving me trouble.
I have a file which includes only 4 php include statements. One for the the header, nav, body and footer. Each contain part of the style and when all files are together it creates my style. Simple. Well my body.php page is where my text is. I use an include statement to bring in file it is suppose to retrieve, and within that file is a variable which contains a value "page title". I took the variable $titleofpage and used as an argument in my function I created. That variable named "titleofpage" scope isn't working in my navigation where I call a function that I created on index.php file. I call the function on the nav.php file but the page title doesn't show. I am thinking it has something to do with my variable scope. Any help would be appreciate, and I hope I made myself clear. |
#2
|
|||
|
|||
try
PHP Code:
|
#3
|
|||
|
|||
alright. i defined the variable in a html file, from there that file is called on from the body.php file in which it will show the variable. however when i use the variable in my nav.php file it won't show its value, and both body.php and nav.php are put together from include statements coming from the index.php file if that doesn't make sense let me know.
but how come it works fine for the body.php file but not nav.php? |
#4
|
|||
|
|||
you mentioned you're using functions?
If so use this as an example.. PHP Code:
|
#5
|
|||
|
|||
here is a little outline of my php pages and to help give a better idea of what it is i am needing help.
index.php (contains all include statements to execute the files below in that order) - header.php - nav.php (when I try to call the pagetitle function here to run it, it says undefined) - body.php (if I call the function here it will execute perfectly) >> articles(inserted through the php include statement > article 1 (which contains the function pagetitle) - footer.php how can i get it so that the function i created in the article 1.html file will run and execute in nav.php any help is always appericated. |
#6
|
|||
|
|||
I'm cunfused...
how can you make a function in an html file (article 1.html)? can you make small mock ups of each script? I'll have to test them out because I can't solve it. sorry. |
#7
|
|||
|
|||
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 Code:
PHP Code:
PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|