Re: [fw-general] XML RPC calls no longer working in 1.5, possibly due to server introspection?

2008-07-10 Thread David Edwards


Matthew Weier O'Phinney-3 wrote:
 
 -- Jake McGraw [EMAIL PROTECTED] wrote
 (on Wednesday, 09 July 2008, 12:19 PM -0400):
 I believe a lot of folks have been bit by this bug:
 
 http://framework.zend.com/issues/browse/ZF-2978
 
 The solution is posted here:
 
 http://framework.zend.com/issues/browse/ZF-2978?focusedCommentId=20489#action_20489
 
 Doesn't work because $_lastResponse is a private member so try using
 this:
 
 
 Is this still the case for the 1.5.2 release or current trunk? The
 indications on that bug are that it's fixed.
 

From VERSION.txt:

Zend Framework 1.5.2 (revision 9458)

I don't believe this is fixed.

--
Dave
-- 
View this message in context: 
http://www.nabble.com/XML-RPC-calls-no-longer-working-in-1.5%2C-possibly-due-to-server-introspection--tp18363733p18377619.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] What is planned for 1.6?

2008-07-10 Thread Thomas Fritz
I know the deadline was already, but i think it would be very interesting
for people to know that the integration with the Zend Studio is already very
good and will be much better when the Zend_Tool_* things ready. Because i
think that is a big reason for people to use a framework - How good is the
integration in IDEs - Hos fast can we develop with it??.


Best regards

Tom


On Wed, Jul 9, 2008 at 10:27 AM, Ralf Eggert [EMAIL PROTECTED] wrote:

 Hi,

 I am currently writing an article about the actual state of affairs for
 the Zend Framework which will be published in the next edition of the
 German PHP Magazin.

 Now I would like to add a chapter about the plans for the 1.6 release.
 From my notes I got that the MVC testing scaffold and the SOAP support
 is planned to be published in the 1.6 release.

 What else is in the pipe for 1.6?
 Is there any release date planned for 1.6?
 What is the status of the Dojo integration?
 What are the plans for jQuery?

 Since the editorial deadline is tomorrow, it would be nice to get some
 input until then. Thanks.

 Best regards,

 Ralf



[fw-general] Zend Studio Integration [was: Re: [fw-general] What is planned for 1.6?]

2008-07-10 Thread Thorsten Suckow-Homberg
Any information about the benefits I'd have when using Zend Studio with ZF? I'm 
using Eclipse PDT and I rarely experience any advantages...
  I know the deadline was already, but i think it would be very interesting for 
people to know that the integration with the Zend Studio is already very good 
and will be much better when the Zend_Tool_* things ready. Because i think that 
is a big reason for people to use a framework - How good is the integration in 
IDEs - Hos fast can we develop with it??

[fw-general] ZFWiki Development update

2008-07-10 Thread Robert Castley
Hi All,

ZFWiki has moved along v. nicely.  Some major improvements to note:

1) Using the defacto directory structure i.e. css, js etc live in public
2) Better Exception handling throughout
3) Better use of ZF URL helpers (thank you to Matthew on the ZF Mailing
list)
4) Integration of the rather excellent LivePipe javascript libraries.  Now
providing modal dialogs :-)
5) Improved database structure
6) Improved layout and CSS (still IE 6 issues, works fine in FF3 and Safari)
7) Lucene search is updating with new pages correctly
8) PDF/Print export CSS issues now fixed.  PDF support still requires a
patch to ZF Loader.php for all ZF 1.5.x versions
9) Ability to move pages between page groups
10) Integrated Textile Parser to provide Confluence compatible-ish wiki
markup.  Textile help is available at: http://hobix.com/textile/

I would like to say a BIG THANK YOU for those answering my questions on this
mailing list, you have helped no end!

Also, thank to the guys putting together the Quickstart Tutorial and to
Padraic Brady for his excellent blog tutorial, this helped me understand
partial helpers :-)

A new online demo is available at http://rcastley.plus.com - Login in with
any username you like, no password required.

Everything else ZFWiki related can be found over at
http://zfwiki.googlecode.com

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.


[fw-general] Using Zend_Controller_Router_Route for multiple language website

2008-07-10 Thread Rishi Daryanani
Hi all,

Thanks to Syzmone and the rest of the group for helping me get started on 
creating a multiple language website using ZF. However I have a couple of 
problems making this 'efficient' and making my code less redundant.

Here is the kind of thing I want my site to do:

 www.mydomain.com/products/boots/

 www.mydomain.com/products/boots/paola/40/

 www.mydomain.com/products/boots/paola/40/A/
 www.mydomain.com/products/boots/paola/40/A/black/

 www.mydomain.com/nl/products/boots/
 www.mydomain.com/nl/products/boots/paola/40/
 www.mydomain.com/nl/products/boots/paola/40/A/
 www.mydomain.com/nl/products/boots/paola/40/black/

- The above says that an international site code may be passed, or may not. If 
not, the site will load in English. If nl is passed, it will load in Dutch.

- Also the above should call the products action in my index controller in 
all cases. If the product type is boots ,  a boots list page is displayed. If 
the style name (e.g. Paola) is passed, then the detail page for paola is 
passed. Other parameters like shoe size (e.g. 40) width (e.g. A) and colour 
(e.g. black) may also be passed.

Here is my bootstrap file, which sets up the routes:

/* default route */
    $route = new Zend_Controller_Router_Route(
        ':publicsitecode/:action/*',
        array(
            'publicsitecode' = 'uk',
            'controller' = 'index',
        'action' = 'index'
        )
    );
    $router-addRoute('default', $route);

/* Routes to the products action*/
    $route = new Zend_Controller_Router_Route(
        ':publicsitecode/products/:producttype/:style/:size/:width/:colour/*',
        array(
        'controller' = 'index',
            'action' = 'products',
            'publicsitecode' = 'uk',
            'producttype' = 'boots',
            'style'        = '',
            'size'        = 40,
            'width'        = '%',
            'color'        = '%'
        )
    );
    $router-addRoute('products', $route);
    


OK - so what the above should do is match the above URLs, but it doesn't  - 
which means I've misunderstood how this works a bit ;) I think the only way the 
above route will be matched is if I pass a URL like this:

http://www.duo-footwear.com/nl/products/boots/paola/35/A/black/

Now, even if I remove nl from the above, the route does not match, e.g.
http://www.duo-footwear.com/products/boots/paola/35/A/black/
- this goes to the default route and not the products route.

Even if I remove black (the colour) , the route is still not matched.

Therefore, if I understand correctly, I will need to create a new route for 
every possible combination of URL, meaning, for the above 8 URLs, I need to 
create 8 separate routers.

I am fine with this - but if I have missed something and there is indeed a way 
to say this parameter is optional in a route, but the route will still be 
matched if the parameter is missing - then please do reply :)

Many thanks,
Rishi






  

Re: [fw-general] is there a proposal about jquery?

2008-07-10 Thread Tobias Gies
Hi Jacky,

currently, there is no proposal for a jQuery integration. Go ahead and
create one! You should be able to take most of the API for the integration
points from Matthew's Dojo proposals.

Best regards
Tobias

2008/7/10 Jacky Chen [EMAIL PROTECTED]:

 Hi all,

 is there a proposal about jquery? have some one plan to integrate it into
 zend framework? jquery is a wonderful javascript library, in my opinion,
 powerful and easy use, i look forward some one to integrate it into zend
 framework.



[fw-general] Wrapping div's around a Zend_Form

2008-07-10 Thread Stefan Sturm
Hello,

I try to wrap the following div structure around a Zend_Form:

div class=outerform
div class=topdivdiv/div/div
div class=content
!-- Here comes the Form --
/div
div class=bottomdivdiv/div/div
/div

I tried it with this decorators:

$this-setDecorators(
array(
'FormElements',
'Form',
array(array('content' = 'HtmlTag'), array('tag' = 'div', 
'class'
= 'content')),
array(array('top' = 'HtmlTag'), array('tag' = 'div', 'class' 
=
'topdiv', 'placement' = 'prepend') ),
array(array('bottom' = 'HtmlTag'), array('tag' = 'div', 
'class' =
'bottomdiv', 'placement' = 'append')),
array(array('outer' = 'HtmlTag'), array('tag' = 'div', 
'class' =
'outerform')),
)   
);

But this is not exactly what I need. How can I get the empty
div/div inside topdiv and bottom div?

Hope somebody can Help :-)

Greetings,
Stefan Sturm


[fw-general] is there a proposal about jquery?

2008-07-10 Thread Jacky Chen
Hi all,

is there a proposal about jquery? have some one plan to integrate it into
zend framework? jquery is a wonderful javascript library, in my opinion,
powerful and easy use, i look forward some one to integrate it into zend
framework.


Re: [fw-general] Using just Zend_Form

2008-07-10 Thread Julian Davchev
Is the problem that you don't want the extra code of Zend_View or this 
is actually a problem in using it.
Cause all Zend_View will be used for is... rendering the form... witch 
shouldn't interfere with your other stuff.

Not sure how much overload but doubt is that big.


Stefan Sturm wrote:

Hello,

I want to use some of the ZendFramework Components in a new project.
This is no problem with Zend_Cache or Zend_Db, but with Zend_Form...
I there a way to use Zend_Form withot using Zend_View?

Thanks for your Help,
Stefan Sturm
  




[fw-general] Zend_Registry::setFromArray()

2008-07-10 Thread AmirBehzad Eslami
Hi list,
I'm trying to store values from a Zend_Config object into Zend_Registry.

$config = new Zend_Config_Xml(APP_DIR . '/config.xml', $curr_env);
foreach ($config as $key = $value) {
Zend_Registry::set($key, $value);
}

As you see, I'm iterating over $config object to store the values into the
registry.
Is there any plan to implement a special method (perhaps setFromArray()) to
facilitate this action? Is there any other way to store multiple values into
the
registry at once, with a single line of code?


Thank you in advance,
-AmirBehzad


Re: [fw-general] XML RPC calls no longer working in 1.5, possibly due to server introspection?

2008-07-10 Thread David Edwards



David Edwards wrote:
 
 
 Matthew Weier O'Phinney-3 wrote:
 
 -- Jake McGraw [EMAIL PROTECTED] wrote
 (on Wednesday, 09 July 2008, 12:19 PM -0400):
 I believe a lot of folks have been bit by this bug:
 
 http://framework.zend.com/issues/browse/ZF-2978
 
 The solution is posted here:
 
 http://framework.zend.com/issues/browse/ZF-2978?focusedCommentId=20489#action_20489
 
 Doesn't work because $_lastResponse is a private member so try using
 this:
 
 
 Is this still the case for the 1.5.2 release or current trunk? The
 indications on that bug are that it's fixed.
 
 
 From VERSION.txt:
 
 Zend Framework 1.5.2 (revision 9458)
 
 I don't believe this is fixed.
 
 --
 Dave
 
Sorry, it /is/ fixed, in r9307. I was just confused because the revision
number for the latest 1.5.2 release was higher. I thought for a moment that
someone had taken the fix out, or something. Has the fix been merged into
the release branch?

--
Dave
-- 
View this message in context: 
http://www.nabble.com/XML-RPC-calls-no-longer-working-in-1.5%2C-possibly-due-to-server-introspection--tp18363733p18380297.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Setting a view variable in one controller for another controller

2008-07-10 Thread Robert Castley
Hi,
 
I have my indexController and a loadController.  The loadController is set
to not render as it is an ajax call.
 
Without passing params etc. via the URI I would like to be able to set a
view variable in the loadController
that can be used in indexControllers view script.
 
i.e. in loadController I would like to set $this-headTitle($appName);
 
Then in index.phtml for the indexController use ?php echo
$this-headTitle() ?
 
Is this possible?  If so how.
 
TIA,
 
- 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] How to render breadcrumbs using action view helper

2008-07-10 Thread fab2008

Thanks for the advice, I'll keep that in mind.

I used something similar in my admin module to render sidebar, just
inserting in the response in the init method of baseclass Admin controller.
However I had to change this because when using the json helper in some Ajax
action or simply disabling the layout for dynamic pdf output using these
lines:

$this-_helper-layout()-disableLayout();
$this-_helper-viewRenderer-setNoRender();

I still have the sidebar output in the final output.

I don't know if your solution suffers of this defect, I should try.

In every case, for my problem I solved using a view helper in this way

public function breadCrumbs() {
/** @var Zend_Controller_Front */
$fc = Zend_Controller_Front::getInstance();
$action = $fc-getRequest()-getActionName();
$controller = $fc-getRequest()-getControllerName();
$this-view-assign('links', $this-getParts($controller, 
$action));
return $this-view-render('breadcrumbs.phtml');
}

It works and I can use the view script as above.


James Lucas-3 wrote:
 
 Hi,
 
 I was attempting something similar last night. I ended up with the 
 following solution using ActionStack plugin.
 
 In the *Action you add the lines
 
 $this-_helper-actionStack('breadcrumbs','widget');
 $this-_helper-actionStack('sidebar','widget');
 
 This will call these two actions after the initial one is called (I have 
 done this through the init() in a subclass of Zend_Controller_Action 
 which all of my action controllers extend.
 
 In the WidgetController
 
 public function sidebarAction()
 {
 $this-view-module = $this-_getParam('module');
 $this-view-controller = $this-_getParam('controller');
 $this-view-action = $this-_getParam('action');
 
 $this-render(null, 'sidebar');
 }
   
 ...
 
 This will render the view script widget/sidebar.phtml (Or whatever your 
 default is set to) and assign it to the Response object named path 
 segment to use (if this is null then it gets appended to the content 
 segment). In my testing the sidebarAction (and other actions called 
 through Action stack) will have the initial module/controller/action in 
 the parameters of the action (but not in the request object)
 
 Then in your layout you do
 
 ...
 div id=content
 ?=$this-layout()-breadcrumbs?
 div class=startrow
 div class=left
 ?=$this-layout()-content?
 /div
 div class=right
 ?=$this-layout()-sidebar?
 /div
 /div
 /div
 ...
 
 
 However saying all that. Your method might still work if you use the 
 $this-_getParam('module'); inside your breadcrubsAction. It would be 
 interesting how other people have dealt with dynamic content/widgets 
 (breadcrumbs, navigation) also using Zend_Layout.
 
 Cheers,
 James
 
 
 
 fab2008 wrote:
 Hi to everyone, I've almost done with my first ZF project, I used
 Zend_Layout
 for managing website template and I tought that action view helper is the
 right choice to render little blocks of dynamic data present in every
 page
 of the site such as the breadcrumbs and a side menubar. So in my
 layout.phtml file I have these lines:

 ...
 div id=content
 ?=$this-action('breadcrumbs', 'widget')?
 div class=startrow
 div class=left
 ?=$this-layout()-content?
 /div
 div class=right
 ?=$this-action('sidebar', 'widget')?
 /div
 /div
 /div
 ...

 I use the left layout for rendering main content and I wish to render
 breadcrumbs and sidebar using an apposite controller. Now I finished the
 main functional part of the site and when I try to write
 breadcrumbsAction
 of Widget controller, I discovered that getActionName and
 getControllerName
 always return breadcrumbs and widget.

 When I made the layout and the controller structure I tought that I will
 be
 able to detect the controller and action called in bradcrumbs action in
 order to fill the view with the right data, but I was wrong, and now I
 don't
 know how to solve this problem with little modification to all my stuff.

 Any suggestion on how implement this thing.

 Thanks.

   
 
 -- 
 
 James Lucas
 
 
 --
 UTS CRICOS Provider Code:  00099F
 DISCLAIMER: This email message and any accompanying attachments may
 contain
 confidential information.  If you are not the intended recipient, do not
 read, use, disseminate, distribute or copy this message or attachments. 
 If
 you have received this message in error, please notify the sender
 immediately and delete this message. Any views expressed in this message
 are those of the individual sender, except where the sender expressly, and
 with authority, states them to be the views the University of Technology,
 Sydney. Before opening any attachments, please check them for viruses and
 defects.
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-render-breadcrumbs-using-action-view-helper-tp18329592p18381497.html
Sent from the Zend Framework mailing list archive at 

Re: [fw-general] Using just Zend_Form

2008-07-10 Thread Matthew Weier O'Phinney
-- Stefan Sturm [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 07:23 AM +0200):
 I want to use some of the ZendFramework Components in a new project.
 This is no problem with Zend_Cache or Zend_Db, but with Zend_Form...
 I there a way to use Zend_Form withot using Zend_View?

I've answered this a couple times in the past month. Yes, you _can_ use
Zend_Form without Zend_View -- but to do so, you will need to provide
either your own decorators or use the Callback decorator to delegate to
your own methods for rendering the form. This will require more work on
your part.

Personally, I feel Zend_View in itself is a pretty trivial dependency,
You can pass in a completely unconfigured instance at rendering time:

echo $form-render(new Zend_View);

and get all the benefits of our various view helpers without needing to
do a thing. Zend_View itself has no other dependencies (although in 1.6,
it will be utilizing the PluginLoader to load the helpers). Contrary to
what many think, it is not necessary to use the entire MVC to use
Zend_View.

Why is the design like this? Because I like to adhere to the DRY
principle -- and we already had functionality in the various Zend_View
helpers for generating the necessary (X)HTML.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Zend_Registry::setFromArray()

2008-07-10 Thread Matthew Weier O'Phinney
-- AmirBehzad Eslami [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 02:03 PM +0330):
 Hi list,
 I'm trying to store values from a Zend_Config object into Zend_Registry.
 
 $config = new Zend_Config_Xml(APP_DIR . '/config.xml', $curr_env);
 foreach ($config as $key = $value) {
 Zend_Registry::set($key, $value);
 }
 
 As you see, I'm iterating over $config object to store the values into the
 registry.
 Is there any plan to implement a special method (perhaps setFromArray()) to
 facilitate this action? Is there any other way to store multiple values into
 the
 registry at once, with a single line of code?

Umm... why don't you just store the config object in the registry, and
then pull values from there...?

// setting...
Zend_Registry::set('config', $config);

// retrieving...
$env = Zend_Registry::get('config')-env;

This is a much better solution, as then you don't need to worry about
checking to see if various registry keys are set.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] XML RPC calls no longer working in 1.5, possibly due to server introspection?

2008-07-10 Thread Matthew Weier O'Phinney
-- David Edwards [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 03:50 AM -0700):
 David Edwards wrote:
  Matthew Weier O'Phinney-3 wrote:
   
   -- Jake McGraw [EMAIL PROTECTED] wrote
   (on Wednesday, 09 July 2008, 12:19 PM -0400):
I believe a lot of folks have been bit by this bug:

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

The solution is posted here:

http://framework.zend.com/issues/browse/ZF-2978?focusedCommentId=20489#action_20489

Doesn't work because $_lastResponse is a private member so try using
this:
   
   
   Is this still the case for the 1.5.2 release or current trunk? The
   indications on that bug are that it's fixed.
   
  
  From VERSION.txt:
  
  Zend Framework 1.5.2 (revision 9458)
  
  I don't believe this is fixed.
  
  --
  Dave
  
 Sorry, it /is/ fixed, in r9307. I was just confused because the revision
 number for the latest 1.5.2 release was higher. I thought for a moment that
 someone had taken the fix out, or something. Has the fix been merged into
 the release branch?

Ah -- looks like I didn't merge to the release branch as I hadn't had
confirmation that it was fixed prior to that release. I'll do sometime
in the next few days (we will be doing a 1.5.3 release soon).

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] Re: Zend Studio Integration [was: Re: [fw-general] What is planned for 1.6?]

2008-07-10 Thread Thomas Fritz
Hi Thorsten!

I have made a few screenshots. Thats not all, but you should get a little
overview of the benefits. If you want more screenshots let me know. I will
upload them to my gallery.

Heres the Link: http://fritzthomas.com/geillery/Zend+Studio.html

Regards

Tom

On Thu, Jul 10, 2008 at 11:11 AM, Thorsten Suckow-Homberg [EMAIL PROTECTED]
wrote:

  Any information about the benefits I'd have when using Zend Studio with
 ZF? I'm using Eclipse PDT and I rarely experience any advantages...

 I know the deadline was already, but i think it would be very interesting
 for people to know that the integration with the Zend Studio is already very
 good and will be much better when the Zend_Tool_* things ready. Because i
 think that is a big reason for people to use a framework - How good is the
 integration in IDEs - Hos fast can we develop with it??




Re: [fw-general] Re: Zend Studio Integration [was: Re: [fw-general] What is planned for 1.6?]

2008-07-10 Thread Thorsten Suckow-Homberg
Hi Thomas,

thanks for the effort!

Guess I'll try out the new Studio version then, though I have to admit that my 
development cycles are quicker when using UltraEdit. Everything else feels 
clumsy, IMHO.

Regards

Thorsten

- Original Message - 
  From: Thomas Fritz 
  To: Thorsten Suckow-Homberg 
  Cc: fw-general@lists.zend.com 
  Sent: Thursday, July 10, 2008 3:07 PM
  Subject: [fw-general] Re: Zend Studio Integration [was: Re: [fw-general] What 
is planned for 1.6?]


  Hi Thorsten!

  I have made a few screenshots. Thats not all, but you should get a little 
overview of the benefits. If you want more screenshots let me know. I will 
upload them to my gallery.

  Heres the Link: http://fritzthomas.com/geillery/Zend+Studio.html

  Regards

  Tom


  On Thu, Jul 10, 2008 at 11:11 AM, Thorsten Suckow-Homberg [EMAIL PROTECTED] 
wrote:

Any information about the benefits I'd have when using Zend Studio with ZF? 
I'm using Eclipse PDT and I rarely experience any advantages...
  I know the deadline was already, but i think it would be very interesting 
for people to know that the integration with the Zend Studio is already very 
good and will be much better when the Zend_Tool_* things ready. Because i think 
that is a big reason for people to use a framework - How good is the 
integration in IDEs - Hos fast can we develop with it??



Re: [fw-general] Zend_Registry::setFromArray()

2008-07-10 Thread AmirBehzad Eslami
 why don't you just store the config object in the registry, and
 then pull values from there...?

Actually I was using the approach you mentioned above,
until I realized that it requires more memory, since an entire
instance of Zend_Config is stored into Zend_Registry.
So I decided to store only config's _DATA_ into
Zend_Registry to save the mem.

By the way, I found a way to store config's key-value pairs at once
into Zend_Registry (thanks to the Zend_Registy for extending
ArrayObject).

Zend_Registry::setInstance(
new Zend_Registry($config-toArray()));
unset($config);

 This is a much better solution [storing the config object in the registry
],
 as then you don't need to worry about checking to see if various
 registry keys are set.
I don't see how. Even I have a config object, I can't be 100%-certain about
existence of its key/value pairs. Perhaps the config file lacks a key.
Would you please explain a little more. Maybe I'm missing something.

Thanks you,
AmirBehzad


On Thu, Jul 10, 2008 at 4:20 PM, Matthew Weier O'Phinney [EMAIL PROTECTED]
wrote:

 -- AmirBehzad Eslami [EMAIL PROTECTED] wrote
 (on Thursday, 10 July 2008, 02:03 PM +0330):
  Hi list,
  I'm trying to store values from a Zend_Config object into Zend_Registry.
 
  $config = new Zend_Config_Xml(APP_DIR . '/config.xml', $curr_env);
  foreach ($config as $key = $value) {
  Zend_Registry::set($key, $value);
  }
 
  As you see, I'm iterating over $config object to store the values into
 the
  registry.
  Is there any plan to implement a special method (perhaps setFromArray())
 to
  facilitate this action? Is there any other way to store multiple values
 into
  the
  registry at once, with a single line of code?

 Umm... why don't you just store the config object in the registry, and
 then pull values from there...?

// setting...
Zend_Registry::set('config', $config);

// retrieving...
$env = Zend_Registry::get('config')-env;

 This is a much better solution, as then you don't need to worry about
 checking to see if various registry keys are set.

 --
 Matthew Weier O'Phinney
 Software Architect   | [EMAIL PROTECTED]
 Zend Framework   | http://framework.zend.com/




-- 
Kind regards,
-behzad


RE: [fw-general] Re: Re[fw-general] direct Question

2008-07-10 Thread Robert Castley
Hi,

I am successfully using $this-_helper-url in my controller but it's syntax
seems to differ from the view version.

In a view I can do:

$this-url(array('pageTitle'= $this-title, 'groupKey' = $this-groupKey),
'view');

If I try this in a controller e.g.

$this-_helper-url(array('pageTitle'= $this-title, 'groupKey' =
$this-groupKey), 'view');

I get the following:

/view/Array in my view

The only way I can get it to work is by doing:

echo $this-_helper-url($this-title, this-groupKey, 'view');

Is this correct?

Cheers,
- Robert


-Original Message-
From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
Sent: 08 July 2008 17:51
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Re: Re[fw-general] direct Question

-- Robert Castley [EMAIL PROTECTED] wrote (on Tuesday, 08 July
2008, 05:05 PM +0100):
 I am having a similar problem.  In my controller I would like to specify a
URL.
 
 Currently I am using: $this-view-saveUrl = $this-_baseUrl . '/save/' .
 $this-_groupKey . '/' . $this-_pageTitle;
 
 I tried the redirector approach but obviously that redirects straight
away.
 
 Is there another method to build up urls in the controller.  Much akin 
 to the $this-url in the view.

Yes -- there is a url() action helper that works just like its cousin in the
view helpers:

$this-view-saveUrl = $this-_helper-url(...);


 -Original Message-
 From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED]
 Sent: 08 July 2008 16:18
 To: fw-general@lists.zend.com
 Subject: Re: [fw-general] Re: Re[fw-general] direct Question
 
 -- monk.e.boy [EMAIL PROTECTED] wrote (on Tuesday, 08 July 
 2008,
 07:36 AM -0700):
  Matthew Weier O'Phinney-3 wrote:
  
  
   Use the redirector instead of constructing the URL yourself:
  
   $this-_helper-redirector('project');
  
   This will do the same as what you were trying to accomplish before.
   --
   Matthew Weier O'Phinney
  
  
 
  Matt,
 
Thanks for the promp reply!
 
Does the redirector act like the URL constructor? My URL looks like
this:
 
/base/application/report/customer/33/project/12/report/99/
 
  Doing this:
$this-_helper-redirector('report')
 
  takes me to:
/base/application/report/
 
  How do you suggest I build and pass the URL above to the redirector?
 
 If you want to do url()-like redirection, use the gotoRoute() method 
 of the
 redirector:
 
 $this-_helper-redirector-gotoRoute(array('action' = 
 'project'));
 
 It takes the same arguments as the url() view helper, and builds using 
 the same mechanisms.
 
  At the
  moment I do a lot of:
 
  '/base/application/report/customer/'. $this-_getParam( 'customer' )
.'/'.
  $this-_getParam( 'project' ) .'/report/'. $this-_getParam( 'report'
  )
 
  which makes me feel icky :-(
 
 --
 Matthew Weier O'Phinney
 Software Architect   | [EMAIL PROTECTED]
 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.
 __
 __

--
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
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.


[fw-general] Zend_Form validator substr_compare error

2008-07-10 Thread Sam Davey

Hi,

I'm using Zend_Form and defining an element as follows:

$this-addElement('text', 'username', array(
'validators' = array('alnum'),
'decorators' = $this-_themedTextDecorator,
'label' = 'Name',
'required' = true,
'class'='theme',
));

The form validators are triggered correctly... but I am presented with the
following errors.  If I add another validator to the 'validators' array the
error is repeated again.

Warning: substr_compare() [function.substr-compare]: The start position
cannot exceed initial string length in
/home/sam/dolphin2008.co.uk/application/library/Zend/Form/Element.php on
line 1097

Why is this?  Am I defining the validator wrong?

Looking at the library code this is the code causing the problem
public function getValidator($name)
{
if (!isset($this-_validators[$name])) {
$validators = array_keys($this-_validators);
$len = strlen($name);
foreach ($validators as $validator) {
if (0 === substr_compare($validator, $name, -$len, $len,
true)) {
return $this-_validators[$validator];
}
}
return false;
}

return $this-_validators[$name];
}

Where is the $name coming from because its not from the 'validators'
array... that sets the $validator string it compares against.

Any ideas?

The following post suggest suppressing the error but I don't want to start
editing the library files.

http://www.mail-archive.com/fw-general@lists.zend.com/msg12912.html

Thanks,

Sam
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-validator-substr_compare-error-tp18382953p18382953.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Registry::setFromArray()

2008-07-10 Thread Matthew Weier O'Phinney
-- AmirBehzad Eslami [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 04:54 PM +0330):
  why don't you just store the config object in the registry, and
  then pull values from there...?
 
 Actually I was using the approach you mentioned above,
 until I realized that it requires more memory, since an entire
 instance of Zend_Config is stored into Zend_Registry.
 So I decided to store only config's _DATA_ into
 Zend_Registry to save the mem.

A Zend_Config should not take up enough memory that you need to be
worried about it -- certainly it would be only slightly more than
storing the data directly in the registry. This is smelling a bit of
premature optimization.

 By the way, I found a way to store config's key-value pairs at once
 into Zend_Registry (thanks to the Zend_Registy for extending
 ArrayObject).
 
 Zend_Registry::setInstance(
 new Zend_Registry($config-toArray()));
 unset($config);

The problem with the above approach is if you've set any registry items
previously -- though my guess is this would be unlikely.

  This is a much better solution [storing the config object in the registry],
  as then you don't need to worry about checking to see if various
  registry keys are set.
 I don't see how. Even I have a config object, I can't be 100%-certain about
 existence of its key/value pairs. Perhaps the config file lacks a key.
 Would you please explain a little more. Maybe I'm missing something.

If the key does not exist in the config object, then it simply returns a
null. With the registry, if the key does not exist, get() will throw an
exception -- which is why you typically need to check with
isRegistered() prior to pulling values from the Registry.


 On Thu, Jul 10, 2008 at 4:20 PM, Matthew Weier O'Phinney [EMAIL PROTECTED]
 wrote:
 
 -- AmirBehzad Eslami [EMAIL PROTECTED] wrote
 (on Thursday, 10 July 2008, 02:03 PM +0330):
  Hi list,
  I'm trying to store values from a Zend_Config object into Zend_Registry.
 
  $config = new Zend_Config_Xml(APP_DIR . '/config.xml', $curr_env);
  foreach ($config as $key = $value) {
  Zend_Registry::set($key, $value);
  }
 
  As you see, I'm iterating over $config object to store the values into
 the
  registry.
  Is there any plan to implement a special method (perhaps setFromArray())
 to
  facilitate this action? Is there any other way to store multiple values
 into
  the
  registry at once, with a single line of code?
 
 Umm... why don't you just store the config object in the registry, and
 then pull values from there...?
 
// setting...
Zend_Registry::set('config', $config);
 
// retrieving...
$env = Zend_Registry::get('config')-env;
 
 This is a much better solution, as then you don't need to worry about
 checking to see if various registry keys are set.
 
 --
 Matthew Weier O'Phinney
 Software Architect   | [EMAIL PROTECTED]
 Zend Framework   | http://framework.zend.com/
 
 
 
 
 --
 Kind regards,
 -behzad

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Zend_Form validator substr_compare error

2008-07-10 Thread Matthew Weier O'Phinney
-- Sam Davey [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 06:46 AM -0700):
 I'm using Zend_Form and defining an element as follows:
 
 $this-addElement('text', 'username', array(
 'validators' = array('alnum'),
 'decorators' = $this-_themedTextDecorator,
 'label' = 'Name',
   'required' = true,
   'class'='theme',
 ));
 
 The form validators are triggered correctly... but I am presented with the
 following errors.  If I add another validator to the 'validators' array the
 error is repeated again.
 
 Warning: substr_compare() [function.substr-compare]: The start position
 cannot exceed initial string length in
 /home/sam/dolphin2008.co.uk/application/library/Zend/Form/Element.php on
 line 1097
 
 Why is this?  Am I defining the validator wrong?

Please try using a current version from svn; I believe this should be
fixed at this point.


 Looking at the library code this is the code causing the problem
 public function getValidator($name)
 {
 if (!isset($this-_validators[$name])) {
 $validators = array_keys($this-_validators);
 $len = strlen($name);
 foreach ($validators as $validator) {
 if (0 === substr_compare($validator, $name, -$len, $len,
 true)) {
 return $this-_validators[$validator];
 }
 }
 return false;
 }
 
 return $this-_validators[$name];
 }
 
 Where is the $name coming from because its not from the 'validators'
 array... that sets the $validator string it compares against.
 
 Any ideas?
 
 The following post suggest suppressing the error but I don't want to start
 editing the library files.
 
 http://www.mail-archive.com/fw-general@lists.zend.com/msg12912.html

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] Re[fw-general] nder form in partialLoop view.

2008-07-10 Thread etopian

Hi,

I've split up my view to make it more DRY. So iterating through an array
using the partialLoop(). However; inside the partialLoop view, there's a
form which needs to be rendered. In the original view it was render like:

$this-activeForm-render();

But in the partialLoop $this refers to the array of rows that need to be
iterated and not the variable of the view containing the form.

Is there a way to render the form inside the partial view?
-- 
View this message in context: 
http://www.nabble.com/Render-form-in-partialLoop-view.-tp18384545p18384545.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Registry::setFromArray()

2008-07-10 Thread Matthew Ratzloff

 Actually I was using the approach you mentioned above, until I realized
 that it requires more memory, since an entire instance of Zend_Config is
 stored into Zend_Registry. So I decided to store only config's _DATA_
 into Zend_Registry to save the mem.


Are you writing code for the Atari 800?  ;-)
The solution Matthew posted is much more readable and easier to debug for
other developers who may take over your project later.
-Matt

On Thu, Jul 10, 2008 at 6:24 AM, AmirBehzad Eslami [EMAIL PROTECTED]
wrote:

  why don't you just store the config object in the registry, and
  then pull values from there...?

 Actually I was using the approach you mentioned above,
 until I realized that it requires more memory, since an entire
 instance of Zend_Config is stored into Zend_Registry.
 So I decided to store only config's _DATA_ into
 Zend_Registry to save the mem.

 By the way, I found a way to store config's key-value pairs at once
 into Zend_Registry (thanks to the Zend_Registy for extending
 ArrayObject).

 Zend_Registry::setInstance(
 new Zend_Registry($config-toArray()));
 unset($config);

  This is a much better solution [storing the config object in the
 registry],
  as then you don't need to worry about
 checking to see if various
  registry keys are set.
 I don't see how. Even I have a config object, I can't be 100%-certain about
 existence of its key/value pairs. Perhaps the config file lacks a key.
 Would you please explain a little more. Maybe I'm missing something.

 Thanks you,
 AmirBehzad



 On Thu, Jul 10, 2008 at 4:20 PM, Matthew Weier O'Phinney [EMAIL PROTECTED]
 wrote:

 -- AmirBehzad Eslami [EMAIL PROTECTED] wrote
 (on Thursday, 10 July 2008, 02:03 PM +0330):
  Hi list,
  I'm trying to store values from a Zend_Config object into Zend_Registry.
 
  $config = new Zend_Config_Xml(APP_DIR . '/config.xml', $curr_env);
  foreach ($config as $key = $value) {
  Zend_Registry::set($key, $value);
  }
 
  As you see, I'm iterating over $config object to store the values into
 the
  registry.
  Is there any plan to implement a special method (perhaps setFromArray())
 to
  facilitate this action? Is there any other way to store multiple values
 into
  the
  registry at once, with a single line of code?

 Umm... why don't you just store the config object in the registry, and
 then pull values from there...?

// setting...
Zend_Registry::set('config', $config);

// retrieving...
$env = Zend_Registry::get('config')-env;

 This is a much better solution, as then you don't need to worry about
 checking to see if various registry keys are set.

 --
 Matthew Weier O'Phinney
 Software Architect   | [EMAIL PROTECTED]
 Zend Framework   | http://framework.zend.com/




 --
 Kind regards,
 -behzad


[fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread maxarbos

Hello,

Is ti possible to run Zend_ACL without the MVC portion?
I also need it to work with a pretty much all ajax type site.

Any feedback would be great.
Thanks.

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18385583.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread Matthew Weier O'Phinney
-- maxarbos [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 09:05 AM -0700):
 Is ti possible to run Zend_ACL without the MVC portion?
 I also need it to work with a pretty much all ajax type site.

Zend_Acl is a standalone component and has no ties to the MVC. Use it
however you desire. :)

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread maxarbos

yeah, that was what I was thinking, but now how do you implelemnt it?

When we were using the MVC, the controller and action where declared in the
url and the mvc took care of breaking that up and the acl determined which
resource had which priv.

So when I have a class 'User.php' with methods such as: 'editAccount',
'addNumber', etc...  do I just need to now include Zend_ACL_Resoure in the
construct and assign a name to the class like :

__construct($resource) {
   new Zend_Acl_Resource-getResourceId('user');
}


Do the methods still need to be named 'editAction', 'addnumberAction'?

I'm just a little unclear how to register the classes as resources I guess.

thanks.




Matthew Weier O'Phinney-3 wrote:
 
 -- maxarbos [EMAIL PROTECTED] wrote
 (on Thursday, 10 July 2008, 09:05 AM -0700):
 Is ti possible to run Zend_ACL without the MVC portion?
 I also need it to work with a pretty much all ajax type site.
 
 Zend_Acl is a standalone component and has no ties to the MVC. Use it
 however you desire. :)
 
 -- 
 Matthew Weier O'Phinney
 Software Architect   | [EMAIL PROTECTED]
 Zend Framework   | http://framework.zend.com/
 
 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18388057.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread Matthew Weier O'Phinney
-- maxarbos [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 10:34 AM -0700):
 yeah, that was what I was thinking, but now how do you implelemnt it?
 
 When we were using the MVC, the controller and action where declared in the
 url and the mvc took care of breaking that up and the acl determined which
 resource had which priv.
 
 So when I have a class 'User.php' with methods such as: 'editAccount',
 'addNumber', etc...  do I just need to now include Zend_ACL_Resoure in the
 construct and assign a name to the class like :
 
 __construct($resource) {
new Zend_Acl_Resource-getResourceId('user');
 }
 
 
 Do the methods still need to be named 'editAction', 'addnumberAction'?
 
 I'm just a little unclear how to register the classes as resources I guess.

Resources are, quite simply, just names. So, it's pretty easy:

  * Define your resources (classes)
  * Assign rights (method names) to resources (classes) per role

Then, in your methods, you could do something like:

if (!$this-acl-isAllowed($this-user, __CLASS__, __FUNCTION__)) {
throw new Exception('ACCESS DENIED!');
}

(assuming that $this-acl is your Zend_Acl object, and $this-user is a
user corresponding to a role in the ACL list)

Read through the Zend_Acl manual pages -- they make no mention of MVC,
and should help clarify what I'm getting at.


 Matthew Weier O'Phinney-3 wrote:
  
  -- maxarbos [EMAIL PROTECTED] wrote
  (on Thursday, 10 July 2008, 09:05 AM -0700):
  Is ti possible to run Zend_ACL without the MVC portion?
  I also need it to work with a pretty much all ajax type site.
  
  Zend_Acl is a standalone component and has no ties to the MVC. Use it
  however you desire. :)
  
  -- 
  Matthew Weier O'Phinney
  Software Architect   | [EMAIL PROTECTED]
  Zend Framework   | http://framework.zend.com/
  
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18388057.html
 Sent from the Zend Framework mailing list archive at Nabble.com.
 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread maxarbos

I feel like I understand but dont seem o get thsi to work.

Here is my main page:

require_once 'Zend/Acl.php';
$acl=new Zend_Acl();

require_once 'Test.php';
$test = new Test($acl);

require_once('Zend/Acl/Role.php');
$acl-addRole(new Zend_Acl_Role('guest'))
-addRole(new Zend_Acl_Role('member'));

require_once('Zend/Acl/Resource.php');
$acl-add(new Zend_Acl_Resource('test'));

$acl-deny('guest', 'test');
$acl-allow('member', 'test');

echo $acl-isAllowed('guest', 'test') ? 'allowed' : 'denied';

echo $test-echoHello();


I am trying to deny the echoHello from happening.

Here is my Test.php class

require_once 'Zend/Acl/Resource/Interface.php';
class Test implements Zend_Acl_Resource_Interface
{

public function __construct(Zend_Acl $acl) {
$this-_acl = $acl;
}


public function getResourceId()
{
return 'test';
}

public function echoHello(){

if (!$this-_acl-isAllowed('guest', __CLASS__, __FUNCTION__)) {
throw new Exception('ACCESS DENIED!');
}

return 'hello';
}

}

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18389571.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread Terre Porter
Move this 

require_once 'Test.php';
$test = new Test($acl);

under

$acl-allow('member', 'test');

Terre

-Original Message-
From: maxarbos [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2008 2:59 PM
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Is it possible to use Zend_ACL without MVC


I feel like I understand but dont seem o get thsi to work.

Here is my main page:

require_once 'Zend/Acl.php';
$acl=new Zend_Acl();

require_once 'Test.php';
$test = new Test($acl);

require_once('Zend/Acl/Role.php');
$acl-addRole(new Zend_Acl_Role('guest'))
-addRole(new Zend_Acl_Role('member'));

require_once('Zend/Acl/Resource.php');
$acl-add(new Zend_Acl_Resource('test'));

$acl-deny('guest', 'test');
$acl-allow('member', 'test');

echo $acl-isAllowed('guest', 'test') ? 'allowed' : 'denied';

echo $test-echoHello();


I am trying to deny the echoHello from happening.

Here is my Test.php class

require_once 'Zend/Acl/Resource/Interface.php';
class Test implements Zend_Acl_Resource_Interface {

public function __construct(Zend_Acl $acl) {
$this-_acl = $acl;
}


public function getResourceId()
{
return 'test';
}

public function echoHello(){

if (!$this-_acl-isAllowed('guest', __CLASS__, __FUNCTION__)) {
throw new Exception('ACCESS DENIED!');
}

return 'hello';
}

}

--
View this message in context:
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p
18389571.html
Sent from the Zend Framework mailing list archive at Nabble.com.




Re: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread Matthew Weier O'Phinney
-- maxarbos [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 11:58 AM -0700):
 I feel like I understand but dont seem o get thsi to work.
 
 Here is my main page:
 
 require_once 'Zend/Acl.php';
 $acl=new Zend_Acl();
 
 require_once 'Test.php';
 $test = new Test($acl);
 
 require_once('Zend/Acl/Role.php');
 $acl-addRole(new Zend_Acl_Role('guest'))
   -addRole(new Zend_Acl_Role('member'));
 
 require_once('Zend/Acl/Resource.php');
 $acl-add(new Zend_Acl_Resource('test'));

Resources, roles, and rights are case sensitive. Change your resource
name to 'Test' instead of 'test'.


 $acl-deny('guest', 'test');
 $acl-allow('member', 'test');
 
 echo $acl-isAllowed('guest', 'test') ? 'allowed' : 'denied';
 
 echo $test-echoHello();
 
 
 I am trying to deny the echoHello from happening.
 
 Here is my Test.php class
 
 require_once 'Zend/Acl/Resource/Interface.php';
 class Test implements Zend_Acl_Resource_Interface
 {
 
   public function __construct(Zend_Acl $acl) {
   $this-_acl = $acl;
   }
 
 
 public function getResourceId()
 {
 return 'test';
 }
 
   public function echoHello(){
 
   if (!$this-_acl-isAllowed('guest', __CLASS__, __FUNCTION__)) {
   throw new Exception('ACCESS DENIED!');
   }
 
   return 'hello';
   }
 
 }

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


RE: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread maxarbos

still getting the same error:

denied
Fatal error: Uncaught exception 'Zend_Acl_Exception' with message 'Resource
'Test' not found' 
in /xxx/Zend/Acl.php:297 
Stack trace: 
#0 /xxx/Zend/Acl.php(691): Zend_Acl-get('Test') 
#1 //admin/Test.php(24): 
Zend_Acl-isAllowed('guest', 'Test', 'echoHello') 
#2 /xxx/admin/index.php(50): Test-echoHello() 
#3 {main} thrown in /xxx/Zend/Acl.php on line 297



vRandom wrote:
 
 Move this 
 
 require_once 'Test.php';
 $test = new Test($acl);
 
 under
 
 $acl-allow('member', 'test');
 
 Terre
 
 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18390278.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread maxarbos

I think I got it.

I needed to change the resource name to caplital 'Test'

So I just need to add the check within every method?
Seems a bit susceptible to errors.




maxarbos wrote:
 
 still getting the same error:
 
 denied
 Fatal error: Uncaught exception 'Zend_Acl_Exception' with message
 'Resource 'Test' not found' 
 in /xxx/Zend/Acl.php:297 
 Stack trace: 
 #0 /xxx/Zend/Acl.php(691): Zend_Acl-get('Test') 
 #1 //admin/Test.php(24): 
 Zend_Acl-isAllowed('guest', 'Test', 'echoHello') 
 #2 /xxx/admin/index.php(50): Test-echoHello() 
 #3 {main} thrown in /xxx/Zend/Acl.php on line 297
 
 
 
 vRandom wrote:
 
 Move this 
 
 require_once 'Test.php';
 $test = new Test($acl);
 
 under
 
 $acl-allow('member', 'test');
 
 Terre
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18390545.html
Sent from the Zend Framework mailing list archive at Nabble.com.



RE: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread Terre Porter

Here is the code I was playing with for you to compare:

[code]
require_once 'Zend/Acl.php';
$acl=new Zend_Acl();
  
require_once('Zend/Acl/Role.php');
$acl-addRole(new Zend_Acl_Role('guest'))
-addRole(new Zend_Acl_Role('member'));

require_once('Zend/Acl/Resource.php');
$acl-add(new Zend_Acl_Resource('test'));

$acl-deny('guest', 'test');
$acl-allow('member', 'test');

echo $acl-isAllowed('guest', 'test') ? 'allowed' : 'denied';

//require_once 'Test.php';
//---   embeded for one file testing
require_once 'Zend/Acl/Resource/Interface.php';
class test implements Zend_Acl_Resource_Interface {

public function __construct(Zend_Acl $acl) {
$this-_acl = $acl; 
}

public function getResourceId()
{
return 'test';
}

public function echoHello(){

if (!$this-_acl-isAllowed('guest', __CLASS__,
__FUNCTION__)) {
throw new Exception('ACCESS DENIED!');

}

return 'hello';
}   
}
// 

// create test class
$test = new test($acl); 

// catch exceptions
try {
echo $test-echoHello();
} catch (Exception $e) {
// do something with the triggered exception
echo 'an unexpected error occured.';
echo 'h2Unexpected Exception: ' . $e-getMessage() . '/h2br
/pre';
echo $e-getTraceAsString();
}  
[/code]

Your not passing any type of current user role to this class, it will always
return the exception.

Something like this :

public function echoHello($myRole = 'guest'){

if (!$this-_acl-isAllowed(myRole , __CLASS__,
__FUNCTION__)) {
throw new Exception('ACCESS DENIED!');

}

return 'hello';
}   

Then in the function call pass the role to be used...

// whats this current user/page load group
// Should match a roles defined in the acl
$thisUsersRole = 'member' ; //? Member or guest or etc...

echo $test-echoHello($thisUsersRole);

Only problem is if the role doesn't exists, I think it will throw an
error... Just incase, might need to put in a hasRole check before the
isAllowed. I think this page has the info on the hasRole, or its in there
somewhere, http://framework.zend.com/manual/en/zend.acl.html

Also, just out of curiosity, is this part really needed for this?

---
require_once 'Zend/Acl/Resource/Interface.php';
class Test implements Zend_Acl_Resource_Interface {
--

Since the acl is passed as an object var to the class I don't see that it's
used. 

This should work with less overhead.
--
Class Test () {
--

Hope that all makes sence...

Terre

-Original Message-
From: maxarbos [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2008 3:36 PM
To: fw-general@lists.zend.com
Subject: RE: [fw-general] Is it possible to use Zend_ACL without MVC


still getting the same error:

denied
Fatal error: Uncaught exception 'Zend_Acl_Exception' with message 'Resource
'Test' not found' 
in /xxx/Zend/Acl.php:297
Stack trace: 
#0 /xxx/Zend/Acl.php(691): Zend_Acl-get('Test')
#1 //admin/Test.php(24): 
Zend_Acl-isAllowed('guest', 'Test', 'echoHello')
#2 /xxx/admin/index.php(50): Test-echoHello()
#3 {main} thrown in /xxx/Zend/Acl.php on line 297



vRandom wrote:
 
 Move this
 
 require_once 'Test.php';
 $test = new Test($acl);
 
 under
 
 $acl-allow('member', 'test');
 
 Terre
 
 

--
View this message in context:
http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p
18390278.html
Sent from the Zend Framework mailing list archive at Nabble.com.




RE: [fw-general] Re: Zend Studio Integration [was: Re: [fw-general] What is planned for 1.6?]

2008-07-10 Thread Wil Sinclair
Thorsten, most of the Zend Framework integration in Studio are
value-adds over PDT, so I wouldn't be surprised if you don't find many
ZF-specific features in that project. This is a great opportunity to
tell everyone what our philosophy is regarding the relationship between
Zend Framework and Zend's commercial products. We believe what is best
for our community is also best for Zend. With that in mind, we have no
intention to release major functionality that is of use to the general
community in ZF that requires a commercial license.

Our strategy is to provide value-adds in the commercial products
themselves that make them irresistible to all you ZF developers and
deployers. J We may ship major performance enhancements that cannot be
made in the framework itself. We certainly will provide tools to easily
use ZF with our commercial products. We will provide improved interfaces
to ZF features. I could even see certain value adds that could be added
to our web properties in the future. Please note, these features will be
implemented in our products and/or web properties themselves, and are
not really ZF features as such.

A perfect example is the Zend_Tool feature. We provide all the
functionality in ZF itself. But you can count on an advanced interface
available in Zend Studio down the line (provided the community approves
of the component and it is promoted to standard library). The current
Zend Studio integration, which is very cool BTW- I use it constantly-
reflects this strategy.

 

Not the answer you were looking for, but maybe you'll find it
interesting anyways. J

 

,Wil

 

From: Thomas Fritz [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 10, 2008 6:08 AM
To: Thorsten Suckow-Homberg
Cc: fw-general@lists.zend.com
Subject: [fw-general] Re: Zend Studio Integration [was: Re: [fw-general]
What is planned for 1.6?]

 

Hi Thorsten!

I have made a few screenshots. Thats not all, but you should get a
little overview of the benefits. If you want more screenshots let me
know. I will upload them to my gallery.

Heres the Link: http://fritzthomas.com/geillery/Zend+Studio.html

Regards

Tom

On Thu, Jul 10, 2008 at 11:11 AM, Thorsten Suckow-Homberg
[EMAIL PROTECTED] wrote:

Any information about the benefits I'd have when using Zend Studio with
ZF? I'm using Eclipse PDT and I rarely experience any advantages...

I know the deadline was already, but i think it would be very
interesting for people to know that the integration with the Zend Studio
is already very good and will be much better when the Zend_Tool_* things
ready. Because i think that is a big reason for people to use a
framework - How good is the integration in IDEs - Hos fast can we
develop with it??

 



Re: [fw-general] Is it possible to use Zend_ACL without MVC

2008-07-10 Thread Matthew Weier O'Phinney
-- maxarbos [EMAIL PROTECTED] wrote
(on Thursday, 10 July 2008, 12:53 PM -0700):
 
 I think I got it.
 
 I needed to change the resource name to caplital 'Test'
 
 So I just need to add the check within every method?
 Seems a bit susceptible to errors.

The other possibility is to make those methods protected and prefix them
with a '_', and add proxying via __call():

protected function _echoHello()
{
echo 'Hello!';
}

public function __call($method, $args)
{
if (method_exists($this, '_' . $method)) {
if (!$this-acl-isAllowed($this-user, __CLASS__, $method)) {
throw new Exception('Access denied');
}
return call_user_func_array(array($this, '_' . $method), $args);
}

throw new Exception(sprintf('Invalid method %s', $method));
}

Any method that doesn't need ACL checks can then simply be declared
public.

This _will_ have a performance hit (both from overloading and from using
call_user_func_array()), but it will automate things.


 maxarbos wrote:
  
  still getting the same error:
  
  denied
  Fatal error: Uncaught exception 'Zend_Acl_Exception' with message
  'Resource 'Test' not found' 
  in /xxx/Zend/Acl.php:297 
  Stack trace: 
  #0 /xxx/Zend/Acl.php(691): Zend_Acl-get('Test') 
  #1 //admin/Test.php(24): 
  Zend_Acl-isAllowed('guest', 'Test', 'echoHello') 
  #2 /xxx/admin/index.php(50): Test-echoHello() 
  #3 {main} thrown in /xxx/Zend/Acl.php on line 297
  
  
  
  vRandom wrote:
  
  Move this 
  
  require_once 'Test.php';
  $test = new Test($acl);
  
  under
  
  $acl-allow('member', 'test');
  
  Terre
  
  
  
  
 
 -- 
 View this message in context: 
 http://www.nabble.com/Is-it-possible-to-use-Zend_ACL-without-MVC-tp18385583p18390545.html
 Sent from the Zend Framework mailing list archive at Nabble.com.
 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] Login Form

2008-07-10 Thread Christian Sanchez
I have created a Login form based on various tutorials including
Matthew's... But I get this bug I can't quite get how to get around...

I have set the action in the form like this:
$this-setAction('index/login/');
But when I'm testing the actual login and after 3 times of getting the
errors I'm testing for I get the url like this:
http://localhost/index/login/index/login/index/login
That means everytime I hit the log in submit button index/login adds to the
current url, is there a way to set the action to not do this?

Just to keep the URL clean though... But I've been wondering this for weeks
now :P

-- 
Christian Sánchez A.


Re: [fw-general] Login Form

2008-07-10 Thread Christoph Dorn
Try: $this-setAction('/index/login/');

You need the extra / at the beginning of the relative URL to make it
relative to your domain and not the current page.

Christoph



Christian Sanchez wrote:
 I have created a Login form based on various tutorials including
 Matthew's... But I get this bug I can't quite get how to get around...
 
 I have set the action in the form like this:
 $this-setAction('index/login/');
 But when I'm testing the actual login and after 3 times of getting the
 errors I'm testing for I get the url like this:
 http://localhost/index/login/index/login/index/login
 That means everytime I hit the log in submit button index/login adds to
 the current url, is there a way to set the action to not do this?
 
 Just to keep the URL clean though... But I've been wondering this for
 weeks now :P
 
 -- 
 Christian Sánchez A.



Re: [fw-general] Login Form

2008-07-10 Thread Christian Sanchez
I tried that, but my local URL is not really localhost... it's:
http://localhost/project/html/index/login/

Is there any way to parse the baseURL to the Action in the form?



2008/7/10 Christoph Dorn [EMAIL PROTECTED]:

 Try: $this-setAction('/index/login/');

 You need the extra / at the beginning of the relative URL to make it
 relative to your domain and not the current page.

 Christoph



 Christian Sanchez wrote:
  I have created a Login form based on various tutorials including
  Matthew's... But I get this bug I can't quite get how to get around...
 
  I have set the action in the form like this:
  $this-setAction('index/login/');
  But when I'm testing the actual login and after 3 times of getting the
  errors I'm testing for I get the url like this:
  http://localhost/index/login/index/login/index/login
  That means everytime I hit the log in submit button index/login adds to
  the current url, is there a way to set the action to not do this?
 
  Just to keep the URL clean though... But I've been wondering this for
  weeks now :P
 
  --
  Christian Sánchez A.




-- 
Christian Sánchez A.


Re: [fw-general] Login Form

2008-07-10 Thread Christoph Dorn
Try using:

base href=http://localhost/project/html/; /

in your HTML page and this:

$this-setAction('index/login/');

for your action.

Christoph




Christian Sanchez wrote:
 I tried that, but my local URL is not really localhost... it's:
 http://localhost/project/html/index/login/
 
 Is there any way to parse the baseURL to the Action in the form?
 
 
 
 2008/7/10 Christoph Dorn [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]:
 
 Try: $this-setAction('/index/login/');
 
 You need the extra / at the beginning of the relative URL to make it
 relative to your domain and not the current page.
 
 Christoph
 
 
 
 Christian Sanchez wrote:
  I have created a Login form based on various tutorials including
  Matthew's... But I get this bug I can't quite get how to get around...
 
  I have set the action in the form like this:
  $this-setAction('index/login/');
  But when I'm testing the actual login and after 3 times of getting the
  errors I'm testing for I get the url like this:
  http://localhost/index/login/index/login/index/login
  That means everytime I hit the log in submit button index/login
 adds to
  the current url, is there a way to set the action to not do this?
 
  Just to keep the URL clean though... But I've been wondering this for
  weeks now :P
 
  --
  Christian Sánchez A.
 
 
 
 
 -- 
 Christian Sánchez A.



[fw-general] Creating some crappy view helper

2008-07-10 Thread Christian Sanchez
I'm trying to create a view helper to load a GMap in a view when needed
only, hence the helper... I know it's just a crappy view helper but I don't
get the hang of this... How can I render a .phtml when I call the helper?

?php

class Zend_View_Helper_LoadMap
{
function loadMap()
{
echo $this-render('map.phtml');
}
}

?

-- 
Christian Sánchez A.


[fw-general] Re: Creating some crappy view helper

2008-07-10 Thread Christian Sanchez
Sorry guys, find the fix on the net...

class Zend_View_Helper_LoadMap
{
public $view;

public function setView(Zend_View_Interface $view)
{
$this-view = $view;
}

function loadMap()
{
echo $this-view-render('map.phtml');
}
}

2008/7/10 Christian Sanchez [EMAIL PROTECTED]:

 I'm trying to create a view helper to load a GMap in a view when needed
 only, hence the helper... I know it's just a crappy view helper but I don't
 get the hang of this... How can I render a .phtml when I call the helper?

 ?php

 class Zend_View_Helper_LoadMap
 {
 function loadMap()
 {
 echo $this-render('map.phtml');
 }
 }

 ?

 --
 Christian Sánchez A.




-- 
Christian Sánchez A.


Re: [fw-general] Login Form

2008-07-10 Thread Christian Sanchez
didn't work either :(

2008/7/10 Christoph Dorn [EMAIL PROTECTED]:

 Try using:

 base href=http://localhost/project/html/; /

 in your HTML page and this:

 $this-setAction('index/login/');

 for your action.

 Christoph




 Christian Sanchez wrote:
  I tried that, but my local URL is not really localhost... it's:
  http://localhost/project/html/index/login/
 
  Is there any way to parse the baseURL to the Action in the form?
 
 
 
  2008/7/10 Christoph Dorn [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED]:
 
  Try: $this-setAction('/index/login/');
 
  You need the extra / at the beginning of the relative URL to make
 it
  relative to your domain and not the current page.
 
  Christoph
 
 
 
  Christian Sanchez wrote:
   I have created a Login form based on various tutorials including
   Matthew's... But I get this bug I can't quite get how to get
 around...
  
   I have set the action in the form like this:
   $this-setAction('index/login/');
   But when I'm testing the actual login and after 3 times of getting
 the
   errors I'm testing for I get the url like this:
   http://localhost/index/login/index/login/index/login
   That means everytime I hit the log in submit button index/login
  adds to
   the current url, is there a way to set the action to not do this?
  
   Just to keep the URL clean though... But I've been wondering this
 for
   weeks now :P
  
   --
   Christian Sánchez A.
 
 
 
 
  --
  Christian Sánchez A.




-- 
Christian Sánchez A.


Re: [fw-general] Login Form

2008-07-10 Thread Rob Allen


On 11 Jul 2008, at 02:15, Christian Sanchez wrote:

I have created a Login form based on various tutorials including  
Matthew's... But I get this bug I can't quite get how to get around...


I have set the action in the form like this: $this-setAction('index/ 
login/');
But when I'm testing the actual login and after 3 times of getting  
the errors I'm testing for I get the url like this: http://localhost/index/login/index/login/index/login
That means everytime I hit the log in submit button index/login adds  
to the current url, is there a way to set the action to not do this?


Just to keep the URL clean though... But I've been wondering this  
for weeks now :P


--
Christian Sánchez A.



Assuming that $form exists in the model, then you can do this:

$url = $this-_helper-url-url(array('controller'='index',  
'action'='login'));

$form-setAction($url);


Regards,

Rob...

Re: [fw-general] Login Form

2008-07-10 Thread Christian Sanchez
Well I have a LoginForm.php and then call it to insert it on the view, so
I'm using:

?php
class LoginForm extends Zend_Form
{
public function init()
{
$this-setName('loginForm');
$this-setAction('/index/login/');
$this-setMethod('post');

Is there a way to use it in this case... The LoginForm.php instead of using
it in the view?

2008/7/10 Rob Allen [EMAIL PROTECTED]:


 On 11 Jul 2008, at 02:15, Christian Sanchez wrote:

 I have created a Login form based on various tutorials including
 Matthew's... But I get this bug I can't quite get how to get around...

 I have set the action in the form like this:
 $this-setAction('index/login/');
 But when I'm testing the actual login and after 3 times of getting the
 errors I'm testing for I get the url like this:
 http://localhost/index/login/index/login/index/login
 That means everytime I hit the log in submit button index/login adds to the
 current url, is there a way to set the action to not do this?

 Just to keep the URL clean though... But I've been wondering this for weeks
 now :P

 --
 Christian Sánchez A.



 Assuming that $form exists in the model, then you can do this:

 $url = $this-_helper-url-url(array('controller'='index',
 'action'='login'));
 $form-setAction($url);


 Regards,

 Rob...




-- 
Christian Sánchez A.


[fw-general] Re: Wrapping div's around a Zend_Form

2008-07-10 Thread Stefan Sturm
Hello,

no one with an idea on this? Or is it simply not possible?

Thanks and Greetings,
Stefan Sturm

2008/7/10 Stefan Sturm [EMAIL PROTECTED]:
 Hello,

 I try to wrap the following div structure around a Zend_Form:

 div class=outerform
div class=topdivdiv/div/div
div class=content
!-- Here comes the Form --
/div
div class=bottomdivdiv/div/div
 /div

 I tried it with this decorators:

 $this-setDecorators(
array(
'FormElements',
'Form',
array(array('content' = 'HtmlTag'), array('tag' = 'div', 
 'class'
 = 'content')),
array(array('top' = 'HtmlTag'), array('tag' = 'div', 'class' 
 =
 'topdiv', 'placement' = 'prepend') ),
array(array('bottom' = 'HtmlTag'), array('tag' = 'div', 
 'class' =
 'bottomdiv', 'placement' = 'append')),
array(array('outer' = 'HtmlTag'), array('tag' = 'div', 
 'class' =
 'outerform')),
)
 );

 But this is not exactly what I need. How can I get the empty
 div/div inside topdiv and bottom div?

 Hope somebody can Help :-)

 Greetings,
 Stefan Sturm