is there a way to make a php page only output content that is generated
from php statements, such as print, or echo? ie: if I have whitespace
(or other text) outside my <?php .... ?block i do not want that to be
returned.
of course i can do this by making sure my php file starts with <?php and
ends with ?and there is no leading or trailing whitespace. but if
whitespace does creep into my file then it would be neat if there was
some kind of directive or something that would make sure it doesn't get
output.
i ask this because the output from my script will be interpreted by
another program so i want the output to be specific space delimited
values with no leading/trailing whitespace.
of course i should probably just output my content in xml format and
make my interpreting program parse xml, which accommodates for
whitespace... but... that would be smart, which i am not.
thanks!
ken 6 2369
Hi,
Like you said, keeping the file trimmed is the easiest way. You could
also try using output buffering (ob_start), and trimming the result.
On Apr 13, 4:31 pm, ken <k...@nospam.comwrote:
is there a way to make a php page only output content that is generated
from php statements, such as print, or echo? ie: if I have whitespace
(or other text) outside my <?php .... ?block i do not want that to be
returned.
of course i can do this by making sure my php file starts with <?php and
ends with ?and there is no leading or trailing whitespace. but if
whitespace does creep into my file then it would be neat if there was
some kind of directive or something that would make sure it doesn't get
output.
i ask this because the output from my script will be interpreted by
another program so i want the output to be specific space delimited
values with no leading/trailing whitespace.
of course i should probably just output my content in xml format and
make my interpreting program parse xml, which accommodates for
whitespace... but... that would be smart, which i am not.
thanks!
ken
ken wrote:
is there a way to make a php page only output content that is generated
from php statements, such as print, or echo? ie: if I have whitespace
(or other text) outside my <?php .... ?block i do not want that to be
returned.
of course i can do this by making sure my php file starts with <?php and
ends with ?and there is no leading or trailing whitespace. but if
whitespace does creep into my file then it would be neat if there was
some kind of directive or something that would make sure it doesn't get
output.
i ask this because the output from my script will be interpreted by
another program so i want the output to be specific space delimited
values with no leading/trailing whitespace.
of course i should probably just output my content in xml format and
make my interpreting program parse xml, which accommodates for
whitespace... but... that would be smart, which i am not.
thanks!
ken
No. PHP has no control over what's outside the <?php and ?tags.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
On 14 Apr, 03:58, Jerry Stuckle <jstuck...@attglobal.netwrote:
ken wrote:
is there a way to make a php page only output content that is generated
from php statements, such as print, or echo? ie: if I have whitespace
(or other text) outside my <?php .... ?block i do not want that to be
returned.
of course i can do this by making sure my php file starts with <?php and
ends with ?and there is no leading or trailing whitespace. but if
whitespace does creep into my file then it would be neat if there was
some kind of directive or something that would make sure it doesn't get
output.
i ask this because the output from my script will be interpreted by
another program so i want the output to be specific space delimited
values with no leading/trailing whitespace.
of course i should probably just output my content in xml format and
make my interpreting program parse xml, which accommodates for
whitespace... but... that would be smart, which i am not.
thanks!
ken
No. PHP has no control over what's outside the <?php and ?tags.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Not necessarily true. There's nothing to stop you writing a filter (in
PHP or other language) which processes a PHP script to return just the
PHP code, and then pass that through the interpreter - and with
mod_rewrite it could all be done transparently. But its not the way to
solve the OPs problem.
C.
C. wrote:
On 14 Apr, 03:58, Jerry Stuckle <jstuck...@attglobal.netwrote:
>ken wrote:
>>is there a way to make a php page only output content that is generated from php statements, such as print, or echo? ie: if I have whitespace (or other text) outside my <?php .... ?block i do not want that to be returned. of course i can do this by making sure my php file starts with <?php and ends with ?and there is no leading or trailing whitespace. but if whitespace does creep into my file then it would be neat if there was some kind of directive or something that would make sure it doesn't get output. i ask this because the output from my script will be interpreted by another program so i want the output to be specific space delimited values with no leading/trailing whitespace. of course i should probably just output my content in xml format and make my interpreting program parse xml, which accommodates for whitespace... but... that would be smart, which i am not. thanks! ken
No. PHP has no control over what's outside the <?php and ?tags.
-- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstuck...@attglobal.net ==================
Not necessarily true. There's nothing to stop you writing a filter (in
PHP or other language) which processes a PHP script to return just the
PHP code, and then pass that through the interpreter - and with
mod_rewrite it could all be done transparently. But its not the way to
solve the OPs problem.
C.
Exactly true. In your case you're using PHP to filter a file. It does
not mean that PHP has any control over what's outside the <?php and ?>
tags. It means you're using a language (it could be ANY language) to
modify the text.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
==================
ken wrote:
is there a way to make a php page only output content that is generated
from php statements, such as print, or echo? ie: if I have whitespace
(or other text) outside my <?php .... ?block i do not want that to be
returned.
of course i can do this by making sure my php file starts with <?php and
ends with ?and there is no leading or trailing whitespace.
Make sure there's no leading whitespace (which is pretty obvious) and
simply leave off the ?at the end.
--
"Checking identity papers is a complete waste of time. If anyone can
be counted on to have valid papers, it will be the terrorists".
Mary Pegg wrote:
ken wrote:
>is there a way to make a php page only output content that is generated from php statements, such as print, or echo? ie: if I have whitespace (or other text) outside my <?php .... ?block i do not want that to be returned.
of course i can do this by making sure my php file starts with <?php and ends with ?and there is no leading or trailing whitespace.
Make sure there's no leading whitespace (which is pretty obvious) and
simply leave off the ?at the end.
great suggestion. totally works.
thanks!
ken This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mmccaws |
last post by:
Thanks ahead for your help
I'm trying to learn what I can do with echo and print statements. I
figured out the echo statement and below is the simple version using
print. I've tried two dozen...
|
by: Bob |
last post by:
Everybody,
I've been doing a lot of on-line research and cannot find
any reference to the exact problem I'm having.
Let me preface this question with the fact that I'm coming
from an Oracle...
|
by: Marcus |
last post by:
Is there something that can be set in SQL to not print output to the
screen? Something like SET NOCOUNT ON, only in this case, I don't
want it to print any output except what my script specifies...
|
by: Jay Chan |
last post by:
I am trying to use a command line program to run a stored procedure
that generates output in a comma-delimitted format. Somehow, ISQL or
OSQL always wrap the lines at 256 characters. I believe this...
|
by: Luke Wu |
last post by:
I have been using the getline function from K&R2 for simple character
input.
The prototype is
int getline(char *s, int limit); /* returns 0 to signal EOF */
This function simply calls...
|
by: ted benedict |
last post by:
hi everybody, i hope this is the right place to discuss this weird
behaviour. i am getting dynamically generated text or xml from the
server side using xmlhttprequest. if the server side data is...
|
by: Jefferis NoSpamme |
last post by:
Hi all, I'm trying to limit the file size of an image submission and I keep
running into various problems. I've got most of it working, but I'm stumped
and I have a basic question as to WHY this...
|
by: Sandman |
last post by:
Hello,
I'm building a website in PHP and Javascript. The registration
portion is divided into 2 sections:
1. In one, I get info about the visitor. This is sent via POST to a php
script which is...
|
by: peridian |
last post by:
I've gotten a really weird result crop up on my site, and I can't find any information on the web that it has been seen elsewhere. Given how weird this is, I guess it's probably a symptom of either...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
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...
|
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...
| |