String File for Website

+2 Jonas Meise · May 29, 2015
Hey Guys
When I followed Buckys android dev tutorials I noticed that there is this String file where you save all your Text in variables so you can change them at one point and it updates everywhere in the application.

While I am programming a website atm I was wondering how I could do the same with php/html/css So that I can have those texts saved in one place. For example my navigationbar titles. It would be really usefull if I could change them from one place and didn't have to go to each individual php file and change them all separately.

Thanks for your help :)

LuPaw

Post a Reply

Replies

Oldest  Newest  Rating
0 Sampan Verma · May 29, 2015
I highly doubt if you know PHP.
Still I will tell you...(bcuz thats why im here)
create a config.php or anything you like{you can use your own extension also}.
in all the php files of the project add

store all your variables in config.php file and then you can use anywhere you want.

Related :- 
require() is used to require a file. If a file doesnt exist, apache will generate an error.
include() is used to include a file. If the fie doesnt exist, no problem to will go on to next line.
similarly we have require_once() and include_once()
you can guess what they do
0 Sampan Verma · May 29, 2015
I highly doubt if you know PHP.
Still I will tell you...(bcuz thats why im here)
create a config.php or anything you like{you can use your own extension also}.
in all the php files of the project add

store all your variables in config.php file and then you can use anywhere you want.

Related :- 
require() is used to require a file. If a file doesnt exist, apache will generate an error.
include() is used to include a file. If the fie doesnt exist, no problem to will go on to next line.
similarly we have require_once() and include_once()
you can guess what they do
0 Jonas Meise · May 29, 2015
Thanks for the answer.

PS: I never said I'm good at PHP. I'm quite a newbie at programming in general so please be polite ;)
  • 1

HTML / CSS / Web Design

107,283 followers
About

Discuss, share, ask, learn and teach HTML5 and CSS3.

Links
Moderators