2008年8月1日星期五

[fw-mvc] Zend_Form with 1.6rc1

Hi,

With 1.5.x I was used to

$options["id"] = "myform";
parent::__construct($options);

which worked well. With 1.6rc1 this seems not to be possible any more,
the output looks like this:

<form id="">

Was this done by means or is this an issue? If the prior should be the
case, how can I now set the dom element id?

cheers,

Stephan

Re: [fw-db] Why does DB return integers as strings?

Thank you for your patient replies.
--
View this message in context: http://www.nabble.com/Why-does-DB-return-integers-as-strings--tp18777147p18779079.html
Sent from the Zend DB mailing list archive at Nabble.com.

[fw-mvc] [Zend_View] and global view vars best practice?

Hi every body,

I'm bringing back a subject about global view variables which have
already been discussed here
http://www.nabble.com/Why-Zend_View_Helper_Partial-clears-all-assigned-variables-in-cloned-views--td15701331.html


With global view variables I mean view variable setup in the bootstrap
and shared across views and partials. I mostly use them to store the url
of the application assets (css, images, javascript, swf, ...). I find
this method more elegant than using globals or constants.

I did this before partials and placeholder exits.

But now all the view variables are clear in the partials helpers so I
need to overload the partials cloneView() method and with the help of
the Zend_Registry I declare which vars are globals so they are not
cleared. Not very elegant though…

In the above thread Matthew recommend to use the placeholders helper to
be able to use view variables with global space.
But I'm to sure on how to properly use it :

Right now I'm doing something like this in my bootstrap:

$view->urlRoot = 'http://'.$_SERVER['HTTP_HOST'].$appConfig->url->base;
$view->urlAssets = 'http://'.$appConfig->url->assets;
$view->urlImages = $view->urlTheme.'/images';
$view->urlSwf = $view->urlTheme.'/swf';
$view->urlMedias = $view->urlAssets.'/medias';
$view->urlCss = $view->urlTheme.'/css';
$view->urlJs = $view->urlTheme.'/javascript';

So should I do:

1) One placeholder + key

$this->placeholder('Mmx_View_Globals')->urlRoot
$this->placeholder('Mmx_View_Globals')->urlAssets
$this->placeholder('Mmx_View_Globals')->urlTheme
$this->placeholder('Mmx_View_Globals')->urlImages

2) A placeholder for each var

$this->placeholder('urlRoot')
$this->placeholder('urlAssets')
$this->placeholder('urlTheme')
$this->placeholder('urlImages')

3) A special helper which extends
Zend_View_Helper_Placeholder_Container_Standalone

$view->globals()->urlRoot
$view->globals()->urlAssets
$view->globals()->urlTheme;
$view->globals()->urlImages

4) Keep using my current setup

5) Other suggestions?

What are your recommendations ?
I'm curious to know how others tackled this problem too.

Thanks for ridding this topics,

Regards,

--
Laurent Melmoux
Conseil et Solutions Web | laurent@2mx.fr
2mx - Annecy, France | http://www.2mx.fr/

[fw-mvc] Zend_Form:Add image to radio buttons

Hi there,

Here's my code:
$background = new Zend_Form_Element_Radio('background');
$background->setLabel('Background image:');
$background->setMultiOptions(array(
1 => ' /images/1.jpg '
));
The output is:

<label for="background" class="optional">Background image:</label>
<dd>
<label style="white-space: nowrap;">
<input type="radio" name="background" value="1" />&lt;img
src=&quot;/images/1.jpg&quot;&gt;
</label>
</dd>

But I want this:

<label for="background" class="optional">Background image:</label>
<dd>
<label style="white-space: nowrap;">
<input type="radio" name="background" value="1" />' /images/1.jpg
</label>
</dd>


Is it possible in Zend_Form without creating a custom decorator?

Thanks for your help
--
View this message in context: http://www.nabble.com/Zend_Form%3AAdd-image-to-radio-buttons-tp18778620p18778620.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-db] Why does DB return integers as strings?

ardx wrote:
>
> I am new to ZF, and puzzled by the behaviour of Zend_DB with the PDO_MYSQL
> adapter (ZF ver 1.5.3).
>
> When I use it to query a table that has integer type columns, it returns
> the values of the column as strings. Why is that? Is it possible to
> configure it somehow so that integer values are returned as integers?
>

Integers may be 64-bit BIGINT data types, which would exceed the size of the
PHP builtin int type. Zend_Db doesn't query the metadata of result sets, so
it doesn't do any special handling for any SQL data types. String is the
only PHP type that can safely represent every SQL data type.

Regards,
Bill Karwin
--
View this message in context: http://www.nabble.com/Why-does-DB-return-integers-as-strings--tp18777147p18777728.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] Why does DB return integers as strings?

2008/8/1 ardx <ovgray@rogers.com>:
> When I use it to query a table that has integer type columns, it returns the
> values of the column as strings. Why is that? Is it possible to configure it
> somehow so that integer values are returned as integers?

This was the standard behaviour also of the mysql_*() functions of
php. I never figured out an easy way to cast to the right data type. I
presume there's not a unique mapping from mysql data types to php
ones: for example the decimal (11.88 value) that stores an exact value
does not exist in php, that has only float...


--
Giorgio Sironi
Piccolo Principe & Ossigeno Scripter
http://www.sourceforge.net/projects/ossigeno

[fw-db] Why does DB return integers as strings?

I am new to ZF, and puzzled by the behaviour of Zend_DB with the PDO_MYSQL
adapter (ZF ver 1.5.3).

When I use it to query a table that has integer type columns, it returns the
values of the column as strings. Why is that? Is it possible to configure it
somehow so that integer values are returned as integers?
--
View this message in context: http://www.nabble.com/Why-does-DB-return-integers-as-strings--tp18777147p18777147.html
Sent from the Zend DB mailing list archive at Nabble.com.