New - Help with Including Specific Data

Okay. So First, Hi phphelp community which I have been browsing for a few hours now. :slight_smile: I’m Wolf, :smiley: or Justun. Whichever. Anyways I have been looking all around the interwebs for the solution of which I require. :smiley:

So anyways, I’ve been looking for a way to use php to include data from a specific part of the code. I don’t have any code to show because I need this part to continue. xD

So, the idea is to have a file with a bunch of contents,


Hi I’m Data 1</some kind of div>
Hi I’m Data 2</some kind of div>
Hi I’m Data 3</some kind of div>
Hi I’m Data 4</some kind of div>

and include it into another page.

some data here and more data and Hi I’m Data 3</some kind of div> and some more data here.

now this is possible with multiple php files and including them say.


and use

here is some data here and more and <?php include 'data3.php' ?> and then we have some more data.

But with a lot of files this becomes really hard to manage. and I’m really stuck on this. :confused:

So if anyone had any way to point me in the direction I should be going this would be great and an example would be perfect too. :smiley:

do you have a database set up if so just add a table with the addresses of the files you wish to include then all you need to do is connect to the database and read them out in a loop. by using this method you can use the one connection to the database on every page you want them included on also to add a new file you only need to add it to the database and not every page.
hope that makes sense and helps with your problem :smiley:

Thank you that does make a lot of sense, however me and databases have a rough history. I’m trying to put together a small custom cms for only a few pages. Is there anywhere you could possibly point me to that I could read up on. I’m sure with that I can figure it out but I don’t want to get stuck. :slight_smile: Thanks for the quick reply. :smiley:

I don’t mean to double post but I couldn’t find an edit button. xD Anyways I’m not sure if thats how I want to go with rereading it. See, I only want one file with all of the information in different places. So information in one php file separated by div’s or something and pull specific pieces of that information out to be shown. Is this possible?

Sponsor our Newsletter | Privacy Policy | Terms of Service