Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-22-2005, 01:27 AM   #1
Registered: Oct 2003
Location: Canada
Posts: 672

Rep: Reputation: 46
PHP Variable = function?

Hey guys, I'm hoping someone out there can tell me how to do this, or if this is possible.

Basically I have a php script that i want to do a few things
It includes top.php - which contains variables that have relative paths to images

it includes a page designated by Get in the address, these pages are like faq.php or something - these pages I want to contain functions that will run and store the data into a big $body variable.

includes show.php - show.php will take all the variables, like the paths to the images, the title variable and such, and echo all the variables out through a template.

The Problem I'm having is that the page it loads from GET, contains php, its not static html, so it doesn't go into a variable, I want the mysql statements to run, create the html, then stick it into a variable....

Is this possible? Thanks for reading guys. I appreciate it.
Old 01-22-2005, 02:27 AM   #2
Registered: Oct 2003
Location: Canada
Posts: 672

Original Poster
Rep: Reputation: 46
well just incase anyone was curious what I could do to make something like that happen, I've decided I will have each included page have a function called body(). and then in the page included at the bottom that is suppose to handle displaying all the data, I will make it call the function body. THanks for anyone who reads.
Old 01-22-2005, 06:28 AM   #3
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,388

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
You could do :
PHP Code:
$body = eval(file_get_contents("file.php")); 
Not sure if I understood you well though...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
can a C function return value to Shell Script variable yarnar Programming 17 06-02-2010 05:54 PM
C++ / Passing a variable by reference to a class member function. sepulture Programming 12 11-15-2005 10:23 PM
Bash Script Passing variable to Function nutthick Programming 2 02-02-2005 05:15 AM
Passing one php function result as a parameter to another php function davee Programming 13 09-12-2004 12:08 PM
Question about function with variable number of parameters xailer Programming 4 01-13-2004 11:37 AM

All times are GMT -5. The time now is 06:26 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration