Re: [fw-general] View helper: Add JavaScript only once

2009-04-03 Thread Matthew Weier O'Phinney
-- Innocentus  wrote
(on Friday, 03 April 2009, 11:39 PM +0200):
> I have a custom view helper which adds tooltips to a view.
> JavaScript is needed for these tooltips so I need to add an external
> JavaScript-file.
> This I want to do when the view helper is called the first time -
> because otherwise it is unnecessary.
> Because I want to add more than only one tooltip I need to prevent
> that this JavaScript-file is added multiple times.
> 
> The JavaScript-file responsible for the tooltips should be added only
> when the tooltip view helper is called and this only once.
> Successive calls of the view helper shouldn't result in adding the
> JavaScript-file multiple times.
> 
> Now I don't know if there is already a mechanism for custom
> view-helpers for doing so.
> Maybe there is already something I could rely on.

Take a look at the placeholders, and how the Dojo and jQuery view
helpers work, as they give you exactly this type of functionality.

What I would suggest is using the headScript() view helper within your
custom view helper, as headScript() also has this built into its
functionality.

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


Re: [fw-general] Where is the documentation for the 1.7 branch ?

2009-04-03 Thread Fabien MARTY
>>-- Fabien MARTY  wrote
>>(on Friday, 03 April 2009, 05:20 PM +0200):
>> The online official manual seems to be built from the documentation
>> "trunk" and not from the "1.7 branch".
>> For example, see my first comment of this issue :
>> http://framework.zend.com/issues/browse/ZF-6107
>> Is it normal ?

> Yes, though we are planning on changing this in the future to prevent
confusion.

ok Matthew

but in your opinion, what is the best (fast ?) solution for this
particular issue :
- to modify the trunk documentation (even there is no problem on it)
- to backport the corresponding trunk change into the 1.7 branch (and
to wait for another release)
- to do nothing and to wait for the change on the online official manual

Regards,

-- 
Fabien MARTY
fabien.ma...@gmail.com


[fw-general] View helper: Add JavaScript only once

2009-04-03 Thread Innocentus
Dear Friends,

I have a custom view helper which adds tooltips to a view.
JavaScript is needed for these tooltips so I need to add an external
JavaScript-file.
This I want to do when the view helper is called the first time -
because otherwise it is unnecessary.
Because I want to add more than only one tooltip I need to prevent
that this JavaScript-file is added multiple times.

The JavaScript-file responsible for the tooltips should be added only
when the tooltip view helper is called and this only once.
Successive calls of the view helper shouldn't result in adding the
JavaScript-file multiple times.

Now I don't know if there is already a mechanism for custom
view-helpers for doing so.
Maybe there is already something I could rely on.

Thank you for answers in advance.
With best regards
Innocentus


[fw-general] Zend_Form | ViewScript decorator path

2009-04-03 Thread Behzad
Hi,
I'm trying to develop a Date-picker element to be used in my Zend_Form-based
forms.
Here's the problem:

$this->addDecorator('ViewScript', array(
'viewScript' => realpath(dirname(__FILE__) .
'/jalali_date.phtml')
));

I can't use absolute paths here.
*Warning: Exception caught by form: script 'C:\...\jalali_date.phtml' not
found in path ...*

I just want to place these kinds of viewscripts in a separate directory, and
I don't want to mix them with the
regular Views. Is there any solution available?

Consider that the Date element is located in *
Behzad/Form/Element/DatePicker.php*, I want
to put the viewscript decorator  in: *
Behzad/Form/Element/viewscripts/DatePicker.phtml*
How can i achieve this?

-- 
Thank you in advance,
-behzad


Re: [fw-general] Where is the documentation for the 1.7 branch ?

2009-04-03 Thread Matthew Weier O'Phinney
-- Fabien MARTY  wrote
(on Friday, 03 April 2009, 05:20 PM +0200):
> The online official manual seems to be built from the documentation
> "trunk" and not from the "1.7 branch".
> 
> For example, see my first comment of this issue :
> 
> http://framework.zend.com/issues/browse/ZF-6107
> 
> Is it normal ?

Yes, though we are planning on changing this in the future to prevent
confusion.

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


[fw-general] Where is the documentation for the 1.7 branch ?

2009-04-03 Thread Fabien MARTY
Hi,

The online official manual seems to be built from the documentation
"trunk" and not from the "1.7 branch".

For example, see my first comment of this issue :

http://framework.zend.com/issues/browse/ZF-6107

Is it normal ?

Thanks

-- 
Fabien MARTY
fabien.ma...@gmail.com


[fw-general] Zend_Filter

2009-04-03 Thread Fire Eye'd Boy

Hi all,

For a CMS I'm building I need to filter the input for a 'page path' 
input field. This input field allows the CMS user to assign custom SEO 
friendly uri (segments) to the page.


I'm thinking about creating my own filter for this. But before I do I 
wanted to consult this group.


What I usually do with this type of thing is, replace all diacritical 
characters with their non diacritical equivalent and special characters 
with their expanded counterparts. This is what I used to use (found some 
time ago on the internet):


// ">>" indicates break for readability
public function replaceDiacriticalChars( $string )
{

 $string = strtr(
  $string,
  "\xA1\xAA\xBA\xBF\xC0\xC1\xC2\xC3\xC5\xC7\xC8\xC9\xCA\xCB\xCC >>
  \xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD\xE0\xE1 >>
  \xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3 >>
  \xF4\xF5\xF8\xF9\xFA\xFB\xFD\xFF",
  "!ao?ACDNOUUUYacdnouuuyy"
 );

 $string = strtr(
  $string,
  array(
   "\xC4" => "Ae",
   "\xC6" => "AE",
   "\xD6" => "Oe",
   "\xDC" => "Ue",
   "\xDE" => "TH",
   "\xDF" => "ss",
   "\xE4" => "ae",
   "\xE6" => "ae",
   "\xF6" => "oe",
   "\xFC" => "ue",
   "\xFE" => "th"
  )
 );

 return $string;

}

This does things like:

input: éèïß
output: eeiss

This does the job pretty good. I usually replace spaces, underscores and 
plus signs with dashes too, etc. But I was wondering:


1. What are the things I should or should not be concirned about when 
creating valid uri's? I mean, is this still a concirn, or do uri's allow 
a much broader spectrum of characters nowadays?


2. Is there already some component or filter in ZF that can create these 
kind of normalized uri's from some input?


Thank you in advance for any insights.



Re: [fw-general] Zend Registry

2009-04-03 Thread Matthew Weier O'Phinney
-- Alexander Johannesen  wrote
(on Friday, 03 April 2009, 07:43 PM +1100):
> It says in the manual that Zend_Registry when used as an introspective
> object has buggy behaviour is some versions of PHP, but it doesn't
> state which versions. If it's like < 5.1.* then it doesn't matter, but
> some clarification would be good.
> 
> $glob = new Zend_Registry( array(), ArrayObject::ARRAY_AS_PROPS ) ;

PHP 5.2.0 specifically. That particular version shipped a broken version
of ArrayObject; releases prior and following work fine.

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


Re: [fw-general] Zend_Loader_Autoloader_Resource

2009-04-03 Thread Matthew Weier O'Phinney
-- keith Pope  wrote
(on Friday, 03 April 2009, 08:41 AM +0100):
> Should the namespace include the _ when defining resource namespaces?
> Like when defining autoloader namespaces?

No. The resource autoloader makes the assumption that ZF standards are
being followed, and automatically adds the '_' for you.

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


[fw-general] Zend Registry

2009-04-03 Thread Alexander Johannesen
Hi,

It says in the manual that Zend_Registry when used as an introspective
object has buggy behaviour is some versions of PHP, but it doesn't
state which versions. If it's like < 5.1.* then it doesn't matter, but
some clarification would be good.

$glob = new Zend_Registry( array(), ArrayObject::ARRAY_AS_PROPS ) ;


Regards,

Alex
-- 
---
 Project Wrangler, SOA, Information Alchemist, UX, RESTafarian, Topic Maps
-- http://shelter.nu/blog/ 


[fw-general] Zend_Loader_Autoloader_Resource

2009-04-03 Thread keith Pope
Should the namespace include the _ when defining resource namespaces?
Like when defining autoloader namespaces?

Thx

Keith