473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

problem with globals (?)

Hi there,

I have a center-file index.php
in it various files are included: inc/config.php, inc/functions.php

in config.php $pagetitle is declared.
if i call Header(), located in functions.php, it builds the header
part:
<html> thrue to <body> (by including header.php)
the pagetitle is reffered to as $GLOBALS['pagetitle'] and that works.

i also have a function in functions.php called NotPriviledged( $title,
$meta, $java )
It returns
Header();
echo 'You are not priviledged to view this page.';
Footer();

$title is meant for an additional pagetitle, $meta for additional
meta-tags, and java for additional javascripts.

Somehow, i'm unable to get the variables inside Header() (/header.php)
by calling NotPriviledged.

How do i get them in there?

Frizzle.

Jun 27 '06 #1
4 1190
before you call function NotPriviledged,
have you assign a value to $GLOBALS['pagetitle'] ?

this global variable might be empty because you only declare $pagetitle
not the global variable. The $pagetitle value is not accessible from
NotPriveledged function.

--
http://blog.deshot.com
http://www.groupvita.com
frizzle wrote:
Hi there,

I have a center-file index.php
in it various files are included: inc/config.php, inc/functions.php

in config.php $pagetitle is declared.
if i call Header(), located in functions.php, it builds the header
part:
<html> thrue to <body> (by including header.php)
the pagetitle is reffered to as $GLOBALS['pagetitle'] and that works.

i also have a function in functions.php called NotPriviledged( $title,
$meta, $java )
It returns
Header();
echo 'You are not priviledged to view this page.';
Footer();

$title is meant for an additional pagetitle, $meta for additional
meta-tags, and java for additional javascripts.

Somehow, i'm unable to get the variables inside Header() (/header.php)
by calling NotPriviledged.

How do i get them in there?

Frizzle.


Jun 27 '06 #2
*** frizzle escribió/wrote (27 Jun 2006 03:05:52 -0700):
Somehow, i'm unable to get the variables inside Header() (/header.php)
by calling NotPriviledged.

How do i get them in there?


Check this:

http://es2.php.net/global

<?php
$a = 1;
$b = 2;

function Sum()
{
global $a, $b;

$b = $a + $b;
}

Sum();
echo $b;
?>

--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Jun 27 '06 #3
http://us3.php.net/manual/en/function.header.php

header() is a built in function used to send HTTP headers. Change the
name.

You should be seeing an error unless you've turned them off.

frizzle wrote:
Hi there,

I have a center-file index.php
in it various files are included: inc/config.php, inc/functions.php

in config.php $pagetitle is declared.
if i call Header(), located in functions.php, it builds the header
part:
<html> thrue to <body> (by including header.php)
the pagetitle is reffered to as $GLOBALS['pagetitle'] and that works.

i also have a function in functions.php called NotPriviledged( $title,
$meta, $java )
It returns
Header();
echo 'You are not priviledged to view this page.';
Footer();

$title is meant for an additional pagetitle, $meta for additional
meta-tags, and java for additional javascripts.

Somehow, i'm unable to get the variables inside Header() (/header.php)
by calling NotPriviledged.

How do i get them in there?

Frizzle.


Jun 28 '06 #4

ImOk wrote:
http://us3.php.net/manual/en/function.header.php

header() is a built in function used to send HTTP headers. Change the
name.

You should be seeing an error unless you've turned them off.

frizzle wrote:
Hi there,

I have a center-file index.php
in it various files are included: inc/config.php, inc/functions.php

in config.php $pagetitle is declared.
if i call Header(), located in functions.php, it builds the header
part:
<html> thrue to <body> (by including header.php)
the pagetitle is reffered to as $GLOBALS['pagetitle'] and that works.

i also have a function in functions.php called NotPriviledged( $title,
$meta, $java )
It returns
Header();
echo 'You are not priviledged to view this page.';
Footer();

$title is meant for an additional pagetitle, $meta for additional
meta-tags, and java for additional javascripts.

Somehow, i'm unable to get the variables inside Header() (/header.php)
by calling NotPriviledged.

How do i get them in there?

Frizzle.


Header() was a mistake of mine, i called it Head(); ( and Foot(); )
Anyway, i'll have time to look at your responses in the evening.
Thanks!

Jun 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stephane Pointu | last post by:
Hi All, I'm turning mad with global variables... In created a simple test script with 2 functions which worked fine but the other one i need doesn't work. Register_globals is On. Here are the...
0
by: infinull | last post by:
I am making a script that is a very complex Content Management system. it makes a UDM navigation bar and writes content and a title. i want it to write content other that just basic text, like a...
0
by: John Roth | last post by:
I've found a case where it seems that Python is importing two copies of a module without any reason or indication. It took me a while to verify that this is what is occuring: I had to write a...
14
by: Xah Lee | last post by:
Python documentation, http://python.org/doc/2.4.1/lib/typesfunctions.html ----------------- 2.3.10.3 Functions Function objects are created by function definitions. The only operation on a...
0
by: dbuchanan | last post by:
Hello, The actions pane locks up after selecting a listbox. I have tried all kinds of things and have narrowed it down to this. If I click in the listbox the action pane locks up. Neither a...
5
by: TPJ | last post by:
I have the following code: ----------------------------------- def f(): def g(): a = 'a' # marked line 1 exec 'a = "b"' in globals(), locals() print "g: a =", a
2
by: Event Horizon | last post by:
Hi, I'm trying to add an simple upload applet to shopping cart script. My new applet form sends all needed post fields ( quantity, product, etc... ) but the "file" post field is hardcoded in...
9
by: Dave | last post by:
Hi guys, I have just set up a duplicate server running: apache 2.54, mysql 5.04 and php 5.04 This is the same setup as as the server we are using now, apart from the hardware inside. I have...
10
by: SoulIntruder | last post by:
Hello folks. I have a beginners question. I have such script: <?php $User = $_POST; $Password = $_POST; $Database = $_POST;
1
by: cokofreedom | last post by:
if __name__ == '__main__': print "Globals (For Loop):" try: for i in globals(): print "\t%s" % i except RuntimeError: print "Only some globals() printed\n" else: print "All globals()...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.