beginner Question about including...
Posted: Mon Jul 26, 2010 1:52 pm
Hello Experts,
Brand new to PHP and love it, but finding some aspects hard to grasp and/or employ.
Right now, I've got some things working and have one simple question: Can I have some small snippet of code sitting in one .php file and use it in another .php file? I know about:
but that command seems to pull ONLY the ENTIRE page and insert it. I JUST want a portion of another page's code to be used; not insert the entire page.
Below is the code I want to put into page1.php. What command would I use in page2.php to have it displayed just like it's shown?
Seems I should be able to assign this code a name and then pull it using that name. The reason is I would actually have quite a few of these (above), but with different array names. I simply wanted to pull them out of page2.php and put them somewhere they wouldn't be accidentally messed with.
Hope that makes sense.
Thanks in advance to anyone who can help...
Brand new to PHP and love it, but finding some aspects hard to grasp and/or employ.
Right now, I've got some things working and have one simple question: Can I have some small snippet of code sitting in one .php file and use it in another .php file? I know about:
Code: Select all
<?php include("some_path_here");Below is the code I want to put into page1.php. What command would I use in page2.php to have it displayed just like it's shown?
Code: Select all
$prop_use_arr['Select'] = "Select";
$prop_use_arr['Primary Residence'] = "Primary Residence";
$prop_use_arr['Second Home'] = "Second Home";
$prop_use_arr['Investment'] = "Investment";
Hope that makes sense.
Thanks in advance to anyone who can help...