Treehouse: Grow your CSS skills. Land your dream job.

Including and gathering of different snippets from one php-file

  • # September 22, 2011 at 3:09 am

    Hello fellow pirates, yaaarrrr!
    That was a lot of ‘including’ in the title…

    Anyways, I hope you can help me with this problem of mine.

    I’m making a website where I’m using PHP includes to include files such as header.php, sidebar.php and footer.php. Is there any way to gather the code from these files and put them into one single file called includes.php – and in the individual pages simply just include bits from includes.php? If that’s possible, how do I do this?

    Thanks in advance,

    # September 22, 2011 at 11:36 am

    I’m not PHP expert, so I’d probably say ‘no’. Is there a reason why you need this to happen?

    # September 22, 2011 at 1:38 pm

    Simply because it’s a mess looking at in the FTP, since I have quite a lot of files in my directory – and it’d make it a lot easier to manage those snippets from one file.

    # September 22, 2011 at 3:01 pm

    If it’s a mess, just throw them all into a folder called ‘includes’.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.