RE: [fw-general] Confused about decorators

2008-12-18 Thread vibhor singh
Thanks Mon! I'll try it out and see what happens.

 

-Vibhor

 

  _  

From: Mon Zafra [mailto:mon...@gmail.com] 
Sent: Thursday, December 18, 2008 4:23 PM
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Confused about decorators

 

You should put the My directory at the same level as Zend:

library
 Zend
 Controller
 Form, View, etc.
 My
 Decorator
 Composite.php
 your other library classes, e.g. helpers, plugins, forms


   -- Mon



On Thu, Dec 18, 2008 at 2:57 PM, vibhor singh  wrote:

Just to add I am getting the following error:

Message: Plugin by name 'Composite' was not found in the registry; used
paths: My_Decorator_: My/Decorator/ Zend_Form_Decorator_:
Zend/Form/Decorator/:Zend/Form/Decorator/

 

  _  

From: vibhor singh [mailto:vib...@pivisions.com] 
Sent: Thursday, December 18, 2008 12:00 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Confused about decorators

 

Hi all,

 

I have just begun learning ZF. I have come across Decorators and am finding
a bit difficult to grasp it. My question is where I need to put my new
decorator class in the project folder. It looks like the following:

 

vQuick

-application

-controllers

-models

-forms

-views

-public

-library

-Zend

 

Following the Zend_Decorator example
[http://www.zendframework.com/manual/en/zend.form.decorators.html] I have
put the new file in :

 

-library

-Zend

-Form

  -Decorator

-My

  -Decorator

-Composite.php

 

Am I doing something wrong here? Can someone please help me with this.
Thanks

 

Vibhor

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.9.19/1854 - Release Date: 12/17/2008
7:21 PM

 

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.176 / Virus Database: 270.9.19/1856 - Release Date: 12/18/2008
8:06 PM



[fw-general] Action on button problem

2008-12-18 Thread Aniketto

Hi all,
I am developing an application.  In this application I have a search
facility for students.
The screen has a search button which if preesed shows result in tabular
format.Also if search is successful two buttons download and detail are
displayed. If download button is presses a csv file ic created having
student data. If we selectt a rdio button in front of student name and press
detail button it opens a new page 'detail.phtml'. This page displays detail
data of student and has got a edit button.
  Now on first form if detail burron is pressed I get a new form
studentdetail and set action as detail. Code as below
$isSet = $form->detail->getValue();
if (isset($isSet)) {
$this->getFrontController()->setParam('noViewRenderer', TRUE);

$form = $this->getForm(studentdetail');
$form->setAction('student/detail');
$this->view->form = $form;
if (!$form->isValid($_POST)) {
 $this->setErrorMessage($form);
 return;
}
$res = $this->getResponse();
$res->appendBody($this->view->render('student/detail.phtml'));  
}

In detail action I display detail data of student. Also I set new view and
new form.
I want that to save the edited data if user pressses edit button
$view = $this->getView();
$form = $this->getForm(studentdetail');

$form->setAction('student/detail');
$isSet = $form->edit->getValue();
if (isset($isSet)) {
//save edited data

}

Now if I try press edit  button action displayed is student/student/detail.
And page not found error is displayed. So can somebody tel me how to solve
this problem.


-- 
View this message in context: 
http://www.nabble.com/Action-on-button-problem-tp21083875p21083875.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Short Tags vs. Long Tags performance question

2008-12-18 Thread Matthew Weier O'Phinney
-- Kevin Schroeder  wrote
(on Thursday, 18 December 2008, 01:51 PM -0800):
> Just make sure you don't have any XML processing instructions embedded
> anywhere.

Or, better yet, use one of the various XML extensions to generate your
XML for you. ;)

(Seriously. If you're templating your XML, you're asking for encoding
and entity issues.)

> -Original Message-
> From: Matthew Weier O'Phinney [mailto:matt...@zend.com] 
> Sent: Thursday, December 18, 2008 8:41 AM
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Short Tags vs. Long Tags performance question
> 
> -- Robert Castley  wrote
> (on Thursday, 18 December 2008, 09:21 AM -):
> > If you enable your ZF application to use short tags is there a
> benefit/increase
> > in performance over littering your view scripts with echo this and
> echo that?
> 
> They operate exactly the same.

-- 
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.com/


RE: [fw-general] Short Tags vs. Long Tags performance question

2008-12-18 Thread Kevin Schroeder
Just make sure you don't have any XML processing instructions embedded
anywhere.

Kevin

-Original Message-
From: Matthew Weier O'Phinney [mailto:matt...@zend.com] 
Sent: Thursday, December 18, 2008 8:41 AM
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Short Tags vs. Long Tags performance question

-- Robert Castley  wrote
(on Thursday, 18 December 2008, 09:21 AM -):
> If you enable your ZF application to use short tags is there a
benefit/increase
> in performance over littering your view scripts with echo this and
echo that?

They operate exactly the same.

-- 
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Caching Enabled flag for backend

2008-12-18 Thread Matthew Weier O'Phinney
-- Dan Wilson  wrote
(on Thursday, 18 December 2008, 01:21 PM -0700):
> I've added Zend_Cache to my project, but have multiple environments.
> I'm using memcache as my backend, but only in one environment.  In the
> other environment, I don't want caching enabled at all.  When I try to
> disable caching however, it still tries to instantiate the Memcache
> object.  I don't have memcache on that machine and so it barfs on me.
> 
> Why doesn't the caching enabled flag prevent this?  It looks to me
> like we might need an additional caching enabled flag for the backend
> as well as the frontend.
> 
> Any thoughts?

I'm not sure why it works this way, actually; hopefully Fabien will be
able to fill us in on that.

As for using multiple environments... I made some changes to Zend_Cache
for either 1.7.0 or 1.7.1 that fixes an issue that existed when using
configuration -- basically, prior to the fix, you couldn't have specify
different frontend/backend combinations in your config file because the
differing options between them would cause exceptions to be raised. The
fix now ignores options that don't exist for the given adapter.

This allows you to do something like the following:

[production]
cache.frontendName = "Core"
cache.frontendOptions.caching = false
cache.frontendOptions.lifetime = 900
cache.frontendOptions.automatic_serialization = true
cache.frontendOptions.automatic_cleaning_factor = 20
cache.backendName = "File"
cache.backendOptions.cache_dir = APPLICATION_PATH "/../data/cache/files"
cache.backendOptions.read_control = false
cache.backendOptions.file_name_prefix = "cache"

[development : production]
cache.frontendOptions.caching = false
cache.backendName = "Sqlite"
cache.backendOptions.cache_db_complete_path = APPLICATION_PATH 
"/../data/cache/cache-dev.db"
cache.backendOptions.automatic_vacuum_factor = 20

[testing : production]
cache.frontendOptions.caching = false
cache.backendName = "Sqlite"
cache.backendOptions.cache_db_complete_path = APPLICATION_PATH 
"/../data/cache/cache-test.db"
cache.backendOptions.automatic_vacuum_factor = 20

Note that I have a different backend in production than in development
or testing. Using this approach, you can specify memcached for your
production environment, and then use File or Sqlite for the other
environments -- and have no ill effects due to lack of available
services.

-- 
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.com/


[fw-general] Caching Enabled flag for backend

2008-12-18 Thread Dan Wilson
I've added Zend_Cache to my project, but have multiple environments.
I'm using memcache as my backend, but only in one environment.  In the
other environment, I don't want caching enabled at all.  When I try to
disable caching however, it still tries to instantiate the Memcache
object.  I don't have memcache on that machine and so it barfs on me.

Why doesn't the caching enabled flag prevent this?  It looks to me
like we might need an additional caching enabled flag for the backend
as well as the frontend.

Any thoughts?

-=Dan


AW: [fw-general] setOptions in reCaptcha form element

2008-12-18 Thread Markus Hausammann
and then again, it only works, if the captcha field is totally empty...

if I enter the wrong words I get : Captcha value is wrong:
incorrect-captcha-sol

and that's what I don't want!

has anyone done that?

-Ursprüngliche Nachricht-
Von: Markus Hausammann [mailto:cont...@markushausammann.ch] 
Gesendet: Donnerstag, 18. Dezember 2008 21:55
An: 'Markus Hausammann'
Betreff: AW: [fw-general] setOptions in reCaptcha form element

here my own answer to the whole reCaptcha problem:

as the form element implements the adapter as validator, it's possible to
get the Validator by adapter name like that:

$captcha = new Zend_Form_Element_Captcha('challenge', array(  
'captcha' => 'ReCaptcha',
'label' => 'Um zu beweisen, dass Sie kein Computer sind, geben Sie
bitte die zwei angezeigten Wörter ein.', 
'captchaOptions' => array(  
'captcha' => 'ReCaptcha',  
'privKey' => $config->recaptcha->private,
'pubKey' => $config->recaptcha->public)
));

$captcha = $this->addElement($captcha);
$this->getElement('challenge')->getCaptcha()->getService()
->setOption('theme', 'clean')
->setOption('lang', 'de');
$captcha =
$this->getElement('challenge')->getValidator('ReCaptcha')->setMessage('test'
);

-Ursprüngliche Nachricht-
Von: Markus Hausammann [mailto:cont...@markushausammann.ch] 
Gesendet: Donnerstag, 18. Dezember 2008 21:08
An: fw-general@lists.zend.com
Betreff: AW: [fw-general] setOptions in reCaptcha form element

follow up question:

How can I add a custom error message to the Captcha Element?
In order to change the validator message I have to getValidator() but in
this case I didn't define any... so how can I change the message?

Thanks!

-Ursprüngliche Nachricht-
Von: Mike Rötgers [mailto:m...@roetgers.org] 
Gesendet: Donnerstag, 18. Dezember 2008 19:23
An: fw-general@lists.zend.com
Betreff: Re: [fw-general] setOptions in reCaptcha form element

I had the same problem. Maybe there is a more elegant way ... however,
this works for me:

$form->getElement('captcha')->getCaptcha()->getService()->setOption('theme',
'clean')->setOption('lang', 'de');

Kind regards
Mike

Markus Hausammann schrieb:
> Hi
> I'm implementing recaptcha but I would like to change the theme and the
> language.
> 
> Here is how I create the form element:
> 
> $captcha = new Zend_Form_Element_Captcha('challenge', array(  
>   'captcha' => 'ReCaptcha', 
>   'captchaOptions' => array(  
>   'captcha' => 'ReCaptcha',  
>   'privKey' => $config->recaptcha->private,
>   'pubKey' => $config->recaptcha->public)
>   ));
> 
> now I would like to pass the options to the service: array('theme' =>
> 'clean', 'lang' => 'de')
> 
> I tried several ways but couldn't make it work. How can I access the
adapter
> and pass the options?
> I know there is a method setOptions() for the service but how can I get
the
> service if I have instantiated the form element?
> 
> Thanks!!
> Markus
> 
> 



AW: [fw-general] setOptions in reCaptcha form element

2008-12-18 Thread Markus Hausammann
follow up question:

How can I add a custom error message to the Captcha Element?
In order to change the validator message I have to getValidator() but in
this case I didn't define any... so how can I change the message?

Thanks!

-Ursprüngliche Nachricht-
Von: Mike Rötgers [mailto:m...@roetgers.org] 
Gesendet: Donnerstag, 18. Dezember 2008 19:23
An: fw-general@lists.zend.com
Betreff: Re: [fw-general] setOptions in reCaptcha form element

I had the same problem. Maybe there is a more elegant way ... however,
this works for me:

$form->getElement('captcha')->getCaptcha()->getService()->setOption('theme',
'clean')->setOption('lang', 'de');

Kind regards
Mike

Markus Hausammann schrieb:
> Hi
> I'm implementing recaptcha but I would like to change the theme and the
> language.
> 
> Here is how I create the form element:
> 
> $captcha = new Zend_Form_Element_Captcha('challenge', array(  
>   'captcha' => 'ReCaptcha', 
>   'captchaOptions' => array(  
>   'captcha' => 'ReCaptcha',  
>   'privKey' => $config->recaptcha->private,
>   'pubKey' => $config->recaptcha->public)
>   ));
> 
> now I would like to pass the options to the service: array('theme' =>
> 'clean', 'lang' => 'de')
> 
> I tried several ways but couldn't make it work. How can I access the
adapter
> and pass the options?
> I know there is a method setOptions() for the service but how can I get
the
> service if I have instantiated the form element?
> 
> Thanks!!
> Markus
> 
> 



AW: [fw-general] setOptions in reCaptcha form element

2008-12-18 Thread Markus Hausammann
stupid me: I tried to get the element before I had assigned it.

Mikes solution works!

-Ursprüngliche Nachricht-
Von: Markus Hausammann [mailto:cont...@markushausammann.ch] 
Gesendet: Donnerstag, 18. Dezember 2008 19:44
An: fw-general@lists.zend.com
Betreff: AW: [fw-general] setOptions in reCaptcha form element

Thanks Mike, if I do that I get:

Call to a member function getCaptcha() on a non-object, I've tried
'challenge' and 'ReCaptcha' instead of 'captcha' but nothing works.

-Ursprüngliche Nachricht-
Von: Mike Rötgers [mailto:m...@roetgers.org] 
Gesendet: Donnerstag, 18. Dezember 2008 19:23
An: fw-general@lists.zend.com
Betreff: Re: [fw-general] setOptions in reCaptcha form element

I had the same problem. Maybe there is a more elegant way ... however,
this works for me:

$form->getElement('captcha')->getCaptcha()->getService()->setOption('theme',
'clean')->setOption('lang', 'de');

Kind regards
Mike

Markus Hausammann schrieb:
> Hi
> I'm implementing recaptcha but I would like to change the theme and the
> language.
> 
> Here is how I create the form element:
> 
> $captcha = new Zend_Form_Element_Captcha('challenge', array(  
>   'captcha' => 'ReCaptcha', 
>   'captchaOptions' => array(  
>   'captcha' => 'ReCaptcha',  
>   'privKey' => $config->recaptcha->private,
>   'pubKey' => $config->recaptcha->public)
>   ));
> 
> now I would like to pass the options to the service: array('theme' =>
> 'clean', 'lang' => 'de')
> 
> I tried several ways but couldn't make it work. How can I access the
adapter
> and pass the options?
> I know there is a method setOptions() for the service but how can I get
the
> service if I have instantiated the form element?
> 
> Thanks!!
> Markus
> 
> 



AW: [fw-general] setOptions in reCaptcha form element

2008-12-18 Thread Markus Hausammann
Thanks Mike, if I do that I get:

Call to a member function getCaptcha() on a non-object, I've tried
'challenge' and 'ReCaptcha' instead of 'captcha' but nothing works.

-Ursprüngliche Nachricht-
Von: Mike Rötgers [mailto:m...@roetgers.org] 
Gesendet: Donnerstag, 18. Dezember 2008 19:23
An: fw-general@lists.zend.com
Betreff: Re: [fw-general] setOptions in reCaptcha form element

I had the same problem. Maybe there is a more elegant way ... however,
this works for me:

$form->getElement('captcha')->getCaptcha()->getService()->setOption('theme',
'clean')->setOption('lang', 'de');

Kind regards
Mike

Markus Hausammann schrieb:
> Hi
> I'm implementing recaptcha but I would like to change the theme and the
> language.
> 
> Here is how I create the form element:
> 
> $captcha = new Zend_Form_Element_Captcha('challenge', array(  
>   'captcha' => 'ReCaptcha', 
>   'captchaOptions' => array(  
>   'captcha' => 'ReCaptcha',  
>   'privKey' => $config->recaptcha->private,
>   'pubKey' => $config->recaptcha->public)
>   ));
> 
> now I would like to pass the options to the service: array('theme' =>
> 'clean', 'lang' => 'de')
> 
> I tried several ways but couldn't make it work. How can I access the
adapter
> and pass the options?
> I know there is a method setOptions() for the service but how can I get
the
> service if I have instantiated the form element?
> 
> Thanks!!
> Markus
> 
> 



Re: [fw-general] setOptions in reCaptcha form element

2008-12-18 Thread Mike Rötgers
I had the same problem. Maybe there is a more elegant way ... however,
this works for me:

$form->getElement('captcha')->getCaptcha()->getService()->setOption('theme',
'clean')->setOption('lang', 'de');

Kind regards
Mike

Markus Hausammann schrieb:
> Hi
> I'm implementing recaptcha but I would like to change the theme and the
> language.
> 
> Here is how I create the form element:
> 
> $captcha = new Zend_Form_Element_Captcha('challenge', array(  
>   'captcha' => 'ReCaptcha', 
>   'captchaOptions' => array(  
>   'captcha' => 'ReCaptcha',  
>   'privKey' => $config->recaptcha->private,
>   'pubKey' => $config->recaptcha->public)
>   ));
> 
> now I would like to pass the options to the service: array('theme' =>
> 'clean', 'lang' => 'de')
> 
> I tried several ways but couldn't make it work. How can I access the adapter
> and pass the options?
> I know there is a method setOptions() for the service but how can I get the
> service if I have instantiated the form element?
> 
> Thanks!!
> Markus
> 
> 


[fw-general] setOptions in reCaptcha form element

2008-12-18 Thread Markus Hausammann
Hi
I'm implementing recaptcha but I would like to change the theme and the
language.

Here is how I create the form element:

$captcha = new Zend_Form_Element_Captcha('challenge', array(  
'captcha' => 'ReCaptcha', 
'captchaOptions' => array(  
'captcha' => 'ReCaptcha',  
'privKey' => $config->recaptcha->private,
'pubKey' => $config->recaptcha->public)
));

now I would like to pass the options to the service: array('theme' =>
'clean', 'lang' => 'de')

I tried several ways but couldn't make it work. How can I access the adapter
and pass the options?
I know there is a method setOptions() for the service but how can I get the
service if I have instantiated the form element?

Thanks!!
Markus



RE: [fw-general] Short Tags vs. Long Tags performance question

2008-12-18 Thread Robert Castley
Thank you :-) 

-Original Message-
From: Matthew Weier O'Phinney [mailto:matt...@zend.com] 
Sent: 18 December 2008 14:41
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Short Tags vs. Long Tags performance question

-- Robert Castley  wrote (on Thursday, 18
December 2008, 09:21 AM -):
> If you enable your ZF application to use short tags is there a 
> benefit/increase in performance over littering your view scripts with echo
this and echo that?

They operate exactly the same.

--
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.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] Interact with zend_http request

2008-12-18 Thread A.J. Brown

You can set cookie values if you use a CookieJar with the request, though. 
It wouldn't be an automated solution, and would break if the client code
changes, though.

-- 
A.J. Brown
Zend Certified PHP Engineer
http://ajbrown.org/blog


Giuliano Riccio wrote:
> 
> Probably it's not possible since Zend_Http doesn't execute the javascript
> content of the page.
> 
> Giuliano
> 
> Junior Gillespie-2 wrote:
>> 
>> Hello, I've recently ran into a problem that's I'm unable to find a
>> work around for.
>> 
>> Using Zend_HTTP, I'm accessing a site and posting authentication
>> credentials. Upon success, remote page redirects to a confirm page
>> with an "Ok" button. This button utilizes the onClick event to expire
>> a cookie in order to confirm, it then redirects.
>> 
>> The onclick event looks like this:
>> 
>>  
>> 
>> Javascript:
>> 
>> function redir()
>>  {
>>  // Deletes the cookie by expiring
>>  setCookie("link","", new Date("January 1, 1970"), "/" );
>>  if ("" != "") {
>>  window.location="";
>>  }
>>  }
>> 
>> How would I code for this type of mechanism, in order to issue the
>> onClick event in order to get a redirect to the contents I need?
>> 
>> --
>> Thanks,
>> 
>> Junior
>> 
>> 
> 
> 


-
Regards,

A.J. Brown
Zend Certified PHP Engineer
http://ajbrown.me
-- 
View this message in context: 
http://www.nabble.com/Interact-with-zend_http-request-tp21072511p21074734.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Short Tags vs. Long Tags performance question

2008-12-18 Thread Matthew Weier O'Phinney
-- Joó Ádám  wrote
(on Thursday, 18 December 2008, 10:35 AM +0100):
> I haven't heard anything about that yet, however in my opninion it
> must _decrease_ performance…

Based on...?

PHP compiles http://framework.zend.com/


Re: [fw-general] Short Tags vs. Long Tags performance question

2008-12-18 Thread Matthew Weier O'Phinney
-- Robert Castley  wrote
(on Thursday, 18 December 2008, 09:21 AM -):
> If you enable your ZF application to use short tags is there a 
> benefit/increase
> in performance over littering your view scripts with echo this and echo that?

They operate exactly the same.

-- 
Matthew Weier O'Phinney
Software Architect   | matt...@zend.com
Zend Framework   | http://framework.zend.com/


[fw-general] Custom form element - passing options to viewHelper

2008-12-18 Thread sinkingfish

Hi,


I making a custom form element which is 3 fields for phone numbers, ie
country code, area code &  number.

I'm getting tripped up when I want to set options for the element in the
viewHelper. So I want the element to be flexible and be able to set how many
characters each field can hold.


my view helper: 

class My_View_Helper_FormPhoneNumber extends Zend_View_Helper_FormElement
{

public function formPhoneNumber($name, $value = null, $attribs = null,
$options = null)
{



So I'm wonder where and how do I populate the options parameter?

Thanks
Brian
-- 
View this message in context: 
http://www.nabble.com/Custom-form-element---passing-options-to-viewHelper-tp21073843p21073843.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Interact with zend_http request

2008-12-18 Thread Giuliano Riccio

Probably it's not possible since Zend_Http doesn't execute the javascript
content of the page.

Giuliano

Junior Gillespie-2 wrote:
> 
> Hello, I've recently ran into a problem that's I'm unable to find a
> work around for.
> 
> Using Zend_HTTP, I'm accessing a site and posting authentication
> credentials. Upon success, remote page redirects to a confirm page
> with an "Ok" button. This button utilizes the onClick event to expire
> a cookie in order to confirm, it then redirects.
> 
> The onclick event looks like this:
> 
>  
> 
> Javascript:
> 
> function redir()
>   {
>   // Deletes the cookie by expiring
>   setCookie("link","", new Date("January 1, 1970"), "/" );
>   if ("" != "") {
>   window.location="";
>   }
>   }
> 
> How would I code for this type of mechanism, in order to issue the
> onClick event in order to get a redirect to the contents I need?
> 
> --
> Thanks,
> 
> Junior
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Interact-with-zend_http-request-tp21072511p21073306.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Session oddity

2008-12-18 Thread spaceage

Yes, this would be true--the code I posted is a snippet and not the entire
init()--I have code which checks if the string var is set to avoid the
problem you note.

Turns out that this issue is a PHP5 "feature" I overlooked where strings
(and all scalars?) are assigned by value by objects are assigned by
reference...problem solve, my bad.



Giuliano Riccio wrote:
> 
> You are setting your string variable to "top" in the session namespace
> everytime you request that controller, that's probably why.
> 
> spaceage wrote:
>> 
>> I should clarify that the string var does get (and persist) the initial
>> assignment of "top", but subsequent changes to the var doesn't
>> persist--the value can change within the action, but at the next
>> invocation of the action, the value of the string is still the initial
>> value ("top" in this case)...
>> 
>> 
>> 
>> 
>> I'm having a strange issue with Zend_Session where I am assigning a
>> string and an object to the same Session Namespace.  The object will
>> persist, but the string won't...I open/start the namespace in init()
>> since I need access to the session data throughout my controller.  I then
>> assign the session data to a local var in my action for convenience.  Not
>> sure if the way I'm assigning vars is the problem, but in any case the
>> object is persisting and the string var isn't:
>> 
>> 
>> public function init() {
>>  //load session vars
>>  $this->sessionVars = new Zend_Session_Namespace('collection');
>> 
>>  //assign string to session as "activeAlbum"
>>  $this->sessionVars->activeAlbum =   "top";
>>  $this->activeAlbum =
>> $this->sessionVars->activeAlbum;
>> 
>>  //assign object "Album" to session as "currentAlbum"
>>  $this->sessionVars->currentAlbum =  new Album($name='top');
>>  $this->currentAlbum =   
>> $this->sessionVars->currentAlbum;
>> }
>> 
>> public function listAction() {   
>>  //assign string to local var: DOESN'T PERSIST
>>  $currentAlbum = $this->currentAlbum;
>>  
>>  //assign Album object to local var: PERSISTS
>>  $activeAlbum = $this->activeAlbum;
>> 
>>do stuff with $currentAlbum, $activeAlbum, but
>> $currentAlbum won't persist...
>> }
>> 
>> Any ideas?
>> 
>> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Session-oddity-tp21058169p21073158.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Interact with zend_http request

2008-12-18 Thread Junior Gillespie
Hello, I've recently ran into a problem that's I'm unable to find a
work around for.

Using Zend_HTTP, I'm accessing a site and posting authentication
credentials. Upon success, remote page redirects to a confirm page
with an "Ok" button. This button utilizes the onClick event to expire
a cookie in order to confirm, it then redirects.

The onclick event looks like this:

 

Javascript:

function redir()
{
// Deletes the cookie by expiring
setCookie("link","", new Date("January 1, 1970"), "/" );
if ("" != "") {
window.location="";
}
}

How would I code for this type of mechanism, in order to issue the
onClick event in order to get a redirect to the contents I need?

--
Thanks,

Junior


Re: [fw-general] date validation without specific format

2008-12-18 Thread Martijn Korse

I think i would use a date-filter first, that converts the date into a
specific format and then try to validate that specific format. If the filter
is not able to recognize the format, then it won't validate.
Dealing with different kinds of formats is more a responsibility of a filter
than a validator imo.


Jan Pieper wrote:
> 
> Is it possible to validate a string against each date/datetime format? 
> The validation should stop when a valid format is found.
> 
> -- Jan
> 
> 


-
http://devshed.excudo.net http://devshed.excudo.net 
-- 
View this message in context: 
http://www.nabble.com/date-validation-without-specific-format-tp21070053p21071774.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Insert HTML / JS in to middle of a zend_form

2008-12-18 Thread Tim Nagel
We've been inserting all javascript after the entire form, or in the head
using the onDOMReady event provided by YUI.

Seems to work well for most things.


T

On Thu, Dec 18, 2008 at 07:59, Bart McLeod  wrote:

> you will need a decorator on your first element, with placement set to
> 'append' or a decorator on the second element, with placement set to
> 'prepend'.
>
> There is a lot on decorators in the manual and on devzone.
>
> Bart
>
> maxarbos schreef:
>
> I have been through a number of examples, but dont think I have
>> found/understand what i need to do.
>>
>> I have a form that i want the rendered html to look like this (or
>> similar):
>>
>> 
>> First Name:
>>
>> javascript:document.myform.getElementByID('first_name').value click here
>> Last Name:
>> 
>>
>>
>> I have a zend form created by:
>>
>> 
>> class My_Forms_Names extends Zend_Form{
>>
>>public function init()
>>{
>>$this->addElement('text', 'first_name', array(
>>'filters' => array('StringTrim'),
>>'validators' => array(
>>'Alpha',
>>array('StringLength', false, array(2, 50)),
>>),
>>'required' => true,
>>'label' => 'First Name',
>>'class' => 'text',
>>));
>>
>>
>>$this->addElement('text', 'last_name', array(
>>'filters' => array('StringTrim'),
>>'validators' => array(
>>'Alpha',
>>array('StringLength', false, array(2, 50)),
>>),
>>'required' => true,
>>'label' => 'Last Name',
>>'class' => 'text',
>>));
>>
>>
>>$this->addDisplayGroup(
>>array('first_name', 'last_name'),
>>'nameinfo',
>>array(
>>'disableLoadDefaultDecorators' => true,
>>'decorators' => array(
>>'FormElements',
>>array('HtmlTag',
>> array('tag'=>'ol')),
>>'Fieldset' ),
>>'legend' => 'Trips:',
>>)
>>);
>>
>>}
>> }
>> 
>>
>>
>> I want to be able to insert '
>> javascript:document.myform.getElementByID('first_name').value click here '
>> in between the two name fields.
>>
>> Any suggestions or examples would be great.
>>
>> Thank you.
>>
>>
>>
>


[fw-general] Strategy for storing multilingual content in the database.

2008-12-18 Thread Colin Guthrie

Hi Guys,

I'm just wondering is there is a good Zend Framework-based methodology 
for storing multi-lingual content in a database?


I know that there are several structures for doing this kind of thing, 
including tables of strings that include language identifiers and such 
like, but these can often be complex and hard to model.


What I've done in the past is create some custom UDF functions in MySQL 
to pack multi-lingual content into a single field.


I would do something like:
INSERT INTO table SET field=LANG_PACK('en', 'Hello', 'fr', 'Bonjour');

I could then do:
SELECT LANG_EXTRACT(field, 'fr', 'en') FROM table;
which would give me back 'Bonjour'; or

SELECT LANG_EXTRACT(field, 'de', 'en', 'fr') FROM table;
which would give me back 'Hello' as no 'de' translation was found.

In the past, I've generally integrated the call to LANG_EXTRACT into an 
API call in my db layer so when extracting the language for the current 
locale the app is running in is trivial - so in ZF parlance something 
similar to this:


$db->select()->from('table', $db->langField('field'));
(where $db->langField() would returns a Zend_Db_Expr).

This has the advantage that only the correct language comes out of the 
database layer, and there is no logic required in the application.


As the MySQL functions are written in C and the packed language format 
includes a header which contains exact byte locations of the substring 
we want and thus can return the data quickly. It also handles "falling 
back" to 2nd or thrid choice of language if the data is not present in 
the preferred language.


Personally I really like the approach of dumping this logic into the db 
layer. It keeps the application logic quite simple. Some other MySQL 
functions allow for full extraction of the data in XML (LANG_XML()) 
format and thus allow for the creation of an editing interface that 
shows all languages (e.g. as tabs). Other functions include 
LANG_UPDATE() and LANG_PACK_XML() to perform what their name suggests.


Now all of this is very non-standard. It works for me and I find it 
quite efficient and effective for my needs... there are however several 
disadvantages:
 1. Indexing: The db layer cannot index this content particurly well, 
and comparing the result of a function is not that efficient as it needs 
a full table scan.
 2. It requires custom functions to be compiled and installed on the db 
server. While this is quite simple, it's obviously an sysadmin overhead.



So my basic question is, is there a standard way to do this kind of 
thing in ZF?


Perhaps there is a construct in the ZF db layer (or such a construct 
could be create) to store the multilingual data in XML and extract out 
the specific string from the XML semi-transparently?


This is kind of the opposite to Zend_Db_Expr where you define something 
that should be passed to the DB directly. I'd propose a Zend_Db_Filter 
which would have a way to know what expression to select ($f->getExpr()) 
and know that before the data is returned to the caller, it should be 
filtered ($fiels = $f->filter($field)).


(This kind of filter could be useful for other things too, e.g. for 
creating an image object from raw image data etc.)


Going back to my above example:
$db->select()->from('table', $db->langField('field'));

$db->langField() would return a Zend_Db_Filter object and the field 
itself would just store e.g. XML.



I don't want to ramble on here and go off on too many tangents, so I'm 
just really canvassing ideas/opinions as to how this kind of thing could 
be done and what improvements can be made to ZF to support this.


Thoughts?

Col




--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



Re: [fw-general] Confused about decorators

2008-12-18 Thread Mon Zafra
You should put the My directory at the same level as Zend:

library
 Zend
 Controller
 Form, View, etc.
 My
 Decorator
 Composite.php
 your other library classes, e.g. helpers, plugins, forms


   -- Mon


On Thu, Dec 18, 2008 at 2:57 PM, vibhor singh  wrote:

>  Just to add I am getting the following error:
>
> *Message:* Plugin by name 'Composite' was not found in the registry; used
> paths: My_Decorator_: My/Decorator/ Zend_Form_Decorator_:
> Zend/Form/Decorator/:Zend/Form/Decorator/
>
>
>  --
>
> *From:* vibhor singh [mailto:vib...@pivisions.com]
> *Sent:* Thursday, December 18, 2008 12:00 PM
> *To:* fw-general@lists.zend.com
> *Subject:* [fw-general] Confused about decorators
>
>
>
> Hi all,
>
>
>
> I have just begun learning ZF. I have come across Decorators and am finding
> a bit difficult to grasp it. My question is where I need to put my new
> decorator class in the project folder. It looks like the following:
>
>
>
> vQuick
>
> -application
>
> -controllers
>
> -models
>
> -forms
>
> -views
>
> -public
>
> -library
>
> -Zend
>
>
>
> Following the Zend_Decorator example [
> http://www.zendframework.com/manual/en/zend.form.decorators.html] I have
> put the new file in :
>
>
>
> -library
>
> -Zend
>
> -Form
>
>   -Decorator
>
> -My
>
>   -Decorator
>
> -Composite.php
>
>
>
> Am I doing something wrong here? Can someone please help me with this.
> Thanks
>
>
>
> Vibhor
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.176 / Virus Database: 270.9.19/1854 - Release Date: 12/17/2008
> 7:21 PM
>


[fw-general] date validation without specific format

2008-12-18 Thread Jan Pieper
Is it possible to validate a string against each date/datetime format? 
The validation should stop when a valid format is found.


-- Jan


Re: [fw-general] Session oddity

2008-12-18 Thread Giuliano Riccio

You are setting your string variable to "top" in the session namespace
everytime you request that controller, that's probably why.

spaceage wrote:
> 
> I should clarify that the string var does get (and persist) the initial
> assignment of "top", but subsequent changes to the var doesn't
> persist--the value can change within the action, but at the next
> invocation of the action, the value of the string is still the initial
> value ("top" in this case)...
> 
> 
> 
> 
> I'm having a strange issue with Zend_Session where I am assigning a string
> and an object to the same Session Namespace.  The object will persist, but
> the string won't...I open/start the namespace in init() since I need
> access to the session data throughout my controller.  I then assign the
> session data to a local var in my action for convenience.  Not sure if the
> way I'm assigning vars is the problem, but in any case the object is
> persisting and the string var isn't:
> 
> 
> public function init() {
>   //load session vars
>   $this->sessionVars = new Zend_Session_Namespace('collection');
> 
>   //assign string to session as "activeAlbum"
>   $this->sessionVars->activeAlbum =   "top";
>   $this->activeAlbum =
> $this->sessionVars->activeAlbum;
> 
>   //assign object "Album" to session as "currentAlbum"
>   $this->sessionVars->currentAlbum =  new Album($name='top');
>   $this->currentAlbum =   
> $this->sessionVars->currentAlbum;
> }
> 
> public function listAction() {
>   //assign string to local var: DOESN'T PERSIST
>   $currentAlbum = $this->currentAlbum;
>   
>   //assign Album object to local var: PERSISTS
>   $activeAlbum = $this->activeAlbum;
> 
>do stuff with $currentAlbum, $activeAlbum, but
> $currentAlbum won't persist...
> }
> 
> Any ideas?
> 
> 



-- 
View this message in context: 
http://www.nabble.com/Session-oddity-tp21058169p21069694.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Short Tags vs. Long Tags performance question

2008-12-18 Thread Joó Ádám
I haven't heard anything about that yet, however in my opninion it
must _decrease_ performance…


Regards,
Ádám


[fw-general] Short Tags vs. Long Tags performance question

2008-12-18 Thread Robert Castley
Hi,
 
If you enable your ZF application to use short tags is there a
benefit/increase in performance over littering your view scripts with echo
this and echo that?
 
Cheers,
 
- 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.