Share your knowledge at the LQ Wiki.
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, 02:27 AM   #1
Registered: Oct 2003
Location: Canada
Posts: 699

Rep: Reputation: 47
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, 03:27 AM   #2
Registered: Oct 2003
Location: Canada
Posts: 699

Original Poster
Rep: Reputation: 47
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, 07:28 AM   #3
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 5,393

Rep: Reputation: 409Reputation: 409Reputation: 409Reputation: 409Reputation: 409
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 06:54 PM
C++ / Passing a variable by reference to a class member function. sepulture Programming 12 11-15-2005 11:23 PM
Bash Script Passing variable to Function nutthick Programming 2 02-02-2005 06:15 AM
Passing one php function result as a parameter to another php function davee Programming 13 09-12-2004 01:08 PM
Question about function with variable number of parameters xailer Programming 4 01-13-2004 12:37 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:38 PM.

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