![]() |
include in string ?
Hello,
Is it possible to include something in string or with function ? If not, how to do that ? I have to make it in string. When I use the string, it should includes it. $include = include("file/admin.php"); |
Wait, what?
You want to include that file into a variable? AFAIK it's not possible. But why would you want to do that? |
My script's template system uses tpl files. In tpl files, you can only use $value. If you use include("file");
it would be bad because the included file contains appear at the very top of the page. I mean, how to include file instead of include("file.php"); is there anyway to include file with function or anything else ? |
you can use include to save the return content of a document. the manual gives an example:
php Code:
if you want the whole content and not just the return value of the file, you can always use file_get_contents Another thing you might want to get into account here, is the performance too, specially if they are big files. You don't want them all to be hold in the memory if they are big. |
That is the point. Thank you.
|
great, glad I could help. Sounds like you are trying to make an CMS or at least a templates system, good luck.
|
But wait. The file which I include isnt easy as much as only a string in it. It includes many functions and etc. How to make it return ?
Here is the file xcheaphotel.com/comments/talkphp.php |
I'm not fully sure I'm understanding so I hope I don't point you in the wrong direction; you might be interested in output buffering. Check out the following Output Control Functions, which will allow you to do something akin to the following;
php Code:
This is just a very rudimentary example but could be more on the right track? |
Yes! That works pretty nice. Thanks...
|
| All times are GMT. The time now is 04:59 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0