[fw-general] There is no way to customize the validator messages?

2009-11-16 Thread Chou Ken
There is no way to customize the validator messages?

http://framework.zend.com/manual/en/zend.file.transfer.validators.html
the doc said:Upload: This validator is internal. It checks if an
upload has resulted in an error. You must not set it, as it's
automatically set by Zend_File_Transfer itself. So you do not use this
validator directly. You should only know that it exists. 




青青子衿,悠悠我心


Re: [fw-general] There is no way to customize the validator messages?

2009-11-16 Thread whisher

Hi.

You can put your value using Zend_Translate
for instance:

$translate = new Zend_Translate('array', APPLICATION_PATH .
'/configs/lang/'. $locale . '.php' , $lang);

in my it_IT.php

return array(
/* VALIDATORS */
Zend_Validate_NotEmpty::IS_EMPTY   = 'Il campo è obbligatorio e non
può essere vuoto'/*Value is required and can\'t be empty*/, etct etc etc

You can find the keys at 

http://framework.zend.com/manual/en/zend.validate.messages.html
http://framework.zend.com/manual/en/zend.validate.messages.html 






Chou Ken wrote:
 
 There is no way to customize the validator messages?
 
 http://framework.zend.com/manual/en/zend.file.transfer.validators.html
 the doc said:Upload: This validator is internal. It checks if an
 upload has resulted in an error. You must not set it, as it's
 automatically set by Zend_File_Transfer itself. So you do not use this
 validator directly. You should only know that it exists. 
 
 
 
 
 青青子衿,悠悠我心
 
 

-- 
View this message in context: 
http://old.nabble.com/There-is-no-way-to-customize-the-validator-messages--tp26369321p26369713.html
Sent from the Zend Framework mailing list archive at Nabble.com.


[fw-general] Can't prepopulate state of check boxes

2009-11-16 Thread Kuzma

Hi all!
I'm trying to prepopulate checkbox.
I've DB table:
CREATE TABLE IF NOT EXISTS `user` (
  `id` tinyint(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  `password` varchar(32) NOT NULL,
  `email` varchar(255) NOT NULL,
  `reg_date` datetime DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
  `group` tinyint(3) NOT NULL DEFAULT '0',
  `superuser` tinyint(1) NOT NULL DEFAULT '0',
  `last_ip` varchar(19) NOT NULL DEFAULT '...',
  `active` tinyint(1) NOT NULL DEFAULT '0',
  `description` text NOT NULL,
  `birth_date` date DEFAULT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=cp1251 AUTO_INCREMENT=19 ;

I've Form class:

class Models_Form_RadioForm extends Zend_Form
{

public function init()  

{

$this-setMethod('post');
$this-setAction('auth/state');

$enabled = new Zend_Form_Element_Checkbox('enabled');
$enabled-setLabel('Group enabled')
-setDecorators(array(
'Label',
'ViewHelper',
'Errors',
array('p' = 'HtmlTag', array('tag' = 'p'))
));
$this-addElement($enabled);
}
}
I've model which returns data from 'active' record:
class Default_DB_User extends Zend_Db_Table_Abstract
{
protected $_name = 'user';
public function getUserData($userId)
{
return
$this-getAdapter()-query($this-select()-from($this-_name, 'active')
-where('id = ?', $userId))-fetch();
}
}
 And finally the main function:

function indexAction()
{

$users = new Default_DB_User();

$this-view-users = $users-fetchAll();

$radioForm = new Models_Form_RadioForm();

$users = $users-getUserData(16);

print_r ($users);

$radioForm-populate(array('enabled' = $users));

$this-view-radioForm = $radioForm;

}

print_r ($users) outputs: stdClass Object ( [active] = 1 )
The CheckBox won't be checked :-(
But $radioForm-populate(array('enabled' = 1)) return checked state
$radioForm-populate(array('enabled' = $users)) won't work...
Any solutions?
Thank you!
-- 
View this message in context: 
http://old.nabble.com/Can%27t-prepopulate-state-of-check-boxes-tp26369870p26369870.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Re: Zend_Dojo_Form required RadioButton

2009-11-16 Thread Martin Carpentier
I'm bumping this topic as I haven't found a solution yet and have a hard
time believing I'm the only one having to use required radio buttons in a
form.

Anyone having a solution for this ?

Thanks,

Martin Carpentier


On Tue, Nov 10, 2009 at 16:18, Martin Carpentier 
carpentier.mar...@gmail.com wrote:

 Hi,

 I'm having a Zend_Dojo_Form with a RadioButton element defined like this:

 $options = array(
 0 = 'no',
 1 = 'yes',
 );

 $this-addElement('RadioButton', 'elementName', array(
 'label'  = 'some label',
 'multiOptions'   = $options,
 'required'   = true,
 ));


 My form displays correctly with the dojo enhancements but when I submit the
 form without selecting any of the radio button values, dojo doesn't flag the
 element as being invalid.
 I'm expecting it to be flagged with an error like the other required
 elements that have been submitted without being filled.

 Here's my dojo declarations:

 dojo.require(dojo.i18n);

 dojo.require(dijit.TitlePane);
 dojo.require(dijit.form.CheckBox);
 dojo.require(dijit.form.FilteringSelect);
 dojo.require(dijit.form.DateTextBox);
 dojo.require(dijit.form.ValidationTextBox);

 dojo.require(dijit.form.Button);
 dojo.require(dijit.form.Form);
 dojo.require(dojo.parser);


 I also have this form validation function set:

 dojo.addOnLoad(function () {
 dojo.connect(dijit.byId(formSomething), onSubmit, validateForm);

 }
 );
 function validateForm() {
 var form = dijit.byId(formSomething);
 if (!form.validate()) {
 return false;
 }
 return true;
 }


 I noticed that the zendDijits js variable was set like this:

 var zendDijits = 
 [{id:elementName,params:{required:true,dojoType:dijit.form.RadioButton}},{id:elementName-0,params:{dojoType:dijit.form.RadioButton}},{id:elementName-1,params:{dojoType:dijit.form.RadioButton}},
  ... ];


 The required flag is only set on the main elementName element but doesn't
 seem to be taken into account for the validation.

 So my question is, how can I make the RadioButton element being flagged as
 required when none of it's values has been selected?

 Martin Carpentier



[fw-general] Issues with $this-headScript()

2009-11-16 Thread Ian Warner
Hi

When I use:
echo $this-headScript() . PHP_EOL;


All that prints out is:
Object id #99

This is a new and unfamiliar server I am deploying on so could be
anything - but any pointed gratefully received

Ian


AW: [fw-general] Issues with $this-headScript()

2009-11-16 Thread Stefan Gehrig
Hi Ian,

please check your PHP version...

It is worth noting that before PHP 5.2.0 the __toString method was only called 
when it was directly combined with echo() or print(). Since PHP 5.2.0, it is 
called in any string context (e.g. in printf() with %s modifier) but not in 
other types contexts (e.g. with %d modifier). [...]
http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring

__toString will not be called in concatenation-operations prior to PHP 5.2.0.

Best regards

Stefan


-Ursprüngliche Nachricht-
Von: Ian Warner [mailto:iwar...@triangle-solutions.com] 
Gesendet: Montag, 16. November 2009 12:28
An: Zend Framework
Betreff: [fw-general] Issues with $this-headScript()

Hi

When I use:
echo $this-headScript() . PHP_EOL;


All that prints out is:
Object id #99

This is a new and unfamiliar server I am deploying on so could be
anything - but any pointed gratefully received

Ian



Re: [fw-general] Issues with $this-headScript()

2009-11-16 Thread Ian Warner
Stefan

Spot on

However I get this error now:
Fatal error: Call to undefined method
Zend_View_Helper_Placeholder_Container::ksort() in
/content/pringlus/docs/conga/library/Zend/View/Helper/HeadLink.php on
line 311

In the toString method:

public function toString($indent = null)
{
$indent = (null !== $indent)
? $this-getWhitespace($indent)
: $this-getIndent();

$items = array();
$this-getContainer()-ksort();
foreach ($this as $item) {
$items[] = $this-itemToString($item);
}

return $indent . implode($this-_escape($this-getSeparator())
. $indent, $items);
}

Ian


2009/11/16 Stefan Gehrig geh...@ishd.de:
 The problem is that you're doing

 echo $this-headScript() . PHP_EOL;
                         ^
                         |
 that's a concatenation --+

 That's effectively concat the result from $this-headScript() with an 
 PHP_EOL and echo the result.
 Therefore this is not strictly considered directly combined with echo() or 
 print().

 You'd have to do:
 echo $this-headScript();
 echo PHP_EOL;

 Best regards

 Stefan


 -Ursprüngliche Nachricht-
 Von: Ian Warner [mailto:iwar...@triangle-solutions.com]
 Gesendet: Montag, 16. November 2009 12:48
 An: Stefan Gehrig
 Betreff: Re: [fw-general] Issues with $this-headScript()

 Stefan

 appreciate that, indeed this server has 5.1.x on it

 However I am doing
 echo $this-headScript() . PHP_EOL;

 therefore from the instructions:

 It is worth noting that before PHP 5.2.0 the __toString method was
 only called when it was directly combined with echo() or print()

 am I not doiing this correctly?

 2009/11/16 Stefan Gehrig geh...@ishd.de:
 Hi Ian,

 please check your PHP version...

 It is worth noting that before PHP 5.2.0 the __toString method was only 
 called when it was directly combined with echo() or print(). Since PHP 
 5.2.0, it is called in any string context (e.g. in printf() with %s 
 modifier) but not in other types contexts (e.g. with %d modifier). [...]
 http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring

 __toString will not be called in concatenation-operations prior to PHP 5.2.0.

 Best regards

 Stefan


 -Ursprüngliche Nachricht-
 Von: Ian Warner [mailto:iwar...@triangle-solutions.com]
 Gesendet: Montag, 16. November 2009 12:28
 An: Zend Framework
 Betreff: [fw-general] Issues with $this-headScript()

 Hi

 When I use:
 echo $this-headScript() . PHP_EOL;


 All that prints out is:
 Object id #99

 This is a new and unfamiliar server I am deploying on so could be
 anything - but any pointed gratefully received

 Ian






Re: [fw-general] Re: Zend_Dojo_Form required RadioButton

2009-11-16 Thread Matthew Weier O'Phinney
-- Martin Carpentier carpentier.mar...@gmail.com wrote
(on Monday, 16 November 2009, 12:14 PM +0100):
 I'm bumping this topic as I haven't found a solution yet and have a hard time
 believing I'm the only one having to use required radio buttons in a form.

Do you have an onSubmit event that's performing form validation? If not,
then nothing special will happen.

 Anyone having a solution for this ?
 
 Thanks,
 
 Martin Carpentier
 
 
 On Tue, Nov 10, 2009 at 16:18, Martin Carpentier carpentier.mar...@gmail.com
 wrote:
 
 Hi,
 
 I'm having a Zend_Dojo_Form with a RadioButton element defined like this:
 
 $options = array(
     0 = 'no',
     1 = 'yes',
 );
 
 $this-addElement('RadioButton', 'elementName', array(
     'label'  = 'some label',
     'multiOptions'   = $options,
     'required'   = true,
 ));
 
 
 My form displays correctly with the dojo enhancements but when I submit 
 the
 form without selecting any of the radio button values, dojo doesn't flag
 the element as being invalid.
 I'm expecting it to be flagged with an error like the other required
 elements that have been submitted without being filled.
 
 Here's my dojo declarations:
 
 dojo.require(dojo.i18n);
 
 
 dojo.require(dijit.TitlePane);
 dojo.require(dijit.form.CheckBox);
 dojo.require(dijit.form.FilteringSelect);
 dojo.require(dijit.form.DateTextBox);
 dojo.require(dijit.form.ValidationTextBox);
 
 
 dojo.require(dijit.form.Button);
 dojo.require(dijit.form.Form);
 dojo.require(dojo.parser);
 
 
 I also have this form validation function set:
 
 
 dojo.addOnLoad(function () {
 
 dojo.connect(dijit.byId(formSomething), onSubmit, validateForm);
 
 }
 );
 function validateForm() {
 var form = dijit.byId(formSomething);
 if (!form.validate()) {
 return false;
 }
 return true;
 
 }
 
 
 
 I noticed that the zendDijits js variable was set like this:
 
 
 var zendDijits = 
 [{id:elementName,params:{required:true,dojoType:dijit.form.RadioButton}},{id:elementName-0,params:{dojoType:dijit.form.RadioButton}},{id:elementName-1,params:{dojoType:dijit.form.RadioButton}},
  ... ];
 
 
 
 
 The required flag is only set on the main elementName element but 
 doesn't
 seem to be taken into account for the validation.
 
 So my question is, how can I make the RadioButton element being flagged as
 required when none of it's values has been selected?
 
 Martin Carpentier
 
 

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


Re: [fw-general] Re: Zend_Dojo_Form required RadioButton

2009-11-16 Thread Martin Carpentier
Hi Matthew,

thanks for the reply.

I have this function setup in my view script

dojo.addOnLoad(function () {
dojo.connect(dijit.byId(formSomething), onSubmit, validateForm);

}
);
function validateForm() {
var form = dijit.byId(formSomething);
if (!form.validate()) {
return false;
}
return true;
}


All the elements get validated on the submit except for the radio buttons.

Do I have to add javascript code specificaly for  the validation of the
radio buttons ?


Martin Carpentier


On Mon, Nov 16, 2009 at 14:40, Matthew Weier O'Phinney matt...@zend.comwrote:

 -- Martin Carpentier carpentier.mar...@gmail.com wrote
 (on Monday, 16 November 2009, 12:14 PM +0100):
  I'm bumping this topic as I haven't found a solution yet and have a hard
 time
  believing I'm the only one having to use required radio buttons in a
 form.

 Do you have an onSubmit event that's performing form validation? If not,
 then nothing special will happen.

  Anyone having a solution for this ?
 
  Thanks,
 
  Martin Carpentier
 
 
  On Tue, Nov 10, 2009 at 16:18, Martin Carpentier 
 carpentier.mar...@gmail.com
  wrote:
 
  Hi,
 
  I'm having a Zend_Dojo_Form with a RadioButton element defined like
 this:
 
  $options = array(
  0 = 'no',
  1 = 'yes',
  );
 
  $this-addElement('RadioButton', 'elementName', array(
  'label'  = 'some label',
  'multiOptions'   = $options,
  'required'   = true,
  ));
 
 
  My form displays correctly with the dojo enhancements but when I
 submit the
  form without selecting any of the radio button values, dojo doesn't
 flag
  the element as being invalid.
  I'm expecting it to be flagged with an error like the other required
  elements that have been submitted without being filled.
 
  Here's my dojo declarations:
 
  dojo.require(dojo.i18n);
 
 
  dojo.require(dijit.TitlePane);
  dojo.require(dijit.form.CheckBox);
  dojo.require(dijit.form.FilteringSelect);
  dojo.require(dijit.form.DateTextBox);
  dojo.require(dijit.form.ValidationTextBox);
 
 
  dojo.require(dijit.form.Button);
  dojo.require(dijit.form.Form);
  dojo.require(dojo.parser);
 
 
  I also have this form validation function set:
 
 
  dojo.addOnLoad(function () {
 
  dojo.connect(dijit.byId(formSomething), onSubmit,
 validateForm);
 
  }
  );
  function validateForm() {
  var form = dijit.byId(formSomething);
  if (!form.validate()) {
  return false;
  }
  return true;
 
  }
 
 
 
  I noticed that the zendDijits js variable was set like this:
 
 
  var zendDijits =
 [{id:elementName,params:{required:true,dojoType:dijit.form.RadioButton}},{id:elementName-0,params:{dojoType:dijit.form.RadioButton}},{id:elementName-1,params:{dojoType:dijit.form.RadioButton}},
 ... ];
 
 
 
 
  The required flag is only set on the main elementName element but
 doesn't
  seem to be taken into account for the validation.
 
  So my question is, how can I make the RadioButton element being
 flagged as
  required when none of it's values has been selected?
 
  Martin Carpentier
 
 

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



Re: [fw-general] Issues with $this-headScript()

2009-11-16 Thread Matthew Weier O'Phinney
-- Ian Warner iwar...@triangle-solutions.com wrote
(on Monday, 16 November 2009, 10:34 PM +0900):
 Stefan
 
 Spot on
 
 However I get this error now:
 Fatal error: Call to undefined method
 Zend_View_Helper_Placeholder_Container::ksort() in
 /content/pringlus/docs/conga/library/Zend/View/Helper/HeadLink.php on
 line 311

This will happen pre 5.2.0 as well, IIRC; ArrayObject only added it at
that point.

 In the toString method:
 
 public function toString($indent = null)
 {
 $indent = (null !== $indent)
 ? $this-getWhitespace($indent)
 : $this-getIndent();
 
 $items = array();
 $this-getContainer()-ksort();
 foreach ($this as $item) {
 $items[] = $this-itemToString($item);
 }
 
 return $indent . implode($this-_escape($this-getSeparator())
 . $indent, $items);
 }
 
 Ian
 
 
 2009/11/16 Stefan Gehrig geh...@ishd.de:
  The problem is that you're doing
 
  echo $this-headScript() . PHP_EOL;
                          ^
                          |
  that's a concatenation --+
 
  That's effectively concat the result from $this-headScript() with an 
  PHP_EOL and echo the result.
  Therefore this is not strictly considered directly combined with echo() or 
  print().
 
  You'd have to do:
  echo $this-headScript();
  echo PHP_EOL;
 
  Best regards
 
  Stefan
 
 
  -Ursprüngliche Nachricht-
  Von: Ian Warner [mailto:iwar...@triangle-solutions.com]
  Gesendet: Montag, 16. November 2009 12:48
  An: Stefan Gehrig
  Betreff: Re: [fw-general] Issues with $this-headScript()
 
  Stefan
 
  appreciate that, indeed this server has 5.1.x on it
 
  However I am doing
  echo $this-headScript() . PHP_EOL;
 
  therefore from the instructions:
 
  It is worth noting that before PHP 5.2.0 the __toString method was
  only called when it was directly combined with echo() or print()
 
  am I not doiing this correctly?
 
  2009/11/16 Stefan Gehrig geh...@ishd.de:
  Hi Ian,
 
  please check your PHP version...
 
  It is worth noting that before PHP 5.2.0 the __toString method was only 
  called when it was directly combined with echo() or print(). Since PHP 
  5.2.0, it is called in any string context (e.g. in printf() with %s 
  modifier) but not in other types contexts (e.g. with %d modifier). [...]
  http://www.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring
 
  __toString will not be called in concatenation-operations prior to PHP 
  5.2.0.
 
  Best regards
 
  Stefan
 
 
  -Ursprüngliche Nachricht-
  Von: Ian Warner [mailto:iwar...@triangle-solutions.com]
  Gesendet: Montag, 16. November 2009 12:28
  An: Zend Framework
  Betreff: [fw-general] Issues with $this-headScript()
 
  Hi
 
  When I use:
  echo $this-headScript() . PHP_EOL;
 
 
  All that prints out is:
  Object id #99
 
  This is a new and unfamiliar server I am deploying on so could be
  anything - but any pointed gratefully received
 
  Ian
 
 
 
 
 

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


Re: [fw-general] Can't prepopulate state of check boxes

2009-11-16 Thread Nick Pack

$radioForm-populate(array('enabled' = $users-active));

You were passing the whole object to the array, not the property you wanted

Kuzma wrote:

Hi all!
I'm trying to prepopulate checkbox.
I've DB table:
CREATE TABLE IF NOT EXISTS `user` (
  `id` tinyint(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  `password` varchar(32) NOT NULL,
  `email` varchar(255) NOT NULL,
  `reg_date` datetime DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
  `group` tinyint(3) NOT NULL DEFAULT '0',
  `superuser` tinyint(1) NOT NULL DEFAULT '0',
  `last_ip` varchar(19) NOT NULL DEFAULT '...',
  `active` tinyint(1) NOT NULL DEFAULT '0',
  `description` text NOT NULL,
  `birth_date` date DEFAULT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=cp1251 AUTO_INCREMENT=19 ;

I've Form class:

class Models_Form_RadioForm extends Zend_Form
{

public function init()  

{

$this-setMethod('post');
$this-setAction('auth/state');

$enabled = new Zend_Form_Element_Checkbox('enabled');

$enabled-setLabel('Group enabled')
-setDecorators(array(
'Label',
'ViewHelper',
'Errors',
array('p' = 'HtmlTag', array('tag' = 'p'))
));
$this-addElement($enabled);
}
}
I've model which returns data from 'active' record:
class Default_DB_User extends Zend_Db_Table_Abstract
{
protected $_name = 'user';
public function getUserData($userId)
{
return
$this-getAdapter()-query($this-select()-from($this-_name, 'active')
-where('id = ?', $userId))-fetch();
}
}
 And finally the main function:

function indexAction()
{

$users = new Default_DB_User();

$this-view-users = $users-fetchAll();

$radioForm = new Models_Form_RadioForm();

$users = $users-getUserData(16);

print_r ($users);

$radioForm-populate(array('enabled' = $users));

$this-view-radioForm = $radioForm;

}

print_r ($users) outputs: stdClass Object ( [active] = 1 )
The CheckBox won't be checked :-(
But $radioForm-populate(array('enabled' = 1)) return checked state
$radioForm-populate(array('enabled' = $users)) won't work...
Any solutions?
Thank you!




[fw-general] Chain Route: Define module, controller, action and parameters after chaining

2009-11-16 Thread Innocentus
I am chaining two routes (a standard route with translated segments and a
simple regex-route) to create a new route.

According to the documentation the module-, controller-, action- and
parameters-settings of the outer route will be used for this new route.
However, I want that the parameters of the inner route are used instead.

Of course I could simply swap both routes so that the inner route becomes
the outer route and vice-versa
- but then the resulting URLs of both routes are also swapped in the final
route.
This I want to avoid because this would draw the new route unusable for my
purposes.

I have also tried a second option: Before I chain both routes I change the
parameters of the outer route.
This works at first glance - but when I use the outer route in more than
only one chain-operation
and I change the outer route-parameters, then those parameters would change
globally in every other chained route where the outer route has been
involved in.

How can I force the use of these mentioned parameters from the inner route
instead from the outer route for the new route?
Sadly there aren't any public methods or properties with which one could
change these parameters of a Chain Route.

Thank you for your answers in advance!
With best regards
Innocentus


Re: [fw-general] Can't prepopulate state of check boxes

2009-11-16 Thread Kuzma

Thank you!
It works perfectly!:jumping:

Now I'm in final stage and can't figure out how to dynamically output
checkboxes with custom name and Id.
I'm doing in that way:
$id=$users-getUsersId();
foreach($id as $key)
{
$radioForm-populate(array('enabled' =
$users-getUserData($key-id)-active, setName=$key-id,
setId=$key-id)
);
}
   $this-view-radioForm = $radioForm;

But it's not giving any result nor custom name and id's. I think it doesn't
work of array...
Thank you!
-- 
View this message in context: 
http://old.nabble.com/Can%27t-prepopulate-state-of-check-boxes-tp26369870p26376534.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Chain Route: Define module, controller, action and parameters after chaining

2009-11-16 Thread Ben Scholzen 'DASPRiD'
You either read wrong or I made a mistake in the documentation: Inner 
routes override the parameters of outer routes.


Innocentus wrote on 16.11.2009 17:56:
I am chaining two routes (a standard route with translated segments and 
a simple regex-route) to create a new route.


According to the documentation the module-, controller-, action- and 
parameters-settings of the outer route will be used for this new route.

However, I want that the parameters of the inner route are used instead.

Of course I could simply swap both routes so that the inner route 
becomes the outer route and vice-versa
- but then the resulting URLs of both routes are also swapped in the 
final route.
This I want to avoid because this would draw the new route unusable for 
my purposes.


I have also tried a second option: Before I chain both routes I change 
the parameters of the outer route.
This works at first glance - but when I use the outer route in more than 
only one chain-operation
and I change the outer route-parameters, then those parameters would 
change globally in every other chained route where the outer route has 
been involved in.


How can I force the use of these mentioned parameters from the inner 
route instead from the outer route for the new route?
Sadly there aren't any public methods or properties with which one could 
change these parameters of a Chain Route.


Thank you for your answers in advance!
With best regards
Innocentus




Re: [fw-general] Zend_Layout and view rendering

2009-11-16 Thread Mon Zafra
I don't know if this is a better way, but you could call
$this-_helper-viewRenderer-setNoRender(false) after the render('sidebar')
call. The noRender flag is always set to true after calling render once. The
behavior is hard coded in the ViewRenderer helper and there's no option to
turn it off.

   -- Mon


On Sun, Nov 15, 2009 at 9:12 PM, Gabriel Malkas gabriel.mal...@gmail.comwrote:

 Hi,

 I use Zend_Layout and I need to render a different 'navbar' accordingly to
 the active action. I simply wrote this in my layout.phtml file :

  ?php echo $this-layout()-sidebar; ?

 Then, in every action that needs to display a sidebar, I have :
 $this-render('sidebar', 'sidebar');

 This works since it renders the sidebar.phtml script, but it doesn't render
 the action-name.phtml script anymore. It's possible to render both scripts
 but I have to add a line :
 $this-render('sidebar', 'sidebar');
 $this-render('index', 'default');

 Now this does exactly what I need, but it's cumbersome since the action's
 script should be rendered automatically anyway. Is it possible ?

 Is there a better way to achieve that ?

 Thanks.
 Regards,
 Gabriel.



[fw-general] Bootstrap Resource usage in model - best practice advice please

2009-11-16 Thread Nick Pack
This is probably a dumb question, but I'm looking for a way to call a 
bootstrap resource from a model (in this case is a Zend_Cache object).


Bootstrap method:

protected function _initCache()
{
$frontendOptions = array(
   'lifetime' = 7200, // cache lifetime of 2 hours
   'automatic_serialization' = true
);

$cachedir = realpath(/path/to/cache');
$backendOptions = array(
'cache_dir' = $cachedir
);

$cache = Zend_Cache::factory('Core',
 'File',
 $frontendOptions,
 $backendOptions);
Zend_Registry::set('Zend_Cache',$cache);
return $cache;
}

Obviously this is set into the registry so I can access it that way, but 
I was wondering if this is the best way to do it, or whether there was 
some way of calling it like you do in a controller:


$this-_cache = $this-getInvokeArg('bootstrap')-getResource('Cache');

or maybe even passing it directly over to the __construct of the model.

Any advice greatly appreciated


Re: [fw-general] Bootstrap Resource usage in model - best practice advice please

2009-11-16 Thread Саша Стаменковић
Hi.

Zend_Controller_Front::getInstance()-getParam('bootstrap')-
getResource('Cache');

But I like

$cache = Zend_Registry::get('Zend_Cache);

it's shorter.

Regards,
Saša Stamenković


On Tue, Nov 17, 2009 at 8:34 AM, Nick Pack n...@nickpack.com wrote:

 This is probably a dumb question, but I'm looking for a way to call a
 bootstrap resource from a model (in this case is a Zend_Cache object).

 Bootstrap method:

protected function _initCache()
{
$frontendOptions = array(
   'lifetime' = 7200, // cache lifetime of 2 hours
   'automatic_serialization' = true
);

$cachedir = realpath(/path/to/cache');
$backendOptions = array(
'cache_dir' = $cachedir
);

$cache = Zend_Cache::factory('Core',
 'File',
 $frontendOptions,
 $backendOptions);
Zend_Registry::set('Zend_Cache',$cache);
return $cache;
}

 Obviously this is set into the registry so I can access it that way, but I
 was wondering if this is the best way to do it, or whether there was some
 way of calling it like you do in a controller:

 $this-_cache = $this-getInvokeArg('bootstrap')-getResource('Cache');

 or maybe even passing it directly over to the __construct of the model.

 Any advice greatly appreciated