Include both php/ html files, catch & assign output to a string variable
I need a small core loader for a small website. I dont want to assing content and use php's echo / print functions in all included sub files. I want to be able to include both html / text files and executable php files. I want to catch raw html output and dynamic output from any included php file. This code below can do what I want. But I am not sure if this is a good solution. Any idea?
flush(); ob_start(); include($your_php_or_html_file); $content = ob_get_clean(); // output of included file ob_end_clean();
Maybe include_once is better than include.
Similar entries
- How to compress/backup just ascii-text files with linux tar
- Url manipulation with mod_rewrite and php-catcher for beginners
- How to override php mail function to catch abuse / spammer
- How to recursively create md5 and sha1 sum of your files.
- Search in text files recursively with PHP - Grep
- Iframe Trojan / Virus of Alcobro.net
- how to create 64 bit int, unsigned long long variable with c++
- Check password strength / safety with PHP and Regex
- Why tableless design, DIV vs. TABLE
- A simple website structure
- How can I disable Firefox Pop-up blocker for local html files?
- Redirect webpages with HTML, PHP, .htaccess, Java+Script, CGI-Perl, ASP.NET and ColdFusion
- Drupal 6 vs. Joomla 1.5 (2009)
- php
- How to make website popular
- Compress dirs and files recursively but exclude self
- Update / overwrite files and directories recursively with Linux mv - cp commands
- Search only in .php files under linux
- File Creation problem under Windows 7 with Notepad++ FTP
- Server Crash - "isc_socket_create: fcntl/reserved: Too many open files" [Howto Fix]

Post new comment