php-general Digest 21 Jul 2010 00:54:11 -0000 Issue 6856
Topics (messages 307028 through 307039):
Image Replication
307028 by: Dan Joseph
307029 by: Per Jessen
307030 by: rehmanms.gmail.com
307031 by: Bastien Koert
changing form based on variable
307032 by: David Mehler
307037 by: Bastien Koert
eval and HEREDOC
307033 by: Sorin Buturugeanu
307034 by: Daevid Vincent
307035 by: Sorin Buturugeanu
307038 by: lists.cmsws.com
307039 by: David Robley
Re: [PHP-DB] always the logic that messes me up.... Database fun!
307036 by: Jason Pruim
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Hi,
I'm wondering how you all are doing image replication between servers. I've
got some things in mind, but I'd like to see how others have done it.
We have a PHP application that accepts an image upload, then we want it to
show up on the other 2 web servers. We have 3 in a load balanced cluster.
Linux servers.
How did you go about it?
--
-Dan Joseph
http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code "NEWTHINGS" for 10% off initial order -- Reseller Plans also
available!
http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry
--- End Message ---
--- Begin Message ---
Dan Joseph wrote:
> Hi,
>
> I'm wondering how you all are doing image replication between servers.
> I've got some things in mind, but I'd like to see how others have
> done it.
>
> We have a PHP application that accepts an image upload, then we want
> it to show up on the other 2 web servers. We have 3 in a load
> balanced cluster. Linux servers.
>
> How did you go about it?
rsync triggered by inotify.
--
Per Jessen, Zürich (27.8°C)
--- End Message ---
--- Begin Message ---
We are doing it with nfs mount which is mounted on all servers
--
Shafiq
http://shafiq.pk
*** This Message Has Been Sent Using BlackBerry Internet Service from Mobilink
***
-----Original Message-----
From: Dan Joseph <dmjos...@gmail.com>
Date: Tue, 20 Jul 2010 10:21:55
To: PHP eMail List<php-gene...@lists.php.net>
Subject: [PHP] Image Replication
Hi,
I'm wondering how you all are doing image replication between servers. I've
got some things in mind, but I'd like to see how others have done it.
We have a PHP application that accepts an image upload, then we want it to
show up on the other 2 web servers. We have 3 in a load balanced cluster.
Linux servers.
How did you go about it?
--
-Dan Joseph
http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code "NEWTHINGS" for 10% off initial order -- Reseller Plans also
available!
http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry
--- End Message ---
--- Begin Message ---
On Tue, Jul 20, 2010 at 10:35 AM, <rehma...@gmail.com> wrote:
> We are doing it with nfs mount which is mounted on all servers
>
> --
> Shafiq
> http://shafiq.pk
> *** This Message Has Been Sent Using BlackBerry Internet Service from
> Mobilink ***
>
> -----Original Message-----
> From: Dan Joseph <dmjos...@gmail.com>
> Date: Tue, 20 Jul 2010 10:21:55
> To: PHP eMail List<php-gene...@lists.php.net>
> Subject: [PHP] Image Replication
> Hi,
>
> I'm wondering how you all are doing image replication between servers. I've
> got some things in mind, but I'd like to see how others have done it.
>
> We have a PHP application that accepts an image upload, then we want it to
> show up on the other 2 web servers. We have 3 in a load balanced cluster.
> Linux servers.
>
> How did you go about it?
>
> --
> -Dan Joseph
>
> http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
> Promo Code "NEWTHINGS" for 10% off initial order -- Reseller Plans also
> available!
>
> http://www.facebook.com/canishosting
> http://www.facebook.com/originalpoetry
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Our app runs using a piece of SAN / NAS storage common to all servers
--
Bastien
Cat, the other other white meat
--- End Message ---
--- Begin Message ---
Hello,
I've got a form, it's sticky, and it can either display on an insert
or update. Depending on whether i'm wanting to do an insert or update
the area the form gets it's input changes.
So, i've got a name field, if it's set to insert, not sure how to
differentiate between the two actions, name gets it's input from the
value of $_POST['name'] since it's sticky. If it's set to update that
name value is filled in by the name field output in a database. Also,
if insert the button for sending the form is called "add" if update
it's called "update" I'd like to know how to pull this off, because in
both cases the form entry fields are the same, i don't want to have to
write two forms when one should work.
Thanks.
Dave.
--- End Message ---
--- Begin Message ---
On Jul 20, 2010, at 13:28, David Mehler <dave.meh...@gmail.com> wrote:
> Hello,
> I've got a form, it's sticky, and it can either display on an insert
> or update. Depending on whether i'm wanting to do an insert or update
> the area the form gets it's input changes.
> So, i've got a name field, if it's set to insert, not sure how to
> differentiate between the two actions, name gets it's input from the
> value of $_POST['name'] since it's sticky. If it's set to update that
> name value is filled in by the name field output in a database. Also,
> if insert the button for sending the form is called "add" if update
> it's called "update" I'd like to know how to pull this off, because in
> both cases the form entry fields are the same, i don't want to have to
> write two forms when one should work.
> Thanks.
> Dave.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Simple, I assume you have an id for the record on update, so test for that and
just adjust the value of the button.
$btnValue = 'Submit';
If(isset($id)){
$btnValue ='Update';
}
Bastien
Sent from my iPod
--- End Message ---
--- Begin Message ---
Hello,
I am having trouble with a part of my templating script. I'll try to explain:
The template itself is HTML with PHP code inside it, like:
<div><?=strtoupper($user['name']);?></div>
And I have the following code as part of the templating engine:
$template = file_get_contents($file);
$template = "return <<<TEMPLATE\n".$template."\nTEMPLATE;\n";
$template = eval($template);
The problem is that the eval() HEREDOC combination gives the following output:
<?=strtoupper(Array['time']);?>
If in the HTML file (template) I use
<div><?=strtoupper({$user['name']});?></div>
I get <?=strtoupper(username);?> as an output.
I have tried closing the php tag like this:
$template = "return <<<TEMPLATE\n?>".$template."\nTEMPLATE;\n";
but the extra ?> only gets outputed as HTML.
This is my first post to this mailing list, so I great you all and thank you for
any kind of solution to my problem.
Thank you!
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Sorin Buturugeanu [mailto:m...@soin.ro]
> Sent: Tuesday, July 20, 2010 2:11 PM
> To: php-gene...@lists.php.net
> Subject: [PHP] eval and HEREDOC
>
> Hello,
>
> I am having trouble with a part of my templating script. I'll
> try to explain:
>
> The template itself is HTML with PHP code inside it, like:
>
> <div><?=strtoupper($user['name']);?></div>
>
> And I have the following code as part of the templating engine:
>
> $template = file_get_contents($file);
> $template = "return <<<TEMPLATE\n".$template."\nTEMPLATE;\n";
> $template = eval($template);
>
> The problem is that the eval() HEREDOC combination gives the
> following output:
>
> <?=strtoupper(Array['time']);?>
>
> If in the HTML file (template) I use
>
> <div><?=strtoupper({$user['name']});?></div>
>
> I get <?=strtoupper(username);?> as an output.
>
> I have tried closing the php tag like this:
>
> $template = "return <<<TEMPLATE\n?>".$template."\nTEMPLATE;\n";
>
> but the extra ?> only gets outputed as HTML.
>
> This is my first post to this mailing list, so I great you
> all and thank you for any kind of solution to my problem.
Why are you using HEREDOC to begin with? I personally find them to be ugly
and more trouble than they're worth.
You can write the same thing as this I think (untested):
$template = eval(file_get_contents($file));
But you might also consider using "include_once" or "require_once" instead
of this "eval()" business.
Also note, that a string can span more than one line and have variables in
it. It can even be used with code, so HEREDOC is again useless for most
situations:
$foo = "
Hello $name,\n
\n
Today is ".date('Y-m-d')."\n
\n
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\n
Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue
metus, mattis a sollicitudin in, placerat vitae elit.
\n
Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris.
";
--- End Message ---
--- Begin Message ---
Hello Vincent and thank you for your reply :).
That's true, I forgot to explain how I got to using HEREDOC, so ..
Using eval(file_get_contents($file)) just outputs the result on the
spot and I need
to get the whole output (without echoing it) and do some more things with it.
require_once() doesn't fit here (from what I can tell), because it
would still just
include the file in echo the output.
I think there must be a solution, but I'm missing something here ..
Thanks again!
--
Sorin Buturugeanu
http://www.soin.ro
On Wed, Jul 21, 2010 at 12:49 AM, Daevid Vincent <dae...@daevid.com> wrote:
>
> > -----Original Message-----
> > From: Sorin Buturugeanu [mailto:m...@soin.ro]
> > Sent: Tuesday, July 20, 2010 2:11 PM
> > To: php-gene...@lists.php.net
> > Subject: [PHP] eval and HEREDOC
> >
> > Hello,
> >
> > I am having trouble with a part of my templating script. I'll
> > try to explain:
> >
> > The template itself is HTML with PHP code inside it, like:
> >
> > <div><?=strtoupper($user['name']);?></div>
> >
> > And I have the following code as part of the templating engine:
> >
> > $template = file_get_contents($file);
> > $template = "return <<<TEMPLATE\n".$template."\nTEMPLATE;\n";
> > $template = eval($template);
> >
> > The problem is that the eval() HEREDOC combination gives the
> > following output:
> >
> > <?=strtoupper(Array['time']);?>
> >
> > If in the HTML file (template) I use
> >
> > <div><?=strtoupper({$user['name']});?></div>
> >
> > I get <?=strtoupper(username);?> as an output.
> >
> > I have tried closing the php tag like this:
> >
> > $template = "return <<<TEMPLATE\n?>".$template."\nTEMPLATE;\n";
> >
> > but the extra ?> only gets outputed as HTML.
> >
> > This is my first post to this mailing list, so I great you
> > all and thank you for any kind of solution to my problem.
>
> Why are you using HEREDOC to begin with? I personally find them to be ugly
> and more trouble than they're worth.
>
> You can write the same thing as this I think (untested):
>
> $template = eval(file_get_contents($file));
>
> But you might also consider using "include_once" or "require_once" instead
> of this "eval()" business.
>
> Also note, that a string can span more than one line and have variables in
> it. It can even be used with code, so HEREDOC is again useless for most
> situations:
>
> $foo = "
> Hello $name,\n
> \n
> Today is ".date('Y-m-d')."\n
> \n
> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
> \n
> Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue
> metus, mattis a sollicitudin in, placerat vitae elit.
> \n
> Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris.
> ";
>
--- End Message ---
--- Begin Message ---
On Wed, 21 Jul 2010 01:04:12 +0300, Sorin Buturugeanu <m...@soin.ro> wrote:
> Hello Vincent and thank you for your reply :).
>
> That's true, I forgot to explain how I got to using HEREDOC, so ..
>
> Using eval(file_get_contents($file)) just outputs the result on the
> spot and I need
> to get the whole output (without echoing it) and do some more things with
> it.
>
> require_once() doesn't fit here (from what I can tell), because it
> would still just
> include the file in echo the output.
>
> I think there must be a solution, but I'm missing something here ..
Check out the ob_* functions
You could do this
ob_start();
include "/your/file.php";
$output = ob_get_clean();
echo $output;
Jim
>
> Thanks again!
>
> --
> Sorin Buturugeanu
> http://www.soin.ro
>
>
> On Wed, Jul 21, 2010 at 12:49 AM, Daevid Vincent <dae...@daevid.com>
> wrote:
>>
>> > -----Original Message-----
>> > From: Sorin Buturugeanu [mailto:m...@soin.ro]
>> > Sent: Tuesday, July 20, 2010 2:11 PM
>> > To: php-gene...@lists.php.net
>> > Subject: [PHP] eval and HEREDOC
>> >
>> > Hello,
>> >
>> > I am having trouble with a part of my templating script. I'll
>> > try to explain:
>> >
>> > The template itself is HTML with PHP code inside it, like:
>> >
>> > <div><?=strtoupper($user['name']);?></div>
>> >
>> > And I have the following code as part of the templating engine:
>> >
>> > $template = file_get_contents($file);
>> > $template = "return <<<TEMPLATE\n".$template."\nTEMPLATE;\n";
>> > $template = eval($template);
>> >
>> > The problem is that the eval() HEREDOC combination gives the
>> > following output:
>> >
>> > <?=strtoupper(Array['time']);?>
>> >
>> > If in the HTML file (template) I use
>> >
>> > <div><?=strtoupper({$user['name']});?></div>
>> >
>> > I get <?=strtoupper(username);?> as an output.
>> >
>> > I have tried closing the php tag like this:
>> >
>> > $template = "return <<<TEMPLATE\n?>".$template."\nTEMPLATE;\n";
>> >
>> > but the extra ?> only gets outputed as HTML.
>> >
>> > This is my first post to this mailing list, so I great you
>> > all and thank you for any kind of solution to my problem.
>>
>> Why are you using HEREDOC to begin with? I personally find them to be
> ugly
>> and more trouble than they're worth.
>>
>> You can write the same thing as this I think (untested):
>>
>> $template = eval(file_get_contents($file));
>>
>> But you might also consider using "include_once" or "require_once"
> instead
>> of this "eval()" business.
>>
>> Also note, that a string can span more than one line and have variables
> in
>> it. It can even be used with code, so HEREDOC is again useless for most
>> situations:
>>
>> $foo = "
>> Hello $name,\n
>> \n
>> Today is ".date('Y-m-d')."\n
>> \n
>> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
>> \n
>> Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue
>> metus, mattis a sollicitudin in, placerat vitae elit.
>> \n
>> Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris.
>> ";
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Sorin Buturugeanu wrote:
> Hello,
>
> I am having trouble with a part of my templating script. I'll try to
> explain:
>
> The template itself is HTML with PHP code inside it, like:
>
> <div><?=strtoupper($user['name']);?></div>
>
> And I have the following code as part of the templating engine:
>
> $template = file_get_contents($file);
> $template = "return <<<TEMPLATE\n".$template."\nTEMPLATE;\n";
> $template = eval($template);
>
> The problem is that the eval() HEREDOC combination gives the following
> output:
>
> <?=strtoupper(Array['time']);?>
>
> If in the HTML file (template) I use
>
> <div><?=strtoupper({$user['name']});?></div>
>
> I get <?=strtoupper(username);?> as an output.
>
> I have tried closing the php tag like this:
>
> $template = "return <<<TEMPLATE\n?>".$template."\nTEMPLATE;\n";
>
> but the extra ?> only gets outputed as HTML.
>
> This is my first post to this mailing list, so I great you all and thank
> you for any kind of solution to my problem.
>
> Thank you!
Possibly your php environment has short-tags turned off.
Cheers
--
David Robley
To save trouble later, Joe named his cat Roadkill Fred
Today is Boomtime, the 56th day of Confusion in the YOLD 3176.
--- End Message ---
--- Begin Message ---
Hey Everyone,
I know it's not strictly on topic but the php-db list hasn't responded
and I haven't gotten any farther :)
So please read below and earn a free beer for anyone that can help me,
and can make it to Florida :)
Begin forwarded message:
From: Jason Pruim <li...@pruimphotography.com>
Date: July 18, 2010 8:35:49 PM EDT
To: php...@lists.php.net
Subject: [PHP-DB] always the logic that messes me up.... Database fun!
Hi everyone!
I'm trying to put together a completely database driven site so I
can learn how to do it...
I've gone to the extent of creating apache rewrite rules to redirect
all non-existent files/folders to my script to see if it exists
which works perfectly.
Where I'm running into trouble, is if I store the entire page inside
the database, and inside that page I'm grabbing info from another
part of the database how do I include that?
Such as:
pseudo -code:
//Display current page info
Grab current rate plans and prices from database
finish displaying page.
Now... It sounds easy enough but what I end up with on my page is:
echo <<
hosting info hosting info host info hosting info hosting info
hosting info host info hosting info
Current Plans
HTML;
include "hostingprices.php";
echo <<
More info about hosting
HTML;
The only thing I changed was the actual text cause I didn't want to
spam the list with my hosting schpeal :)
So how do I make that work? Any points in a direction? :)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---