php-general Digest 24 Sep 2007 03:27:43 -0000 Issue 5035

Topics (messages 262388 through 262404):

file() ignores PHP tags
        262388 by: magoo
        262390 by: Peter Lauri
        262391 by: Peter Lauri
        262392 by: magoo
        262395 by: magoo
        262396 by: magoo
        262397 by: lists.dwsasia.com
        262400 by: Chris

Re: str_replace oddity
        262389 by: Peter Lauri

Interesting Rails Vs. PHP article
        262393 by: Colin Guthrie
        262394 by: Robert Cummings
        262398 by: Guillaume Theoret

Re: Getting PHP CLI on machine without compiling or changing the other part of 
the system
        262399 by: Chris
        262403 by: Robert Cummings

Re: Font size of text that will be written using php pack function
        262401 by: Chris

Re: Limiting connection to mysql using old mysql module (not mysqli)
        262402 by: Chris

Players Table
        262404 by: Karl james

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi NG!

I wanna output several kinds of ascii files. Two things are bothering me right now: 1. I don`t get the PHP starttag (<?php) in my output, but the ending tags. Is there anything I can to to get all of it?

2. How can I stop the browser to render HTML output, in order to get plain ascii?

Cheers!

--
Kind regards,
magoo
--- End Message ---
--- Begin Message ---
Your array that you get from the file() will contain the <?php tag, but you
will not see it in your browser as it is parsed as html.

header("Content-type: text/plain");

ontop of your script will output plain text. Hope it helps.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -----Original Message-----
> From: magoo [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 23, 2007 3:52 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] file() ignores PHP tags
> 
> Hi NG!
> 
> I wanna output several kinds of ascii files. Two things are bothering me
> right now:
> 1. I don`t get the PHP starttag (<?php) in my output, but the ending tags.
> Is there anything I can to to get all of it?
> 
> 2. How can I stop the browser to render HTML output, in order to get plain
> ascii?
> 
> Cheers!
> 
> --
> Kind regards,
> magoo
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Oh, and by the way, remember that the array that file() returns also will
contain the newline. Add the flag FILE_IGNORE_NEW_LINES if you don't want
them.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -----Original Message-----
> From: magoo [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 23, 2007 3:52 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] file() ignores PHP tags
> 
> Hi NG!
> 
> I wanna output several kinds of ascii files. Two things are bothering me
> right now:
> 1. I don`t get the PHP starttag (<?php) in my output, but the ending tags.
> Is there anything I can to to get all of it?
> 
> 2. How can I stop the browser to render HTML output, in order to get plain
> ascii?
> 
> Cheers!
> 
> --
> Kind regards,
> magoo
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
"Peter Lauri" wrote:
Your array that you get from the file() will contain the <?php tag,
but you will not see it in your browser as it is parsed as html.

header("Content-type: text/plain");

ontop of your script will output plain text. Hope it helps.


Hi NG!

I wanna output several kinds of ascii files. Two things are
bothering me right now:
1. I don`t get the PHP starttag (<?php) in my output, but the ending
tags. Is there anything I can to to get all of it?

2. How can I stop the browser to render HTML output, in order to get
plain ascii?

Yes, that is a little better. Thanks for that!
But now all the PHP is removed. Is there some other header to send, in order to get PHP in my output?

--
Kind regards,
magoo
--- End Message ---
--- Begin Message ---
"Peter Lauri" wrote:
Your array that you get from the file() will contain the <?php tag,
but you will not see it in your browser as it is parsed as html.

header("Content-type: text/plain");

ontop of your script will output plain text. Hope it helps.

I wanna output several kinds of ascii files. Two things are
bothering me right now:
1. I don`t get the PHP starttag (<?php) in my output, but the ending
tags. Is there anything I can to to get all of it?

2. How can I stop the browser to render HTML output, in order to get
plain ascii?


Weird thing: I acually get my PHP echoed, but I get two HTML doctypes (the same one...).


--
Kind regards,
magoo
--- End Message ---
--- Begin Message ---
"Peter Lauri" wrote:
Your array that you get from the file() will contain the <?php tag,
but you will not see it in your browser as it is parsed as html.

header("Content-type: text/plain");

ontop of your script will output plain text. Hope it helps.

I wanna output several kinds of ascii files. Two things are
bothering me right now:
1. I don`t get the PHP starttag (<?php) in my output, but the ending
tags. Is there anything I can to to get all of it?

2. How can I stop the browser to render HTML output, in order to get
plain ascii?


Weird thing: I acually get my PHP echoed, but I get two HTML doctypes (the same one...).


--
Kind regards,
magoo
--- End Message ---
--- Begin Message ---
>
> Yes, that is a little better. Thanks for that!
> But now all the PHP is removed. Is there some other header to send, in
> order
> to get PHP in my output?
>

Could you send the code you are having? If you are doing it properly all
should be shown, it will not remove anything. The file() don't parse the
content.

/Peter

--- End Message ---
--- Begin Message ---
magoo wrote:
Hi NG!

I wanna output several kinds of ascii files. Two things are bothering me right now: 1. I don`t get the PHP starttag (<?php) in my output, but the ending tags. Is there anything I can to to get all of it?

2. How can I stop the browser to render HTML output, in order to get plain ascii?

$string = file_get_contents($filename_here);

echo htmlspecialchars($string, ENT_QUOTES);

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
No, turn Magic Quotes off :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 23, 2007 3:10 AM
> To: Jim Lucas
> Cc: Kevin Waterson; [EMAIL PROTECTED]
> Subject: Re: [PHP] str_replace oddity
> 
> So replace ' \" ' instead of ' " '.
> 
> On 9/22/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
> > Kevin Waterson wrote:
> > > I am using str_replace to strip double quotes.
> > >
> > > $string = 'This string has "quotes" in it';
> > >
> > > $string = str_replace('"', '', $string);
> > >
> > > this seems to work, yet when I put the $string into mysql,
> > > it uses backslashes to escape where the quotes were. The
> > > double-quotes are gone, yet it still escapes the 'ghost'
> > > where they were.
> > >
> > > I even tried
> > > str_replace(array("\x8c", "\x9c", "'", '"'), '', $string)
> > > but the ghost remains and mysql continues to escape them.
> > >
> > > I check the charsets, and the db is Latin-1 and the sting is ISO-8859-
> 1
> > >
> > > Any thoughts on this would be most graciously accepted.
> > > Kind regards
> > > kevin
> > >
> > >
> > is $string honestly something that you are getting via a form submit?
> >
> > if so, your system might have magic quotes enabled.
> >
> > This would automatically escape quotes with the attempt to make the
> > values safer, and then you go and run your str_replace command and
> > remove the double quotes, you end up leaving the '\' that the system
> > automatically put in the value for you.
> >
> > read up on magic quote gpc
> >
> > hope this helps.
> >
> > Jim
> >
> > --
> > Jim Lucas
> >
> >
> >      "Perseverance is not a long race;
> >          it is many short races one after the other"
> >
> > Walter Elliot
> >
> >
> >
> >      "Some men are born to greatness, some achieve greatness,
> >          and some have greatness thrust upon them."
> >
> > Twelfth Night, Act II, Scene V
> >      by William Shakespeare
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Thought ppl here may be interested in this:
http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

Originally linked from /.:
http://developers.slashdot.org/article.pl?sid=07/09/23/1249235

Col

--- End Message ---
--- Begin Message ---
On Sun, 2007-09-23 at 18:02 +0100, Colin Guthrie wrote:
> Thought ppl here may be interested in this:
> http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html
> 
> Originally linked from /.:
> http://developers.slashdot.org/article.pl?sid=07/09/23/1249235

It's funny, every once in a while a PHP article comes up on Slashdot and
a lot of Rails fanboys slam it because of it's function names and sloppy
code. Those who are objective and have a clue about PHP's history know
that a lot of the strangely named functions are due to keeping the same
function name as the C/C++ function the PHP function is wrapping.
Additionally, as many here know, crappy PHP is usually due to crappy
programmers :)

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
That's actually a very good article and while I don't agree with some
of it (most notably #6, the I love SQL.. I find a good ORM layer to be
a life saver should you ever need to make database structure changes
without having all your apps collapse all over themselves), I
certainly agree with the main idea: that rails is an excellent
teacher.

My current job is writing PHP code but I once completed a project with
rails and strongly believe that I'm a better PHP programmer because of
it. Rails is basically a very nice implementation of a whole bunch of
enterprise patterns DONE RIGHT! I tend to associate the term
"enterprise" with slow, bloated, overly complicated and barely
functional but in this case, the enterprise patterns implemented are
all worth knowing.

We have our own simple framework that's quite fast and does nothing
more than it needs to. It allows us to write new functionality very
quickly and easily. The place I work has more programmers experienced
with php and therefore it just made sense for me to learn PHP instead
of them all learn Ruby. I still routinely recommend they try rails at
least one, on their own, just for the hell of it because they'll be so
much better afterwards. It's easy to do things the wrong way in PHP
but it's pretty hard with rails. It pretty much forces you to do
things properly and while that can be maddening at first it's worth
the effort.

On 9/23/07, Colin Guthrie <[EMAIL PROTECTED]> wrote:
> Thought ppl here may be interested in this:
> http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html
>
> Originally linked from /.:
> http://developers.slashdot.org/article.pl?sid=07/09/23/1249235
>
> Col
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Peter Lauri wrote:
Hi,

In a current project we have developed a piece of software that run
independently and that only requires php5 as a CLI component.

Now we want to use this software on other machines, and the only requirement
it that the machine has php5 installed. Fine for now, but then we have
started to get request from clients to use this on their machines, as they
need our software there. Then we informed them that we need to compile php
on their machine. But due to the sensitive machines that they have, they
rejected that idea. So now we need to find a way to have PHP5 on the
machine, without compiling it on their machine and changing their
environment.

Must be pretty sensitive machines. What sort of system is it? redhat based? debian? something else?

You could create a package of some sort, build that on your machine and send that to them.

Providing:
- you're running the same versions (of the main packages - gcc, libc)
- you're on the same type of hardware (i386 compared to amd64 etc).

Even easier - if you're using php that doesn't require any extra components (ie you don't need something like pcntl which isn't in the base php5-cli packages), just get them to install the appropriate package.


If they're running gentoo or *bsd which are pretty much compile-only systems, then you're out of luck.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
On Mon, 2007-09-24 at 11:05 +1000, Chris wrote:
> Peter Lauri wrote:
> > Hi,
> >
> > In a current project we have developed a piece of software that run
> > independently and that only requires php5 as a CLI component.
> >  
> > Now we want to use this software on other machines, and the only requirement
> > it that the machine has php5 installed. Fine for now, but then we have
> > started to get request from clients to use this on their machines, as they
> > need our software there. Then we informed them that we need to compile php
> > on their machine. But due to the sensitive machines that they have, they
> > rejected that idea. So now we need to find a way to have PHP5 on the
> > machine, without compiling it on their machine and changing their
> > environment.
> 
> Must be pretty sensitive machines. What sort of system is it? redhat 
> based? debian? something else?
> 
> You could create a package of some sort, build that on your machine and 
> send that to them.
> 
> Providing:
> - you're running the same versions (of the main packages - gcc, libc)
> - you're on the same type of hardware (i386 compared to amd64 etc).
> 
> Even easier - if you're using php that doesn't require any extra 
> components (ie you don't need something like pcntl which isn't in the 
> base php5-cli packages), just get them to install the appropriate package.
>
> If they're running gentoo or *bsd which are pretty much compile-only 
> systems, then you're out of luck.

VMWare is your friend. Create a guest of their OS of choice and build
there.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
rdpweb wrote:
Hi All
I am just converting the data from database to excel format.For that i am
using pack function of php . But i want some data to be in bold like
Employee Name = ABC

http://pear.php.net/package/Spreadsheet_Excel_Writer

It has support for doing this.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Per Jessen wrote:
Stut wrote:

Indeed, but only if you're making a lot of repetitive queries to the
database.

Which is typically what a busy website does :-)

The query cache only works if you give it exactly the same query.

That is:

select blah from table where id=1;

if it changes to

select blah from table where id=2;

then it's not fetched from the cache and thus hits the real data (this then gets cached in case it's called again next time).

or even

select blah, blah2 from table where id=1;

will not hit the first cache because the fields are different.

http://dev.mysql.com/doc/refman/4.1/en/query-cache-how.html

However, since the OP wants to reduce the number of connections to the database, query caching may reduce the time each
connection is held for it will not reduce the overall number of
connections.

The number of connections is presumably only important if we speak about
the number of concurrent connections.  If each query can be dealt with
faster due to caching, the number of concurrent connections should
drop.

Err no - it still has to connect to the database (thus use a connection slot) to even get to the cache.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Team,

I am trying to start this up.
Just not sure if I am doing this correctly or not.
Can you please advise?
I am sure you all have seen my post from before.

Have, I created the players table right?

Players
------------------------
Id_Number ( int )
First_Name ( varchar32 )
Last_Name ( varchar32 )
NFL_Team ( varchar32 )
Fantasy_team ( varchar32 )
Position ( varchar32 )
College ( varchar32 )
Height (tinyint)3 
Weigh (tinyint) 3
Years of experience ( tinyint )3
Salary cap (int )6

I have the ID number marked as the primary key.

Is that right?

Another thought.
I am not sure on what to do with the players stats.
Should that be in the same table as his profile info?
Like Passing Yards, touchdowns, etc.

Your advice, is greatly appreciated and respected!!!


Karl James
[EMAIL PROTECTED]
www.theufl.com
 

--- End Message ---

Reply via email to