JetJagger Posted October 2, 2008 Share Posted October 2, 2008 Goal: I am trying to create a flat-file array that will allow me to edit any variable for an entire Website from one setup.php page. I create a file called 'setup.php' wherein the array looks like this: <?php $setup['1']='page file path or other variable'; $setup['2']='page file path or other variable'; $setup['3']='page file path or other variable'; ?> Then, I included this in the page HEAD where a variable needs to be changed: <?php require("setup.php"); ?> Problem: Where I'm getting lost is what to insert inside the page file in place of where I would usually hard-code the file or object reference, ESPECIALLY IF I WANT TO PULL-IN A PATH TO A FILE. When I use: <?php echo $setup['1'] ?> ....all I see in my webpage is "page file path or other variable" (without quotes), but what I NEED to see is the actual file that I would normally see would I have used a traditional standalone PHP include. In other words, my setup.php file is really just going to be a list of files to include. Hypothetically (though shown incorrectly here for demonstration purposes), I need an execution like this... <?php $setup['1']='<?php include("http://www.whatever01.php"); ?>'; $setup['2']='<?php include("http://www.whatever02.php"); ?>'; $setup['3']='<?php include("http://www.whatever03.php"); ?>'; ?> I can only hope I explained this correctly. Anyone's prompt assistance is greatly appreciated. -Jet- - Quote Link to comment Share on other sites More sharing options...
CroNiX Posted October 2, 2008 Share Posted October 2, 2008 What if you <?php include($setup['1']); ?> ? Quote Link to comment Share on other sites More sharing options...
JetJagger Posted October 2, 2008 Author Share Posted October 2, 2008 Lemme try real quick. Quote Link to comment Share on other sites More sharing options...
JetJagger Posted October 2, 2008 Author Share Posted October 2, 2008 No joy with your suggestion. I'm just getting an "no stream" error message. Quote Link to comment Share on other sites More sharing options...
CroNiX Posted October 2, 2008 Share Posted October 2, 2008 I didn't try with a url, but <?php $setup['1'] = 'index.php'; include($setup['1']); ?> worked Quote Link to comment Share on other sites More sharing options...
JetJagger Posted October 2, 2008 Author Share Posted October 2, 2008 CroNix, I'm a flippen idiot. It did work.... I misspelled my file name.....TWICE. Duh. (LOL) Thanks! -Jet- Quote Link to comment Share on other sites More sharing options...
CroNiX Posted October 2, 2008 Share Posted October 2, 2008 LOL, we've all done it Quote Link to comment Share on other sites More sharing options...
redarrow Posted October 2, 2008 Share Posted October 2, 2008 do the array like this better looking................ as you can see ive started the array at 1 <?php $urls=array(1=>"http://www.gogole.com","http://www.msn.com","http://yahoo.com"); echo $urls[1]; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.