/    Sign up×
Community /Pin to ProfileBookmark

Getting information

I have this script on my page.

<?php
$boat = array (
stock_num=>”10584″,
boat_yr=>”2006″,
boat_mk=>”Bryant”,
boat_md=>”219 WalkThrough”,
boat_sn=>”BRA21969F506″,
engine_yr=>”2006″,
engine_mk=>”Mercruiser”,
engine_md=>”350MAG”,
engine_sn=>”0W338003″,
trailer_yr=>”2006″,
trailer_mk=>”Boat Mate”,
trailer_md=>”2220001″,
trailer_sn=>”5A7BB22246T000044″,
options=>”Snap-In Carpet, Docking Lights, Ski Mirror, Transom Radio Remote, Tandem Axle Trailer w/ Brakes, Swing Tongue”,
addoptions=>”Bravo I Outdrive, 4 Blade Stainless Steel Prop”,
colors_dk=>”White”,
colors_hl=>”White with Orange Sport Stripe”,
colors_cp=>”Beige”,
colors_st=>”White”,
);
?>

Because i use this same information on more than one page, is it possible to put this info in a .txt file and pull the info from it? I will be inserting the variables into different locations on each page. Thanks in advance.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 02.2006 — Just put that exact code into a file (including the <?php ?> tags). Then wherever you want to initialize that array in another file, simply do:
[code=php]
require "filename.php";
[/code]

if the include file ("filename.php" in this example) is in another directory, then you'll need to specify the full or relative path to the file. Or, if you put the include file into a directory which is in your php include path, you don't have to worry about it. See www.php.net/require for more info.
Copy linkTweet thisAlerts:
@techguru6966authorAug 02.2006 — Thank you so much. It worked perfectly. I have about 70 boats that i have to post online for our dealership. This is going to save me so much time. I have a main page and then i have a print page. I am putting all the information in the data.php file and have the pages pull the info from that file. Check out the site....www.bunchmarine.com
×

Success!

Help @techguru6966 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...