473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Parse PHP, capture output and use as string??

I'm not sure what to search the web for, so I wonder if someone here
can help me?

I have a website that uses many individual php pages. I'd like to
simplify design updates by using these scripts as includes, but I'm
trying to avoid having loads of:

$output_string.="<tr><td>blah blah".$some_variable;
$output_string.="blah blah</td></tr>";

You know the kinda thing.

Is there a way of parsing the script in the php processor and then
capturing the string created and dropping it into my templating script?

Thanks

Pete

Oct 10 '06 #1
2 6619
I think I've answered my own question.

//at the start of the page I put....
ob_start();

//and at the end I put......
$output_string=ob_get_contents();
ob_end_clean();

Seems to work, but if you know better then please say so.

Pete

Oct 10 '06 #2
pe**********@googlemail.com wrote:
I think I've answered my own question.

//at the start of the page I put....
ob_start();

//and at the end I put......
$output_string=ob_get_contents();
ob_end_clean();

Seems to work, but if you know better then please say so.

Pete
That should be ok, I'm using it as a base for my templating engine and I
had no problems so far.

--

B.r.K.o.N.j.A = Bionic Robotic Knight Optimized for Nocturnal Judo and
Assasination
Oct 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Frank Teoh | last post by:
I am trying to capture the output of os.system() into a string without success. Since os.system() returns only its exit_status, how can I do that? system(...) system(command) -> exit_status ...
11
by: hoopsho | last post by:
Hi Everyone, I am trying to write a program that does a few things very fast and with efficient use of memory... a) I need to parse a space-delimited file that is really large, upwards fo a...
0
by: neil | last post by:
For integration with a credit card processing gateway i need to be able to capture a small XML formatted string passed back to my page from the processing company. It is sent back to the same...
10
by: Michael B. Trausch | last post by:
Alright... I am attempting to find a way to parse ANSI text from a telnet application. However, I am experiencing a bit of trouble. What I want to do is have all ANSI sequences _removed_ from...
5
by: Muffin | last post by:
I am trying to capture the out put of a command line program. Let say ping or maybe better yet nslookup. I would like to launch and then capture all the output , redirect it I guess to a string...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
2
by: jdbartlett | last post by:
I'm trying to capture output from a command line utility (XMLSec), but only get an empty result. If I call the script from the command line, I see XMLSec's output, but I can't seem to capture it!...
3
by: rupinderbatra | last post by:
Hello everyone, I am using a regular expression to parse a text string into various parts -- for ex: string "How do you do" will be changed to array with all the words and white spaces. I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.