<?phpfunction the_title(){$title = "Hello world";$title .= $page_title; //$page_title is declared in the webpageecho $title;}?>
<?php include("functions.php"); ?><?php$page_title="this is my index page.";?><html>bleh bleh all the head tags and stuff...<div id="title"><?php the_title(); ?></div>bleh bleh all the closing tags...</html>
function the_name(){ echo $level_name;}function the_page(){ echo $level_page; }
<?php include("functions.php"); ?><?php$level_number = "";$level_name = "Welcome!";$level_page = "Home Page";?>
<span><?php the_name(); ?></span>
I'm calling a functions.php at the top of my file and then calling some variables right after.
Then I use the functions, mainly of include and echo functions, in the page somewhere. The functions work based on the fact that the variable exists.
For example:
functions.php
index.php
Now you get my situation.
The two functions that don't work are:
Don't they look perfectly legit?
The variables are declared in the same way--
that's everything before my <!DOCTYPE>.
Now when I call the function:
It doesn't work. The page still loads--means there's no syntax problem. The function just doesn't echo anything. So what's wrong? All looks legit...
Additional info: If I abort the function and just call "echo $level_name;", it works. So it's something with my function...
Red
I see...
Something has to do with my functions.php wants to know the variables before it runs itself?
can someone clarify and tell me how I can achieve what I'm trying to achieve?
Regards,
Michael