Closed Thread Icon

Topic awaiting preservation: php include question... Pages that link to <a href="https://ozoneasylum.com/backlink?for=12369" title="Pages that link to Topic awaiting preservation: php include question..." rel="nofollow" >Topic awaiting preservation: php include question...\

 
Author Thread
Thumper
Paranoid (IV) Inmate

From: Deeetroit, MI. USA
Insane since: Mar 2002

posted posted 08-19-2002 07:08

Can anyone give me some direction on how I would go about including only a certain portion of a php page into another...I guess I would be referring either to a declared variable or a function, but am unsure of the syntax in this case. Here is my scenario:

I have a php page that queries a database to generate a list of Flash movies that are managed on an admin level, which can be activated and deactivated. Basically, there are multiple movies being queried, but the includes will only represent 1 movie each. These includes will be dispersed among a website and placed into HTML tables. But I do not want to include() the entire list of movies, just one EACH. Here is basically what the include() should formulate:

code:
<td><?php require_once("movies.php"); echo "$active_movie_13";  ?></td>

Where $active_movie_13 represents the Flash object that should be included...



Would this be the way? Am I making this too inefficient/sloppy?



[This message has been edited by Thumper (edited 08-19-2002).]

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-19-2002 07:42

aeh, if I understood you correctly, the answer would be yes!

try to put the movielisting code into a function, include that file once, and then use something along the lines of
printMove(13) (or whatever you called your function) instead of including it.
But beware, if you don't code this right, you might have to make a lot of sql queries...

so long,

Tyberius Prime

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-19-2002 13:10

Thumper: Technically I'm not sure why you don't just grab the information from the database directly on the page you want it to be one but to answer the specific question (rather than querying your approach ) - I'd use something like this:

code:
$file_path = "http://$HTTP_HOST/movies.php";

$grab_bits = file($file_path);

if (!empty ($grab_bits)) {

$implode_bits = implode('', $grab_bits);

eregi("(SOME REGULAR EXPRESSION)", $implode_bits, $page_trim);

$flash_move = $page_trim[1];
}



It might not be the most efficient way of doing it and I would avoid this approach if possible but I suspect it would do what you want it to if you repalce SOME REGULAR EXPRESSION with the right regular expression depending on how you are doing things - presumably the unique bit would be something like:

quote:
<param name="movie" value="URL">



from the code here: http://faq.ozoneasylum.com/644/

Hmmmm reading your question again I'm still not sure about this being the solution - if it isn't could you go into a bit more detail?

___________________
Emps

FAQs: Emperor

Thumper
Paranoid (IV) Inmate

From: Deeetroit, MI. USA
Insane since: Mar 2002

posted posted 08-19-2002 16:41

Hmm...Emps querying the database direct would not be such a good idea as I am trying to maintain modularity with this as much as possible. I am thinking the fact that the "movies.php" is querying the whole table for me and is "refreshed" immediately after administrators make their changes, it will nullify the need to communicate with the database every time. Literally, all the "movies.php" page is accomplishing is to list the path's to each respective movie and carry some of the parameters that admins have manipulated for the object.

« BackwardsOnwards »

Show Forum Drop Down Menu