[fw-general] Zend_Acl with database backend tutorial/example

2008-04-08 Thread Robert Castley
Hi All
 
I am putting together a little tutorial/example on how I use Zend_Acl with a
database backend (SQLITE) in my application.  The basics of the example are
in place over at:
 



This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


[fw-general] Zend_Acl with database backend tutorial/example

2008-04-08 Thread Robert Castley
Hi All
 
I am putting together a little tutorial/example on how I use Zend_Acl with a
database backend (SQLITE) in my application.  The basics of the example are
in place over at:
 
 
http://framework.zend.com/wiki/display/ZFUSER/Using+Zend_Acl+with+a+database
+backend

Hopefully, this will be of use to someone else as well.  

I have provided database initialisation, core class and test example with
output.

- Robert 



This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] Our new Zend Framework Architect

2008-04-08 Thread Taco Jung
Matthew,

Indeed congratulations! Perhaps we should start calling you Mr. ZF ;-).

Regards, Taco.


Re: [fw-general] Our new Zend Framework Architect

2008-04-08 Thread Jason Qi
Wow, Matthew, Congratulation! 

I love your Form.

Jason.

   
-
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.

Re: [fw-general] Our new Zend Framework Architect

2008-04-08 Thread James Dempster
No slacking now Matthew!

Totally kidding, thank you for all your hard work.
Congrats with the new job role!

:)

/James

On Mon, Apr 7, 2008 at 9:35 PM, Wil Sinclair [EMAIL PROTECTED] wrote:

  Matthew Weier O'Phinney
  Software Architect   | [EMAIL PROTECTED]
  Zend - The PHP Company   | http://www.zend.com/

 Yikes! I knew there was something I forgot to do on Friday. Without
 further ado, it's my immense pleasure to announce that Matthew has been
 promoted to Software Architect at Zend. I'm sure I don't have to explain
 what he's done to deserve this here. ;)
 He'll still maintain his existing components and develop new components.
 But he'll also be heading up efforts that involve cross-cutting concerns
 with all components. The general consistency of design and quality
 across all components should benefit greatly from his attention.
 In addition, he will be heading up the initiative to define exactly what
 we'll be doing for the 2.0 release. This is of course a critical role as
 we make the right tradeoffs between improvements and backwards
 compatibility.
 Congrats Matthew!

 ,Wil



[fw-general] Zend_Form generated checkbox field

2008-04-08 Thread Aldemar Bernal
Hi guys,

just curious, doesn't Zend_Form create a hidden element with value 0 for the 
checkbox field?

I just want to skip the:

$model-checked_value = isset($values['my_checkbox']) ? $values['my_checkbox'] 
: 0;


Aldemar

Re: [fw-general] ZF and AJAX toolkit

2008-04-08 Thread Csányi András
Mon, 7 Apr 2008 22:43:07 +0200 -n
reto [EMAIL PROTECTED] írta:

 I'm just at the point where I'm going to implement some ajax-features
 in a somewhat bigger ZF based project.

Hi!

The next year (in januar, 2009) i will graduate on the University and
my thesis is build an application from open source tools. The tools are
php (Zend Framework), PostgreSQL and AJAX (jQuery). The first problem
was the php-AJAX co-operation. I think Zend Framework in this time not
so realy support the AJAX. This is my opinion, but I know this problem
is realy difficult. I haven't got time waiting the solution so I make
one.

The basic thing about me:
- I don't like write html
- I don't like write javascript

I wrote 2 class. The first make a html elements.
class HTML_Factory {
//there are the html factory methods
}

The View_Helpers is extends the HTML_Factory class

class CreateBody extends HTML_Factory{
public function CreateBody() {
return $body;
}
}

The second class is the AJAX_Factory. This class make the jQuery source
code.

This way is working me and I can - relative - fast building
applications. But I know this isn't the best way. Sometime I have to
refactor the AJAX_Factory class and this will be better day after
day. :)

In the next few days I will rebuild my blog and I will put the all
sourcecode there.

Sorry my English.

András

-- 
-- Csanyi Andras - http://sayusi.hu - Sayusi Ando --
-- Bízzál Istenben és tartsd szárazon a puskaport! - Cromwell --


RE: [fw-general] Zend_Translate doesn't cache when addTranslation is called

2008-04-08 Thread Robert Castley
Hi Rob,

I have come up with my own plugin that auto loads the translations and
caches them.  The code may not be perfect but hopefully it gives you an
idea:

BEGIN
class MyPlugin_Language extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$locale = new Zend_Locale();

/**
 * Cache options
*/
$frontendOptions = array('cache_id_prefix' = 'MyApp', 'lifetime' =
86400);
$backendOptions = array('cache_dir' = 'cache');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions,
$backendOptions);
Zend_Translate::setCache($cache);
  
$options = array('scan' = Zend_Translate::LOCALE_DIRECTORY);

/**
 * Scan languages dir. For CSV language files.  Auto-detect browser
 * language settings
*/
$translate = new Zend_Translate('csv', 'languages', 'auto',
$options);

/**
 * If browser language setting is not available default to English
*/
if (!$translate-isAvailable($locale-getLanguage())) {
$locale-setLocale('en');
}

$translate-setLocale($locale);

Zend_Registry::set('Zend_Translate', $translate);
}
} 
END

Cheers,

- Robert


-Original Message-
From: Rob L [mailto:[EMAIL PROTECTED] 
Sent: 07 April 2008 21:45
To: fw-general@lists.zend.com
Subject: [fw-general] Zend_Translate doesn't cache when addTranslation is
called


I wrote a custom adapter and am trying to load 13 different languages from
files. I can't simply read the entire directory because I am using
non-standard locale names and need full control. So in my bootstrap I call
the Zend_Translate constructor for my first language and then call
addTranslation for each of the remaining languages.

All of the languages get cached, but only the Zend_Translate constructor
actually checks to see if a language has been cached. If you call
addTranslation directly, it *always* calls the adapter to load the file.

For now as a workaround, I manually check to see if Zend_Cache already has
the key 'Zend_Translate_[my adapter here]' cached. But really, Zend should
simply check the cache for a hit every time addTranslation is called, right?

Rob
--
View this message in context:
http://www.nabble.com/Zend_Translate-doesn%27t-cache-when-addTranslation-is-
called-tp16539888p16539888.html
Sent from the Zend Framework mailing list archive at Nabble.com.



This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.




This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] ZF - APC tuning

2008-04-08 Thread James Dempster
I also get the same kind of results on Windows, installing APC for me
actually slows down the requests. My PC is dual booted so I tested the setup
in Ubuntu Linux which was so amazingly fast.

*Tested on: *Intel Dual Core 2.8GHz, 4GB RAM etc etc
*Tested using: *ab -n 2000 http://localhost/ (No concurancy cause we're
testing response speed not server load)

Website tested usues the following (but not limited to) ZF components MVC
including Modules, Zend_Db + Db_Table etc (metadata cached in Zend_Cache
sqlite), Zend_Config_Ini, Zend_Registry, Zend_Log, Zend_Session and all
classes associated with them. Some custom models. So it's a fairly good
senario. There's no extra caching other than the Zend_Db_Table metadata.

Windows XP Pro SP2, Apache2 mod_php   = 450ms
Windows XP Pro SP2, Apache2 mod_php + apc = 500ms
Ubuntu Linux 7.10, Apache2 mod_php= 150ms
Ubuntu Linux 7.10, Apache2 mod_php + apc  = 50ms

This goes to show that ZF is not at fault here. I'm not even sure if Windows
is at fault as I've heard great results about the new php fast cgi + iis 6.
It just seems that Apache + PHP + Windows is a bad mix (for production).

--
/James

On Mon, Apr 7, 2008 at 7:02 PM, Aldemar Bernal [EMAIL PROTECTED]
wrote:

 Well,

 after a weekend of testing I found that:

 - fastcgi (using zend core fastcgi and other fastcgi) didn't give me
 better
 results than using the mod_php, I couldn't test using IIS since I don't
 have
 it =P
 - apc and xcache with fastcgi gave always trouble when benchmarking using
 ab
 from apache (php crashed all the times).
 - turning off apc.stat really boost my code, but I had to change some
 things
 (relative require_once to absolute require_once using dirname(__FILE__))
 - it seems that even if apc.stat is turned off, it access the disk (well,
 obviously it does the first time it caches the files) because ramdisk
 still
 faster than using my files on my harddrive, it should be faster only the
 first time, but it's faster all the times (I checked out apc.php and I
 found
 that apc was already caching the files).
 - concluding, I'll use here in my dev laptop mod_php + apc with
 apc.filters
 filtering and caching only ZF files (in a ramdisk) and my customers
 windows
 servers I'll use mod_php + apc with apc.stat always off (maybe including
 the
 ramdisk thingy).

 Times:

 - fastcgi ~700ms
 - fastcgi + accelerator (apc or xcache) ~ 600ms
 - mod_php alone ~ 500ms
 - mod_php + apc + files in ramdisk ~ 300ms
 - mod_php + apc + apc.stat = 0 ~ 300ms
 - mod_php + apc + apc.stat = 0 + files in ramdisk ~ 110ms
 - mod_php + apc + apc.stat = 0 + apc.filtering (only caching ZF) + files
 in
 ramdisk (only ZF) ~ 280ms

 Again my setup is:

 - apache 2.2 (mod_php)
 - php 5.2.5
 - apc 3.0.17-dev
 - zf 1.5.1
 - windows xp home


 Still sucks, doesn't it :P

 btw, I couldn't any documentation about apc caching classes (maybe you
 were
 talking about user cache), the command I use to benchmark was:

 ab -c 5 -n 20 http://localhost/x/ (before running this command I
 opened
 twice the page in order that apc cached w/o fragmenting the files)

 The page I used did connect to a DB but doing nothing but a 'SET NAMES
 utf8'
 query, and disabling it didn't show any difference.


 Aldemar

 - Original Message - From: Matthew Weier O'Phinney 
 [EMAIL PROTECTED]
 To: fw-general@lists.zend.com
 Sent: Saturday, April 05, 2008 6:10 PM
 Subject: Re: [fw-general] ZF - APC tuning



  -- Aldemar Bernal [EMAIL PROTECTED] wrote
  (on Saturday, 05 April 2008, 02:40 PM -0500):
 
   I've been trying to make my app perform better, every request takes
   (according
   ab: apache stress tool) ~510ms, which is a lot!, over half second in
   every
   request?, so I installed and enabled APC but surprisly it performed
   even worst
   than w/o APC, ~650ms per request. Any of you have tried using APC w/
   ZF?
  
   The best results I had was using a RAM Disk, putting in it only zf it
   perform
   ~420ms and w/ the app ~330ms.
  
   My setup is:
  
   - apache 2.2
   - php 5.2.5
   - apc 3.0.17-dev
   - zf 1.5.1
   - windows xp home
  
   With the best configuration (zf and app running from ram disk) and
   using apc
   returns the same results ~330ms (so, no difference at all when using
   it from a
   ramdisk).
  
 
  A few things to note.
 
  First, I'm assuming you're using apache with mod_php. On windows, my
  understanding is that this simply doesn't perform terribly well. You may
  get better results with IIS+FastCGI (heck, you might try FastCGI with
  apache to see if that goes better, too). Regardless, Windows and Mac
  environments tend not to get you your best performance, though.
 
  Second, IIRC, APC allows you to preload classes. I'd recommend
  investigating that option.
 
  Third, how many requests are you benching? You need to run a fair number
  of requests with APC to ensure that the cache gets loaded and that
  you're actually hitting the cache (one or two requests simply won't do
  it). You may 

Re: [fw-general] Zend_Translate doesn't cache when addTranslation is called

2008-04-08 Thread Rob L

Thomas,

Thank you for such a quick and detailed reply to my question. I was
originally using the directory search with a constructor like this:

$translate = new Zend_Translate('[our custom adapter]', '/path_here', null,
array('scan' = Zend_Translate::LOCALE_FILENAME));

I had several translation files in a single directory:

en.txt
de.txt
...
zh_CN.txt
zh_TW.txt
...

en and de (and any other 2-letter language code) worked fine. But the
problem was that zh_CN and zh_TW were both getting saved under the key zh.
When I tried to access the data like this...

if($translate-isAvailable('zh_CN'))
 
...it would be false. So then I changed to call addTranslation once for
every language like this...

$translate-addTranslation('/path_here/zh_CN.txt', 'zh_CN');

...then when I call isAvailable('zh_CN') it would be true. Is there a
different way to support both zh_CN and zh_TW?

Thanks,
Rob
-- 
View this message in context: 
http://www.nabble.com/Zend_Translate-doesn%27t-cache-when-addTranslation-is-called-tp16539888p16558218.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Zend_Translate doesn't cache when addTranslation is called

2008-04-08 Thread Robert Castley
Hi David,
 
As per your suggestion, I have put a page up on the Wiki:
 
http://framework.zend.com/wiki/x/p6o http://framework.zend.com/wiki/x/p6o 
 
Cheers,
 
- Robert

  _  

From: David Rogers [mailto:[EMAIL PROTECTED] 
Sent: 08 April 2008 12:49
To: Robert Castley
Subject: Re: [fw-general] Zend_Translate doesn't cache when addTranslation
is called


Is there a snippet board somewhere in the ZF project? It would be invaluable
to keep this little code piece around for the community, methinks.

David

On Apr 8, 2008, at 5:48 AM, Robert Castley wrote:


class MyPlugin_Language extends Zend_Controller_Plugin_Abstract 
{ 
public function preDispatch(Zend_Controller_Request_Abstract $request) 
{ 
$locale = new Zend_Locale();

/** 
 * Cache options 
*/ 
$frontendOptions = array('cache_id_prefix' = 'MyApp', 'lifetime' =
86400); 
$backendOptions = array('cache_dir' = 'cache'); 
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions,
$backendOptions); 
Zend_Translate::setCache($cache); 
  
$options = array('scan' = Zend_Translate::LOCALE_DIRECTORY);

/** 
 * Scan languages dir. For CSV language files.  Auto-detect browser 
 * language settings 
*/ 
$translate = new Zend_Translate('csv', 'languages', 'auto',
$options);

/** 
 * If browser language setting is not available default to English 
*/ 
if (!$translate-isAvailable($locale-getLanguage())) { 
$locale-setLocale('en'); 
}

$translate-setLocale($locale); 

Zend_Registry::set('Zend_Translate', $translate); 
} 
} 




This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.





This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


RE: [fw-general] Zend_Translate doesn't cache when addTranslation is called

2008-04-08 Thread Robert Castley
Hi David,
 
As per your suggestion, I have put a page up on the Wiki:
 
http://framework.zend.com/wiki/x/p6o
BLOCKED::http://framework.zend.com/wiki/x/p6o 
 
Cheers,
 
- Robert

  _  

From: David Rogers [mailto:[EMAIL PROTECTED] 
Sent: 08 April 2008 12:49
To: Robert Castley
Subject: Re: [fw-general] Zend_Translate doesn't cache when addTranslation
is called


Is there a snippet board somewhere in the ZF project? It would be invaluable
to keep this little code piece around for the community, methinks.

David

On Apr 8, 2008, at 5:48 AM, Robert Castley wrote:


class MyPlugin_Language extends Zend_Controller_Plugin_Abstract 
{ 
public function preDispatch(Zend_Controller_Request_Abstract $request) 
{ 
$locale = new Zend_Locale();

/** 
 * Cache options 
*/ 
$frontendOptions = array('cache_id_prefix' = 'MyApp', 'lifetime' =
86400); 
$backendOptions = array('cache_dir' = 'cache'); 
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions,
$backendOptions); 
Zend_Translate::setCache($cache); 
  
$options = array('scan' = Zend_Translate::LOCALE_DIRECTORY);

/** 
 * Scan languages dir. For CSV language files.  Auto-detect browser 
 * language settings 
*/ 
$translate = new Zend_Translate('csv', 'languages', 'auto',
$options);

/** 
 * If browser language setting is not available default to English 
*/ 
if (!$translate-isAvailable($locale-getLanguage())) { 
$locale-setLocale('en'); 
}

$translate-setLocale($locale); 

Zend_Registry::set('Zend_Translate', $translate); 
} 
} 




This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.





This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


RE: [fw-general] Zend_Translate doesn't cache when addTranslation is called

2008-04-08 Thread Robert Castley
Hi Rob,

My code snippet seems to be handling this.  I just did a quick test whereby
I had the following language dir. Structure:

En
 - lang.en
En_US
 - lang.en_US

If I set my browser to en-us then it picks up the en_US lang file, if I
don't have a language set in my browser it defaults to en.

As, stated before don't use the addTranslation method, this didn't work for
me either and I had no end of troubles.

- Robert 

-Original Message-
From: Rob L [mailto:[EMAIL PROTECTED] 
Sent: 08 April 2008 13:51
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend_Translate doesn't cache when addTranslation
is called


Thomas,

Thank you for such a quick and detailed reply to my question. I was
originally using the directory search with a constructor like this:

$translate = new Zend_Translate('[our custom adapter]', '/path_here', null,
array('scan' = Zend_Translate::LOCALE_FILENAME));

I had several translation files in a single directory:

en.txt
de.txt
...
zh_CN.txt
zh_TW.txt
...

en and de (and any other 2-letter language code) worked fine. But the
problem was that zh_CN and zh_TW were both getting saved under the key zh.
When I tried to access the data like this...

if($translate-isAvailable('zh_CN'))
 
...it would be false. So then I changed to call addTranslation once for
every language like this...

$translate-addTranslation('/path_here/zh_CN.txt', 'zh_CN');

...then when I call isAvailable('zh_CN') it would be true. Is there a
different way to support both zh_CN and zh_TW?

Thanks,
Rob
--
View this message in context:
http://www.nabble.com/Zend_Translate-doesn%27t-cache-when-addTranslation-is-
called-tp16539888p16558218.html
Sent from the Zend Framework mailing list archive at Nabble.com.



This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.




This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] Zend_Translate doesn't cache when addTranslation is called

2008-04-08 Thread Rob L

UPDATE:

After a message from Robert Castley (thanks), I tried directory scan instead
of filename scan. It seemed to work. Here is an example of what works and
what doesn't work for me:

-
WORKS:
($dir contains folders zh_CN/ zh_TW/ en/ and de/ with translation files
inside)

$translate = new Zend_Translate('my_custom_adapter', $dir, null,
array('scan' = Zend_Translate::LOCALE_DIRECTORY));
print_r($translate-getList());

prints: Array ( [en] = en [zh_TW] = zh_TW [zh_CN] = zh_CN [de] = de )

-
DOESN'T WORK:
($dir contains files zh_CN.txt zh_TW.txt en.txt and de.txt)

$translate = new Zend_Translate('my_custom_adapter', $dir, null,
array('scan' = Zend_Translate::LOCALE_FILENAME));
print_r($translate-getList());

prints: Array ( [en] = en [de] = de [zh] = zh )


I will continue with DIRECTORY, but I would prefer to use FILENAME, but what
am I doing wrong that it combines zh_CN and zh_TW into a single locale?

Rob
-- 
View this message in context: 
http://www.nabble.com/Zend_Translate-doesn%27t-cache-when-addTranslation-is-called-tp16539888p16558540.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Form generated checkbox field

2008-04-08 Thread Matthew Weier O'Phinney
-- Aldemar Bernal [EMAIL PROTECTED] wrote
(on Tuesday, 08 April 2008, 05:47 AM -0500):
 just curious, doesn't Zend_Form create a hidden element with value 0 for the
 checkbox field?

No. The Checkbox element itself is smart enough to determine if the
value was set, and will return either the checkedValue or
uncheckedValue appropriately. 

These values are 1 and 0 by default, respectively, and you can set them
using the keys as specified above, or using their accessors
(setCheckedValue() and setUncheckedValue()). If no value is provided
for the checkbox, the value of the element will be the uncheckedValue;
if the value is the same as the checkedValue, that will be used.

 I just want to skip the:
  
 $model-checked_value = isset($values['my_checkbox']) ? $values['my_checkbox']
 : 0;

You should be able to skip that. :-)

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Google App Engine

2008-04-08 Thread Bradley Holt
Has anyone else heard about the new Google App
Enginehttp://code.google.com/appengine/docs/whatisgoogleappengine.html?
It currently only supports Python and the Django web application framework
but they say, other programming languages and runtime environment
configurations are being considered for future releases. Would anyone else
use this if Google added support for PHP and Zend Framework? If so, is there
anyone who has a contact within Google who can suggest this idea?

-- 
Bradley Holt
[EMAIL PROTECTED]


Re: [fw-general] ZF - APC tuning

2008-04-08 Thread Julien Pauli
Please take one thing on consideration : when using Windows to benchmark ,
turn your AV and all those kind of services OFF.

I ran an APC test as well on Windows ( for fun ), and with / without my
AntiVirus solution == I got twice more requests per second without it !!

I ran an ab with something like -n 80 -c 40 , (no DB, no session ), results
were poor, but that is an OS problem , Windows is not good at all to support
such PHP apps ( in fact it 'may' be, but a Windows developer platform cant
give good results).

With APC, I got about twice more requests served than without.
I noticed as well that APC should be fined configured. 1 or 2 more MB for
the memory segment can improve / degrade performance with a big factor.

Conclusion : do test on Windows if you want, but dont be surprised if you
have (very) poor performance results. There are several Windows services
that can knock the performance, not talking about the so bad File System.
(you should try to put your session data in memory such as memcache for
tests as well)

Cheers

Julien.P


2008/4/8 James Dempster [EMAIL PROTECTED]:

 I also get the same kind of results on Windows, installing APC for me
 actually slows down the requests. My PC is dual booted so I tested the setup
 in Ubuntu Linux which was so amazingly fast.

 *Tested on: *Intel Dual Core 2.8GHz, 4GB RAM etc etc
 *Tested using: *ab -n 2000 http://localhost/ (No concurancy cause we're
 testing response speed not server load)

 Website tested usues the following (but not limited to) ZF components MVC
 including Modules, Zend_Db + Db_Table etc (metadata cached in Zend_Cache
 sqlite), Zend_Config_Ini, Zend_Registry, Zend_Log, Zend_Session and all
 classes associated with them. Some custom models. So it's a fairly good
 senario. There's no extra caching other than the Zend_Db_Table metadata.

 Windows XP Pro SP2, Apache2 mod_php   = 450ms
 Windows XP Pro SP2, Apache2 mod_php + apc = 500ms
 Ubuntu Linux 7.10, Apache2 mod_php= 150ms
 Ubuntu Linux 7.10, Apache2 mod_php + apc  = 50ms

 This goes to show that ZF is not at fault here. I'm not even sure if
 Windows is at fault as I've heard great results about the new php fast cgi +
 iis 6.
 It just seems that Apache + PHP + Windows is a bad mix (for production).

 --
 /James


 On Mon, Apr 7, 2008 at 7:02 PM, Aldemar Bernal [EMAIL PROTECTED]
 wrote:

  Well,
 
  after a weekend of testing I found that:
 
  - fastcgi (using zend core fastcgi and other fastcgi) didn't give me
  better
  results than using the mod_php, I couldn't test using IIS since I don't
  have
  it =P
  - apc and xcache with fastcgi gave always trouble when benchmarking
  using ab
  from apache (php crashed all the times).
  - turning off apc.stat really boost my code, but I had to change some
  things
  (relative require_once to absolute require_once using dirname(__FILE__))
  - it seems that even if apc.stat is turned off, it access the disk
  (well,
  obviously it does the first time it caches the files) because ramdisk
  still
  faster than using my files on my harddrive, it should be faster only the
  first time, but it's faster all the times (I checked out apc.php and I
  found
  that apc was already caching the files).
  - concluding, I'll use here in my dev laptop mod_php + apc with
  apc.filters
  filtering and caching only ZF files (in a ramdisk) and my customers
  windows
  servers I'll use mod_php + apc with apc.stat always off (maybe including
  the
  ramdisk thingy).
 
  Times:
 
  - fastcgi ~700ms
  - fastcgi + accelerator (apc or xcache) ~ 600ms
  - mod_php alone ~ 500ms
  - mod_php + apc + files in ramdisk ~ 300ms
  - mod_php + apc + apc.stat = 0 ~ 300ms
  - mod_php + apc + apc.stat = 0 + files in ramdisk ~ 110ms
  - mod_php + apc + apc.stat = 0 + apc.filtering (only caching ZF) + files
  in
  ramdisk (only ZF) ~ 280ms
 
  Again my setup is:
 
  - apache 2.2 (mod_php)
  - php 5.2.5
  - apc 3.0.17-dev
  - zf 1.5.1
  - windows xp home
 
 
  Still sucks, doesn't it :P
 
  btw, I couldn't any documentation about apc caching classes (maybe you
  were
  talking about user cache), the command I use to benchmark was:
 
  ab -c 5 -n 20 http://localhost/x/ (before running this command I
  opened
  twice the page in order that apc cached w/o fragmenting the files)
 
  The page I used did connect to a DB but doing nothing but a 'SET NAMES
  utf8'
  query, and disabling it didn't show any difference.
 
 
  Aldemar
 
  - Original Message - From: Matthew Weier O'Phinney 
  [EMAIL PROTECTED]
  To: fw-general@lists.zend.com
  Sent: Saturday, April 05, 2008 6:10 PM
  Subject: Re: [fw-general] ZF - APC tuning
 
 
 
   -- Aldemar Bernal [EMAIL PROTECTED] wrote
   (on Saturday, 05 April 2008, 02:40 PM -0500):
  
I've been trying to make my app perform better, every request takes
(according
ab: apache stress tool) ~510ms, which is a lot!, over half second in
every
request?, so I installed and enabled APC but surprisly it performed

Re: [fw-general] Google App Engine

2008-04-08 Thread Jake McGraw
Technically, support for Zend Framework isn't required, they only need
to support PHP to get it working. I sat through the demo, looks
promising as an alternative to Amazon storage services.

- jake

On Tue, Apr 8, 2008 at 10:47 AM, Bradley Holt
[EMAIL PROTECTED] wrote:
 Has anyone else heard about the new Google App Engine? It currently only
 supports Python and the Django web application framework but they say,
 other programming languages and runtime environment configurations are
 being considered for future releases. Would anyone else use this if Google
 added support for PHP and Zend Framework? If so, is there anyone who has a
 contact within Google who can suggest this idea?

 --
 Bradley Holt
 [EMAIL PROTECTED]




Re: [fw-general] Google App Engine

2008-04-08 Thread Bradley Holt
Sure, support for PHP itself would be great and would be all that's *
technically* required. I guess I was really suggesting two things. First,
that Google App Engine supports PHP and uses Zend Framework as the default
web application framework. Second, components are added to Zend Framework to
support the datastore, Google Accounts, URL fetch and email services in
Google App Engine. It seems like Zend Framework would be a natural fit for
the Google App Engine.

On Tue, Apr 8, 2008 at 10:57 AM, Jake McGraw [EMAIL PROTECTED] wrote:

 Technically, support for Zend Framework isn't required, they only need
 to support PHP to get it working. I sat through the demo, looks
 promising as an alternative to Amazon storage services.

 - jake

 On Tue, Apr 8, 2008 at 10:47 AM, Bradley Holt
 [EMAIL PROTECTED] wrote:
  Has anyone else heard about the new Google App Engine? It currently only
  supports Python and the Django web application framework but they say,
  other programming languages and runtime environment configurations are
  being considered for future releases. Would anyone else use this if
 Google
  added support for PHP and Zend Framework? If so, is there anyone who has
 a
  contact within Google who can suggest this idea?
 
  --
  Bradley Holt
  [EMAIL PROTECTED]
 
 




-- 
Bradley Holt
[EMAIL PROTECTED]


Re: [fw-general] Our new Zend Framework Architect

2008-04-08 Thread Joó Ádám
Cangratulations, Matthew!


Á


Re: [fw-general] Our new Zend Framework Architect

2008-04-08 Thread Łukasz Wojciechowski
Congrats, well deserved!

-- 
Łukasz Wojciechowski


Re: [fw-general] ZF - APC tuning

2008-04-08 Thread Pete Spicer

Hi there,
As a developer who builds and tests apps on Windows/Apache/MySQL/PHP 
stack and run release versions on a Linux server optimised for web 
serving, I can confirm the following from my experience...


I built a project which functions like RinkWorks' Dialectizer - 
www.thevoicesofmany.com - go fetch a webpage, run through all of the 
non-tag text and apply one or more code-defined rules to it. Some of the 
rulesets had massive lists of regular expressions to be applied, others 
had a few lines of code. Due to the size of the library of these and to 
prevent memory usage being  4MB (limit of the hosting plan I used to 
have), these were dynamically loaded, after the requested module had 
been verified against a DB I had. (There were other things in the MySQL 
DB I had, and the host wasn't supporting anything like SQLite)


What I found though, was that against both the original hosting plan and 
the current shared host I use, Windows performance is *still* 
consistently slower, anything from 20% to 300% slower with the same 
input data. Even when the input source was local on all instances, 
Windows was still consistently the slowest. This is true for both Win98 
and WinXP, with all unrelated services turned off, even when my host PC 
is considerably more powerful than the available shared resources I 
worked with. (A 2.2GHz 4-core processor handling a couple of thousand 
websites isn't going to be able to devote too much resource to a single 
site, certainly no more than a AMD 4200+ 2-core running as my home machine)


After much benchmarking and testing, I found that the core 
processing/regexp handling modules are comparable, and that by far the 
biggest hog is file access. So if you have a lot of require's or 
include's, or use a lot, you'll find it will benchmark much slower in 
Windows. I should add that neither the current server nor my machine has 
any kind of caching going on.


Another example, I've been working with Zend_Search_Lucene a lot lately. 
Indexing several hundred documents at a time is considerably quicker on 
a shared Linux resource than it is on my PC. Again, it seems to be down 
to the limitations of the filesystem and bottlenecks in the file I/O 
subsystems in Windows.


Sorry for waffling,
Pete
Please take one thing on consideration : when using Windows to 
benchmark , turn your AV and all those kind of services OFF.


I ran an APC test as well on Windows ( for fun ), and with / without 
my AntiVirus solution == I got twice more requests per second without 
it !!


I ran an ab with something like -n 80 -c 40 , (no DB, no session ), 
results were poor, but that is an OS problem , Windows is not good at 
all to support such PHP apps ( in fact it 'may' be, but a Windows 
developer platform cant give good results).


With APC, I got about twice more requests served than without.
I noticed as well that APC should be fined configured. 1 or 2 more MB 
for the memory segment can improve / degrade performance with a big 
factor.


Conclusion : do test on Windows if you want, but dont be surprised if 
you have (very) poor performance results. There are several Windows 
services that can knock the performance, not talking about the so bad 
File System.
(you should try to put your session data in memory such as memcache 
for tests as well)


Cheers

Julien.P


2008/4/8 James Dempster [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]:

I also get the same kind of results on Windows, installing APC for
me actually slows down the requests. My PC is dual booted so I
tested the setup in Ubuntu Linux which was so amazingly fast.

*Tested on: *Intel Dual Core 2.8GHz, 4GB RAM etc etc
*Tested using: *ab -n 2000 http://localhost/ (No concurancy cause
we're testing response speed not server load)

Website tested usues the following (but not limited to) ZF
components MVC including Modules, Zend_Db + Db_Table etc (metadata
cached in Zend_Cache sqlite), Zend_Config_Ini, Zend_Registry,
Zend_Log, Zend_Session and all classes associated with them. Some
custom models. So it's a fairly good senario. There's no extra
caching other than the Zend_Db_Table metadata.

Windows XP Pro SP2, Apache2 mod_php   = 450ms
Windows XP Pro SP2, Apache2 mod_php + apc = 500ms
Ubuntu Linux 7.10, Apache2 mod_php= 150ms
Ubuntu Linux 7.10, Apache2 mod_php + apc  = 50ms

This goes to show that ZF is not at fault here. I'm not even sure
if Windows is at fault as I've heard great results about the new
php fast cgi + iis 6.
It just seems that Apache + PHP + Windows is a bad mix (for
production).

--
/James


On Mon, Apr 7, 2008 at 7:02 PM, Aldemar Bernal
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

Well,

after a weekend of testing I found that:

- fastcgi (using zend core fastcgi and other fastcgi) didn't
give me better
results than using the mod_php, I couldn't test using 

RE: [fw-general] Google App Engine

2008-04-08 Thread Wil Sinclair
As luck would have it, I have contacts at Google. The guys behind our GData 
component. ;) Generally they’ve been really great at advocating ZF within the 
company. I’ll follow up with Ryan to see if there is a way ZF might help with 
the PHP support.

 

,Wil

 

From: Bradley Holt [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 08, 2008 7:48 AM
To: Zend Framework
Subject: [fw-general] Google App Engine

 

Has anyone else heard about the new Google App Engine 
http://code.google.com/appengine/docs/whatisgoogleappengine.html ? It 
currently only supports Python and the Django web application framework but 
they say, other programming languages and runtime environment configurations 
are being considered for future releases. Would anyone else use this if Google 
added support for PHP and Zend Framework? If so, is there anyone who has a 
contact within Google who can suggest this idea?

-- 
Bradley Holt
[EMAIL PROTECTED]



Re: [fw-general] Google App Engine

2008-04-08 Thread Bradley Holt
Wil,

That's great to hear, thanks!

On Tue, Apr 8, 2008 at 1:08 PM, Wil Sinclair [EMAIL PROTECTED] wrote:

  As luck would have it, I have contacts at Google. The guys behind our
 GData component. ;) Generally they've been really great at advocating ZF
 within the company. I'll follow up with Ryan to see if there is a way ZF
 might help with the PHP support.



 ,Wil



 *From:* Bradley Holt [mailto:[EMAIL PROTECTED]
 *Sent:* Tuesday, April 08, 2008 7:48 AM
 *To:* Zend Framework
 *Subject:* [fw-general] Google App Engine



 Has anyone else heard about the new Google App 
 Enginehttp://code.google.com/appengine/docs/whatisgoogleappengine.html?
 It currently only supports Python and the Django web application framework
 but they say, other programming languages and runtime environment
 configurations are being considered for future releases. Would anyone else
 use this if Google added support for PHP and Zend Framework? If so, is there
 anyone who has a contact within Google who can suggest this idea?

 --
 Bradley Holt
 [EMAIL PROTECTED]




-- 
Bradley Holt
[EMAIL PROTECTED]


RE: [fw-general] NEW PROPOSAL PROCESS!!!

2008-04-08 Thread Wil Sinclair
 Please keep in mind that this is a major overall of the proposal
process

Um, yeah, that should read 'major *overhaul* of the proposal process'.
:D Thanks to David Rogers for pointing that one out.

,Wil


FW: [fw-general] Zend_Translate doesn't cache when addTranslation is called

2008-04-08 Thread Robert Castley

 
No problems!  Glad I could be of help!  I don't know why but my posts don't
seem to be appearing on Nabble.com.

- Robert


-Original Message-
From: Rob L [mailto:[EMAIL PROTECTED]
Sent: 08 April 2008 14:48
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Zend_Translate doesn't cache when addTranslation
is called


UPDATE:

After a message from Robert Castley (thanks), I tried directory scan instead
of filename scan. It seemed to work. Here is an example of what works and
what doesn't work for me:

-
WORKS:
($dir contains folders zh_CN/ zh_TW/ en/ and de/ with translation files
inside)

$translate = new Zend_Translate('my_custom_adapter', $dir, null,
array('scan' = Zend_Translate::LOCALE_DIRECTORY));
print_r($translate-getList());

prints: Array ( [en] = en [zh_TW] = zh_TW [zh_CN] = zh_CN [de] = de )

-
DOESN'T WORK:
($dir contains files zh_CN.txt zh_TW.txt en.txt and de.txt)

$translate = new Zend_Translate('my_custom_adapter', $dir, null,
array('scan' = Zend_Translate::LOCALE_FILENAME));
print_r($translate-getList());

prints: Array ( [en] = en [de] = de [zh] = zh )


I will continue with DIRECTORY, but I would prefer to use FILENAME, but what
am I doing wrong that it combines zh_CN and zh_TW into a single locale?

Rob
--
View this message in context:
http://www.nabble.com/Zend_Translate-doesn%27t-cache-when-addTranslation-is-
called-tp16539888p16558540.html
Sent from the Zend Framework mailing list archive at Nabble.com.



This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.




This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


[fw-general] Best way to load Zend_Form_Element_* classes

2008-04-08 Thread Mark Steudel
Hi All,

 

I'm just using components of the Zend Framework in my application, and one
of those is Zend_Form which in my header file I'm loading like:

 

Zend_Loader::loadClass('Zend_Form');

 

But when I go to instantiate a text element like:

 

$usrename = new Zend_Form_Element_Text( 'username');

 

I got the Class 'Zend_Form_Element_Text' not found error. So I tried loading
the Zend_Form_Element_Text class like so:

 

Zend_Loader::loadClass('Zend_Form_Element_Text');

 

My question is do I really need to load each element, I'm figuring there
must be a cleaner way to do load each form element class.

 

Thanks, Mark



Re: [fw-general] Best way to load Zend_Form_Element_* classes

2008-04-08 Thread staar2



Mark Steudel-3 wrote:
 
 Hi All,
 
  
 
 I'm just using components of the Zend Framework in my application, and one
 of those is Zend_Form which in my header file I'm loading like:
 
  
 
 Zend_Loader::loadClass('Zend_Form');
 
  
 
 But when I go to instantiate a text element like:
 
  
 
 $usrename = new Zend_Form_Element_Text( 'username');
 
  
 
 I got the Class 'Zend_Form_Element_Text' not found error. So I tried
 loading
 the Zend_Form_Element_Text class like so:
 
  
 
 Zend_Loader::loadClass('Zend_Form_Element_Text');
 
  
 
 My question is do I really need to load each element, I'm figuring there
 must be a cleaner way to do load each form element class.
 
  
 
 Thanks, Mark
 
 
 

i would write in the index.php file top of the code
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

Then you dont need to load each class seperatly
-- 
View this message in context: 
http://www.nabble.com/Best-way-to-load-Zend_Form_Element_*-classes-tp16571099p16571332.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] The same code can run on Windows but not Linux

2008-04-08 Thread xing93111

I develop a bunch of code using ZF under XP. On Linux machine, the code
cannot find the requested controller and action, but on Windows XP, it can.
It seems weired.

Thanks
-- 
View this message in context: 
http://www.nabble.com/The-same-code-can-run-on-Windows-but-not-Linux-tp16571585p16571585.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Tutorial/Example: Zend_Log plugin using Database and Filter

2008-04-08 Thread Robert Castley
I have set up a tutorial/example of using Zend_Log writing to a database
with a filter controlled from a configuration file:
 
http://framework.zend.com/wiki/x/tKo
 
 
- Robert



This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.


Re: [fw-general] The same code can run on Windows but not Linux

2008-04-08 Thread Bradley Holt
Linux is case-sensitive and Windows is not. This is the most likely culprit.
Check the case of all your controllers and actions.

On Tue, Apr 8, 2008 at 3:52 PM, xing93111 [EMAIL PROTECTED] wrote:


 I develop a bunch of code using ZF under XP. On Linux machine, the code
 cannot find the requested controller and action, but on Windows XP, it
 can.
 It seems weired.

 Thanks
 --
 View this message in context:
 http://www.nabble.com/The-same-code-can-run-on-Windows-but-not-Linux-tp16571585p16571585.html
 Sent from the Zend Framework mailing list archive at Nabble.com.




-- 
Bradley Holt
[EMAIL PROTECTED]


Re: [fw-general] The same code can run on Windows but not Linux

2008-04-08 Thread oetting

Hi,

Remember that linux is case sensitive. So make sure you use upper and lower
case in filenames as dictated by the documentation.

Jacob


xing93111 wrote:
 
 I develop a bunch of code using ZF under XP. On Linux machine, the code
 cannot find the requested controller and action, but on Windows XP, it
 can. It seems weired.
 
 Thanks
 

-- 
View this message in context: 
http://www.nabble.com/The-same-code-can-run-on-Windows-but-not-Linux-tp16571585p16571862.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Registry question

2008-04-08 Thread Tobias Gies
You obviously come from a Java background. No, they can't. In PHP, every
request is a completely autonomous environment, and no data can be shared by
many requests (well, except if you use sessions - but that's not really what
you want. Sessions are basically meant to save user credentials and similar
data, no complex objects.

Best Regards,
Tobias

On Mon, Apr 7, 2008 at 6:22 PM, xing93111 [EMAIL PROTECTED] wrote:

 
  Since Zend_Registry can store any objects, can multiple different
  sessions
  share the same object through Zend_Registry?
  --
  View this message in context:
  http://www.nabble.com/Zend_Registry-question-tp16537537p16537537.html
  Sent from the Zend Framework mailing list archive at Nabble.com.
 
 



Re: [fw-general] The same code can run on Windows but not Linux

2008-04-08 Thread Bill
Thanks Bradley. The question is that I only use controllers and actions in
my code, for example:

form action=?php echo $this-url(array('controller'='user',
'action'='login')); ? method=post

Are names of controllers and names of actions case-sensitive?

Thank you very much


On Tue, Apr 8, 2008 at 1:57 PM, Bradley Holt [EMAIL PROTECTED]
wrote:

 Linux is case-sensitive and Windows is not. This is the most likely
 culprit. Check the case of all your controllers and actions.

 On Tue, Apr 8, 2008 at 3:52 PM, xing93111 [EMAIL PROTECTED] wrote:

 
  I develop a bunch of code using ZF under XP. On Linux machine, the code
  cannot find the requested controller and action, but on Windows XP, it
  can.
  It seems weired.
 
  Thanks
  --
  View this message in context:
  http://www.nabble.com/The-same-code-can-run-on-Windows-but-not-Linux-tp16571585p16571585.html
  Sent from the Zend Framework mailing list archive at Nabble.com.
 
 


 --
 Bradley Holt
 [EMAIL PROTECTED]




[fw-general] Zend_Form feature request - nested display groups

2008-04-08 Thread Katulus

I use display groups to create containers with id attributes to manipulate
them in javascript and I would really appreciate ability to nest display
groups.

I tried something like this (elemX is any form element):
$form-addDisplayGroup(array('elem1','elem2'), 'group1',
array('id'='group1'));
$form-addDisplayGroup(array('group1','elem3'), 'group2',
array('id'='group2'));

and want result like:
group2
  group1
elem1elem2
  /group1
  elem3
/group2

but I just get error No valid elements specified for display group.

Is there a way to achieve this effect with current Zend_Form? I know that I
can simulate this by using nested sub-forms, but sub-forms are handled
differently and working with them in this way is quite uncomfortable,
because for example you have to set decorators for their elements
individually.
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-feature-request---nested-display-groups-tp16572736p16572736.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Our new Zend Framework Architect

2008-04-08 Thread David Mintz
What, for this lazy bum?


-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] The same code can run on Windows but not Linux

2008-04-08 Thread Bradley Holt
Yes, my understanding is that controller and action names are
case-sensitive. In your example, you'll want to use the following names:

User::login()

That is, the class name should by User in the file User.php and the
function name for the action should be login.

On Tue, Apr 8, 2008 at 4:12 PM, Bill [EMAIL PROTECTED] wrote:

 Thanks Bradley. The question is that I only use controllers and actions in
 my code, for example:

 form action=?php echo $this-url(array('controller'='user',
 'action'='login')); ? method=post

 Are names of controllers and names of actions case-sensitive?

 Thank you very much



 On Tue, Apr 8, 2008 at 1:57 PM, Bradley Holt [EMAIL PROTECTED]
 wrote:

  Linux is case-sensitive and Windows is not. This is the most likely
  culprit. Check the case of all your controllers and actions.
 
  On Tue, Apr 8, 2008 at 3:52 PM, xing93111 [EMAIL PROTECTED] wrote:
 
  
   I develop a bunch of code using ZF under XP. On Linux machine, the
   code
   cannot find the requested controller and action, but on Windows XP, it
   can.
   It seems weired.
  
   Thanks
   --
   View this message in context:
   http://www.nabble.com/The-same-code-can-run-on-Windows-but-not-Linux-tp16571585p16571585.html
   Sent from the Zend Framework mailing list archive at Nabble.com.
  
  
 
 
  --
  Bradley Holt
  [EMAIL PROTECTED]
 
 



-- 
Bradley Holt
[EMAIL PROTECTED]


Re: [fw-general] The same code can run on Windows but not Linux

2008-04-08 Thread Bradley Holt
Bill,

Oops, you are correct - my previous email was incorrect (must be too tired).
You should have:

UserController::loginAction()

and the UserController class should be in the UserController.php file.

Not sure why that doesn't work correctly for you. I don't have a copy of
Zend Framework in Action so can't see the example code you are looking at.
When you say, the code cannot find the requested controller and action is
it the url view helper that's not working or is it giving the right URL but
Zend Framework can't find the controller and action after submitting the
form?

On Tue, Apr 8, 2008 at 5:14 PM, Bill [EMAIL PROTECTED] wrote:

 Thanks for your answer. As my understanding, the class name should like
 UserController in the file UserController.php. The function name should
 be loginAction. I just tried to run source code (chapter 3) of Zend
 Framework in Action. The same thing happened. It works on Windows but not
 Linux.

 Bill


 On Tue, Apr 8, 2008 at 2:50 PM, Bradley Holt [EMAIL PROTECTED]
 wrote:

  Yes, my understanding is that controller and action names are
  case-sensitive. In your example, you'll want to use the following names:
 
  User::login()
 
  That is, the class name should by User in the file User.php and the
  function name for the action should be login.
 
 
  On Tue, Apr 8, 2008 at 4:12 PM, Bill [EMAIL PROTECTED] wrote:
 
   Thanks Bradley. The question is that I only use controllers and
   actions in my code, for example:
  
   form action=?php echo $this-url(array('controller'='user',
   'action'='login')); ? method=post
  
   Are names of controllers and names of actions case-sensitive?
  
   Thank you very much
  
  
  
   On Tue, Apr 8, 2008 at 1:57 PM, Bradley Holt 
   [EMAIL PROTECTED] wrote:
  
Linux is case-sensitive and Windows is not. This is the most likely
culprit. Check the case of all your controllers and actions.
   
On Tue, Apr 8, 2008 at 3:52 PM, xing93111 [EMAIL PROTECTED]
wrote:
   

 I develop a bunch of code using ZF under XP. On Linux machine, the
 code
 cannot find the requested controller and action, but on Windows
 XP, it can.
 It seems weired.

 Thanks
 --
 View this message in context:
 http://www.nabble.com/The-same-code-can-run-on-Windows-but-not-Linux-tp16571585p16571585.html
 Sent from the Zend Framework mailing list archive at Nabble.com.


   
   
--
Bradley Holt
[EMAIL PROTECTED]
   
   
  
 
 
  --
  Bradley Holt
  [EMAIL PROTECTED]
 
 



-- 
Bradley Holt
[EMAIL PROTECTED]


RE: [fw-general] Best way to load Zend_Form_Element_* classes

2008-04-08 Thread Mark Steudel
Thanks all, that's exactly what I was looking for!

 

Mark

 

  _  

From: staar2 [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 08, 2008 12:37 PM
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Best way to load Zend_Form_Element_* classes

 

Mark Steudel-3 wrote:

Hi All, I'm just using components of the Zend Framework in my application,
and one of those is Zend_Form which in my header file I'm loading like:
Zend_Loader::loadClass('Zend_Form'); But when I go to instantiate a text
element like: $usrename = new Zend_Form_Element_Text( 'username'); I got the
Class 'Zend_Form_Element_Text' not found error. So I tried loading the
Zend_Form_Element_Text class like so:
Zend_Loader::loadClass('Zend_Form_Element_Text'); My question is do I really
need to load each element, I'm figuring there must be a cleaner way to do
load each form element class. Thanks, Mark 

i would write in the index.php file top of the code require_once
'Zend/Loader.php'; Zend_Loader::registerAutoload(); Then you dont need to
load each class seperatly 

  _  

View this message in context: Re:
http://www.nabble.com/Best-way-to-load-Zend_Form_Element_*-classes-tp165710
99p16571332.html  Best way to load Zend_Form_Element_* classes
Sent from the Zend http://www.nabble.com/Zend-Framework-f15440.html
Framework mailing list archive at Nabble.com.



[fw-general] validating a form

2008-04-08 Thread Mark Steudel
I'm having a little bit of a problem getting the hang of validation, I think
I'm still thinking in Pear QuickForm mindset.

 

I have the following code:

 

// create form code

 

if( $admin-form-isValid( $_POST ) ) {

echo $admin-savePrimarySource( $admin-form-getValues() );

}

else {

echo $admin-form-render();

}

 

When I first load this page, I get the validation errors. My thought was
that it would detect whether or not the form has been POSTed or not . but
I'm guessing it's just looking at what's in $_POST (which is nothing) and
says hey your required fields are missing.  What's a good way to validate a
whole form  in this fashion?

 

Thanks, Mark



Re: [fw-general] Best way to load Zend_Form_Element_* classes

2008-04-08 Thread Matthew Weier O'Phinney
-- Mark Steudel [EMAIL PROTECTED] wrote
(on Tuesday, 08 April 2008, 12:17 PM -0700):
 I’m just using components of the Zend Framework in my application, and one of
 those is Zend_Form which in my header file I’m loading like:
 
 Zend_Loader::loadClass('Zend_Form');
 
 But when I go to instantiate a text element like:
 
 $usrename = new Zend_Form_Element_Text( ‘username’);
 
 I got the Class 'Zend_Form_Element_Text' not found error. So I tried loading
 the Zend_Form_Element_Text class like so:
 
 Zend_Loader::loadClass('Zend_Form_Element_Text');
 
 My question is do I really need to load each element, I’m figuring there must
 be a cleaner way to do load each form element class.

Use Zend_Form as a factory for creating elements:

$username = $form-createElement('text', 'username');

// or, if you want it attached to the form immediately:

$form-addElement('text', 'username');
$username = $form-username;

This is actually the preferred way to create elements, as it allows you
to set plugin paths for your elements in your form object *once*, and
those will then be used for all elements created via your form object.

Finally, you might want to use autoloading if you don't want to use
Zend_Loader::loadClass() or require_once throughout your code. Add this
to the top of your bootstrap or script:

require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Zend_Form feature request - nested display groups

2008-04-08 Thread Matthew Weier O'Phinney
-- Katulus [EMAIL PROTECTED] wrote
(on Tuesday, 08 April 2008, 01:44 PM -0700):
 I use display groups to create containers with id attributes to
 manipulate them in javascript and I would really appreciate ability to
 nest display groups.
 
 I tried something like this (elemX is any form element):
 $form-addDisplayGroup(array('elem1','elem2'), 'group1',
 array('id'='group1'));
 $form-addDisplayGroup(array('group1','elem3'), 'group2',
 array('id'='group2'));
 
 and want result like:
 group2
   group1
 elem1elem2
   /group1
   elem3
 /group2
 
 but I just get error No valid elements specified for display group.
 
 Is there a way to achieve this effect with current Zend_Form? I know
 that I can simulate this by using nested sub-forms, but sub-forms are
 handled differently and working with them in this way is quite
 uncomfortable, because for example you have to set decorators for
 their elements individually.

The short answer is: if you want nesting, use the object that allows for
it: a sub form. 

Sub forms are just like regular forms, except for the class name, the
default decorators, and one or two items of metadata. I have no idea
what you mean by you have to set decorators for their elements
individually; you can call setElementDecorators() just as easily on a
sub form as on a regular form.

Display groups are intended simply for grouping *elements* in a form --
not sub forms or other groups. The grouping is for cosmetic purposes
only -- hence the term 'display'. The elements in them actually belong
to the parent form, so having them namespaced differently is outside
their scope -- but well within the scope of sub forms (which are
intended for this kind of logical grouping).

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] validating a form

2008-04-08 Thread Matthew Weier O'Phinney
-- Mark Steudel [EMAIL PROTECTED] wrote
(on Tuesday, 08 April 2008, 03:21 PM -0700):
 I’m having a little bit of a problem getting the hang of validation, I think
 I’m still thinking in Pear QuickForm mindset.
 
 I have the following code:
 
 // create form code
 if( $admin-form-isValid( $_POST ) ) {
 echo $admin-savePrimarySource( $admin-form-getValues() );
 } else {
 echo $admin-form-render();
 }
 
 When I first load this page, I get the validation errors. My thought
 was that it would detect whether or not the form has been POSTed or
 not … but I’m guessing it’s just looking at what’s in $_POST (which is
 nothing) and says hey your required fields are missing.  What’s a good
 way to validate a whole form in this fashion?

Zend_Form is de-coupled from both the MVC and HTTP; the idea is that you
should be able to use it for a variety of purposes, some of which may
have nothing to do with either of those two.

If using the ZF MVC, check to see if the request is a POST:

if ($this-getRequest()-isPost()) {
if ($form-isValid($this-getRequest()-getPost())) {
$values = $form-getValues();
// usually you'll do something with the values and then
// redirect after this...
}
}

$this-view-form = $form;

If you're not using the ZF MVC, check to see what the request method
was:

$method = $_SERVER['REQUEST_METHOD']
if ($method == 'POST') {
// validate now
}

It's an extra step, but it ensures that you're explicitly checking the
source of your form input.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Our new Zend Framework Architect

2008-04-08 Thread Matthew Weier O'Phinney
Thanks, everyone, for the congratulations and pats on the back. 

I love working on ZF, and interacting with so many of you -- via the
lists, #zftalk, blogs, user groups, and conferences. This has been, and
continues to be, and incredibly rewarding project, and I look forward to
working in my new role... which, in a lot of ways, resembles what I've
been striving to do all along. The fact that I get recognized for doing
what I love to do anyways is incredibly humbling and gratifying.

Now, back to your editors and IDEs everyone -- there's code to be
written! Don't forget to write your tests!


-- Wil Sinclair [EMAIL PROTECTED] wrote
(on Monday, 07 April 2008, 01:35 PM -0700):
  Matthew Weier O'Phinney
  Software Architect   | [EMAIL PROTECTED]
  Zend - The PHP Company   | http://www.zend.com/
 
 Yikes! I knew there was something I forgot to do on Friday. Without
 further ado, it's my immense pleasure to announce that Matthew has been
 promoted to Software Architect at Zend. I'm sure I don't have to explain
 what he's done to deserve this here. ;)
 He'll still maintain his existing components and develop new components.
 But he'll also be heading up efforts that involve cross-cutting concerns
 with all components. The general consistency of design and quality
 across all components should benefit greatly from his attention.
 In addition, he will be heading up the initiative to define exactly what
 we'll be doing for the 2.0 release. This is of course a critical role as
 we make the right tradeoffs between improvements and backwards
 compatibility.
 Congrats Matthew!

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Creating a Modular Dir Structure

2008-04-08 Thread photo312

I have 4 different user groups and each user group will get different
functionality and looks. So I have decided to divide it up into modules with
separate front controllers each. 

Can you please tell me if this modular directory structure would work well
in Zend Framework:

library/
---Zend/
config/
public/
---index.php
application/
---default/
-controllers/
-models/
-views/
---scripts/
---helpers/
---filters/
client/
--controllers/
--models/
--views
---...just like above

-- 
View this message in context: 
http://www.nabble.com/Creating-a-Modular-Dir-Structure-tp16578887p16578887.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Creating a Modular Dir Structure

2008-04-08 Thread photo312

I would like to turn on controllers dynamically depending on the user
logged in...so if the user type logged-in is client than it would load:

$controller-setControllerDirectory(array(
  'default' = '../application/client/controllers'  
));

this way I can have my modules in different directories and only use the
controllers that are residing in the directory that suits the user type.





photo312 wrote:
 
 I have 4 different user groups and each user group will get different
 functionality and looks. So I have decided to divide it up into modules
 with separate front controllers each. 
 
 Can you please tell me if this modular directory structure would work well
 in Zend Framework:
 
 library/
 ---Zend/
 config/
 public/
 ---index.php
 application/
 ---default/
 -controllers/
 -models/
 -views/
 ---scripts/
 ---helpers/
 ---filters/
 client/
 --controllers/
 --models/
 --views
 ---...just like above
 
 

-- 
View this message in context: 
http://www.nabble.com/Creating-a-Modular-Dir-Structure-tp16578887p16579738.html
Sent from the Zend Framework mailing list archive at Nabble.com.