We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,307 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

can I include multiple files in php code

<div id="hedar_main">
            <div id="hedar1">
               <?php include('menu.php')?>            
            </div><!--end of header1 -->
        </div><!--end of header-main -->
     </div><!--end of header -->

<div class="rightdiv">
               <?php include('local_auth.php')?> 

               <?php include('news.php')?>

               <div class="midal_right">
                <center><div class="divimg"><img src="images/home_img1.jpg" /></div></center>
                <center><div class="divimg"><img src="images/home_img2.jpg" /></div></center>
               </div><!--end of midal_right -->  
              </div><!--end of rightdiv -->
<div id="futter">
    <div id="futter_main">
        <div id="futter1">
         <?php include('footer.php'); ?>
      </div>
    </div>
</div>               

Here I included 4php file So my question is that is this proper way of coding please guide me ...
Thank you in advance..!

10
Contributors
17
Replies
3 Weeks
Discussion Span
6 Months Ago
Last Updated
21
Views
Question
Answered
shilu2
Newbie Poster
18 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Yes this is all fine

simplypixie
Practically a Master Poster
642 posts since Oct 2010
Reputation Points: 157
Solved Threads: 118
Skill Endorsements: 5

Yes, you can include multiple files in PHP Code.

rajengg
Newbie Poster
19 posts since Jun 2012
Reputation Points: 0
Solved Threads: 9
Skill Endorsements: 0

Having multiple files is possible :)

<M/>
Senior Poster
3,609 posts since Apr 2012
Reputation Points: 64
Solved Threads: 81
Skill Endorsements: 95

yes lol why not

Nicejattz
Newbie Poster
2 posts since Nov 2012
Reputation Points: 0
Solved Threads: 1
Skill Endorsements: 0

This is turning into a 'me too' thread. Can we all agree that you can, and wait for the OP to return? Oh darn, I just did it too. :(

diafol
Keep Smiling
Moderator
10,838 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,534
Skill Endorsements: 61

no problem but best for use

 include_onc() 

function

rajeevphp2011
Light Poster
26 posts since Nov 2011
Reputation Points: 7
Solved Threads: 6
Skill Endorsements: 1

@rajeev,

That should be -

include_once()

:) Oh, almost forgot, me too. ;)

AndreRet
Industrious Poster
4,706 posts since Jan 2008
Reputation Points: 391
Solved Threads: 481
Skill Endorsements: 20

better still require_once()

hakeemtunde
Junior Poster in Training
50 posts since Dec 2007
Reputation Points: 10
Solved Threads: 8
Skill Endorsements: 2

the various includes and requires have different uses, so choose the right one for the job. One isn't necessarily better than another in all cases.

diafol
Keep Smiling
Moderator
10,838 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,534
Skill Endorsements: 61

you right in some cases

hakeemtunde
Junior Poster in Training
50 posts since Dec 2007
Reputation Points: 10
Solved Threads: 8
Skill Endorsements: 2

Thank you to all....!!

shilu2
Newbie Poster
18 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

OK, are we solved?

diafol
Keep Smiling
Moderator
10,838 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,534
Skill Endorsements: 61

You may mark this solved now... hopefully this has answered your question.

<M/>
Senior Poster
3,609 posts since Apr 2012
Reputation Points: 64
Solved Threads: 81
Skill Endorsements: 95

@MICHAEL Sorry to say but I don't know how can I marked it solved??
Please help me...
Thank you.

shilu2
Newbie Poster
18 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Yes, you can add multiple includes. But, best you can add include_once instead of include.

javedsai
Junior Poster in Training
66 posts since Dec 2009
Reputation Points: 14
Solved Threads: 2
Skill Endorsements: 0

@MICHAEL Sorry to say but I don't know how can I marked it solved??

There's a link button at the bottom of the screen to mark the thread solved.

diafol
Keep Smiling
Moderator
10,838 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,534
Skill Endorsements: 61

Thank you

shilu2
Newbie Poster
18 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Month Ago by diafol, hakeemtunde, <M/> and 6 others

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.1221 seconds using 2.84MB