Template wrapping and implodes

Im not to sure how this works, i been seeings pieces of code on this and im still at a loss why this is used instead of includes. This is the type of pieces of codes i been looking at

$page1 = implode("", file("../templ/members/header.htt"));
$page2 = implode("", file("../templ/footer.htt"));
$pagads = implode("", file("../templ/ads.htt"));

Is it used like this? theres a template file, that file is put onto a page then you call these 3 files which already have the postioning in a differnt file. Is it somthing like this?
Lee-BartlettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
>>$page1 = implode("", file("../templ/members/header.htt"));
that is just putting the contents of header.htt into the variable $page1. It does NOT automatically send the content to the browser. So, somewhere down the line it must explicitly be doing:
echo $page;

or perhaps is extracting some portion of the page only and echoing only the desired portion. The same applies to $page2 and $pageads
0
Lee-BartlettAuthor Commented:
Im still a little confused, are these varibles stored in like a functions folder or somthing. if you got a link to a page which explains the structuer, any more information would be greate
0
hieloCommented:
>>are these varibles stored in like a functions folder or somthing
I don't understand what you are asking

>>if you got a link to a page which explains the structuer
No link. The concept is simple actually. To clarify further, consider this:
$temp="hello world";

$temp is just a variable and you are "saving/storing" a string in it. The file() function will open the file you specify and will return an array with the file contents. Each array element correspondes to one line of content. implode() then "joins" those lines of content. So what you posted is equivalent to:

$content=array("hello","world");
$temp = implode("",$content);

at this point $temp contains "helloword", but is not automatially echoed. Thus far you have just stored a string value into $temp, but if you need to echo it, you need to do so explicitly:
echo $temp;
 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Lee-BartlettAuthor Commented:
Ty to my first question, i mean, if i wanted to use the file for like 9 pages i would be able to use the implode that file onto my page
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.