473,387 Members | 1,798 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,387 software developers and data experts.

variables (new to php! please help me!)

SA
hello,

i have many pages (page1.php .. page100.php) and each of them include
some fixed subpages (top.php, bottom.php).
each subpage (top.php, bottom.php) uses a variable ("theme") defined
in its "parent" (one of the pageX.php).
this variable is also used (not only defined) in the parent page
itself. i would like to have the variable "theme" defined in a single
external file, instead of defyning it for every page. is it possible?

sorry for the probably stupid question, im new to php.

thank you in advance.
lx
Jul 17 '05 #1
2 1710
SA wrote:
hello,

i have many pages (page1.php .. page100.php) and each of them include
some fixed subpages (top.php, bottom.php).
each subpage (top.php, bottom.php) uses a variable ("theme") defined
in its "parent" (one of the pageX.php).
this variable is also used (not only defined) in the parent page
itself. i would like to have the variable "theme" defined in a single
external file, instead of defyning it for every page. is it possible?

sorry for the probably stupid question, im new to php.


If you include your fixed content early enough then simply define $theme
in top.php.

Jul 17 '05 #2
di******@hotmail.com (SA) wrote in message news:<48**************************@posting.google. com>...
hello,

i have many pages (page1.php .. page100.php) and each of them include
some fixed subpages (top.php, bottom.php).
each subpage (top.php, bottom.php) uses a variable ("theme") defined
in its "parent" (one of the pageX.php).
this variable is also used (not only defined) in the parent page
itself. i would like to have the variable "theme" defined in a single
external file, instead of defyning it for every page. is it possible?

sorry for the probably stupid question, im new to php.

thank you in advance.
lx


Hi,

Yes, you can include a fixed external file which declares and defines
all global variables to be used. For example you can create a file
(config.php)
define some variables here ($globTheme = 'classic').
In all other files just include this file as first statement.
Afterwards it will be available to the main file and all other
included files. But remember that whenever you change the value of a
variable, old value will get lost (depends on the scope of variable).

regards,
rahul
Jul 17 '05 #3

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

Similar topics

4
by: DOTNET | last post by:
Hi, Anybody help me regarding this error: I am assigning the values to the session variables when the button is clicked and passing these session variables to the next page and when I am...
6
by: Steven Kalcevich | last post by:
Hi all. I am working on finishing an oscommerce based site and need some help. One page is listing in 1 column 6 down, I wish to have a layout of 4 across and 5 down. When there is more then 20...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
1
by: manohar208 | last post by:
<html> <head> <title>Trang goi mail</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <?php $to = "vytien123@yahoo.com"; $from =...
7
by: Electric Co. | last post by:
Hello, note: This is for a Faculty web site that is undergoing a migration to an open source solution so my motives are legit. I need to build a relay from IIS handling URL_A to a PHP server...
2
by: kid | last post by:
Hi i need help i want to pass javascript variable to php. here's my sample code its not working. please someone help me.... <select name='dbPages' OnChange='getLayoutID(this.value)'> <option...
2
by: hcaptech | last post by:
This is my Test.can you help me ? 1.Which of the following statement about C# varialble is incorrect ? A.A variable is a computer memory location identified by a unique name B.A variable's name...
13
by: Apostle | last post by:
Hi all, after thinking for sometimes, I thought it will be great opportunity to learn if I will start from scratch and build my own register/login system. Here is the thread that I will be posting...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.