[fw-general] Unofficial add-on classes repository

2007-06-12 Thread back-2-95

Hi!

Could there be some place within Zend Framework sites where users could
submit unofficial classes to use with Zend Framework.

It seems that many people have done or are doing classes which not exist in
Zend Framework (Form, Upload etc). And proposal process (which is good) is
long process. 

This kind of "unofficial" repository could help many people until official
Zend Framework library grows.

Good and popular ones most likely would advance to proposal process and
finally to official Zend Framework library.

Any thoughts?

Regards,
Marko Korhonen
-- 
View this message in context: 
http://www.nabble.com/Unofficial-add-on-classes-repository-tf3912648s16154.html#a11092985
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Idea: Zend_Debug::dump $label default to __FILE__

2007-06-12 Thread Nick Lo

On 13/06/2007, at 1:43 PM, Matthew Weier O'Phinney wrote:


-- Nick Lo <[EMAIL PROTECTED]> wrote
(on Wednesday, 13 June 2007, 01:28 PM +1000):

One of the pains of using print_r() or var_dump() is the hunt to find
the ones you forget to remove or edit out. With Zend_Debug::dump()
the additional $label parameter allows you to go...

Zend_Debug($wotsit, __FILE__);

...but only if you specify it. I wondered since unless given a value
$label does nothing as to whether it could default to something like
__FILE__ just to make Zend_Debug a little less typing and a little
more useful than the PHP variations.


Won't work. __FILE__ in that case would refer to the class file in  
which

Zend_Debug lives, and it's incredibly difficult, if not impossible, to
determine where the method was called from and what file contained  
that

code.


Agh of course, excuse my idiocy!

Nick





Re: [fw-general] Idea: Zend_Debug::dump $label default to __FILE__

2007-06-12 Thread Matthew Weier O'Phinney
-- Nick Lo <[EMAIL PROTECTED]> wrote
(on Wednesday, 13 June 2007, 01:28 PM +1000):
> One of the pains of using print_r() or var_dump() is the hunt to find  
> the ones you forget to remove or edit out. With Zend_Debug::dump()  
> the additional $label parameter allows you to go...
> 
> Zend_Debug($wotsit, __FILE__);
> 
> ...but only if you specify it. I wondered since unless given a value  
> $label does nothing as to whether it could default to something like  
> __FILE__ just to make Zend_Debug a little less typing and a little  
> more useful than the PHP variations.

Won't work. __FILE__ in that case would refer to the class file in which
Zend_Debug lives, and it's incredibly difficult, if not impossible, to
determine where the method was called from and what file contained that
code.

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Idea: Zend_Debug::dump $label default to __FILE__

2007-06-12 Thread Nick Lo
One of the pains of using print_r() or var_dump() is the hunt to find  
the ones you forget to remove or edit out. With Zend_Debug::dump()  
the additional $label parameter allows you to go...


Zend_Debug($wotsit, __FILE__);

...but only if you specify it. I wondered since unless given a value  
$label does nothing as to whether it could default to something like  
__FILE__ just to make Zend_Debug a little less typing and a little  
more useful than the PHP variations.


Thanks,

Nick


Re: [fw-general] viewRender filename-manipulation

2007-06-12 Thread Matthew Weier O'Phinney
-- Sebastian Krebs <[EMAIL PROTECTED]> wrote
(on Wednesday, 13 June 2007, 02:55 AM +0200):
> Im using filenames like there are used for ZF-Classfiles and even for 
> Controller (eg IndexController) means: Directories and Filenames are all 
> first letter uppercase. But I see, that the viewRenderer himself only 
> take the module-, controller- and action-names like they are, without 
> any possibility to manipulate them. Action-names can be set, but the 
> module- and controller-names arent. My only way i currently see is to 
> overwrite the _translatespec-method (or something like that), but i 
> would prefer to use the original one, because its automatically 
> activated. When overwriting the viewRenderer i have to disable the 
> original one and integrate my own.

You can register your custom ViewRenderer early, which will prevent the
default one from registering, particularly if you use 'ViewRenderer' as
the final portion of the class name (e.g., My_ViewRenderer):

require_once 'Zend/Controller/Front.php';
require_once 'My/ViewRenderer.php';

Zend_Controller_Action_HelperBroker::addHelper(new My_ViewRenderer());
$front = Zend_Controller_Front::getInstance();

Remember, ZF components, particularly in the MVC layer, are expected to
be subclassed. The sort of customization you outline is exactly the sort
of justification I'd use for subclassing -- you want to slightly modify
the behaviour of the class, but keep the majority the same.

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Broken code when upgrading from 0.9.2 - 1.0

2007-06-12 Thread Matthew Weier O'Phinney
-- agatone <[EMAIL PROTECTED]> wrote
(on Tuesday, 12 June 2007, 02:28 PM -0700):
> Somehow I don't understand the logic why would you auto-init VIEW for
> complete project. Why such change?
> What if I have only controller that handles request and redirects and I
> don't need VIEW. Sure you could easly say TURN IT OFF, but what's the point
> of TURNING ON things not knowing if people will need them at that point...

Not using a view is not standard usage. It makes more sense to have
something on by default if it's used in the major use cases and have the
ability to turn it off for those use cases where it's not used, plain
and simple.

Zend_Controller is part of the *MVC* layer; most people I've talked to
in the past six months have been wondering why there *hasn't* been
better view integration. ;-)

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] viewRender filename-manipulation

2007-06-12 Thread Sebastian Krebs

Hi.

Im using filenames like there are used for ZF-Classfiles and even for 
Controller (eg IndexController) means: Directories and Filenames are all 
first letter uppercase. But I see, that the viewRenderer himself only 
take the module-, controller- and action-names like they are, without 
any possibility to manipulate them. Action-names can be set, but the 
module- and controller-names arent. My only way i currently see is to 
overwrite the _translatespec-method (or something like that), but i 
would prefer to use the original one, because its automatically 
activated. When overwriting the viewRenderer i have to disable the 
original one and integrate my own.


So, see somebody a possibility to manipulate file- and directory-names 
within viewRenderer without overwriting it? I would prefer to leave the 
functionality like it is, because its comfortable :)


greetz, Krebs


[fw-general] Examples for Presentation

2007-06-12 Thread Thomas Weidner

Hy fellows...

for the previous mentioned presentations I also made some examples...
As examplefiles can not be integrated into slideshare I added them here for 
your convinience.


All are showing I18N features and are for now not mentioned within the 
manual (as I wrote them from the scratch ;-) )


Greetings
Thomas
I18N Team Leader 


example14.php
Description: application/php


example1.php
Description: application/php


example2.php
Description: application/php


example3.php
Description: application/php


example4.php
Description: application/php


example5.php
Description: application/php


example6.php
Description: application/php


example7.php
Description: application/php


example8.php
Description: application/php


example9.php
Description: application/php


example10.php
Description: application/php


example11.php
Description: application/php


example12.php
Description: application/php


example13.php
Description: application/php


Re: [fw-general] Broken code when upgrading from 0.9.2 - 1.0

2007-06-12 Thread agatone

Somehow I don't understand the logic why would you auto-init VIEW for
complete project. Why such change?
What if I have only controller that handles request and redirects and I
don't need VIEW. Sure you could easly say TURN IT OFF, but what's the point
of TURNING ON things not knowing if people will need them at that point...


tfk wrote:
> 
> $controller->setParam('noViewRenderer', true);
> 

-- 
View this message in context: 
http://www.nabble.com/Broken-code-when-upgrading-from-0.9.2---1.0-tf3854139s16154.html#a11087511
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend Framework Presentation

2007-06-12 Thread Andries Seutens

Thomas,

This looks very good! I feel even worse now, for not going there.

Great work!

Best,

Andries Seutens
http://andries.systray.be

Thomas Weidner schreef:

Hy fellows,

I held an presentation about the Zend Framework some days ago.
As not all of you where there... I want to share the presentation
with you.

You will find some generals about the Framework and some example about 
how to

use I18N core details.

If you are interested take a look at:
http://www.slideshare.net/thomasw/phpbootcamp-zend-framework
and play around with ZF...

Greetings
Thomas Weidner
I18N Team Leader for ZF


Re: [fw-general] modular layout and routing

2007-06-12 Thread Matthew Weier O'Phinney
-- naioshi cozmicboy <[EMAIL PROTECTED]> wrote
(on Tuesday, 12 June 2007, 09:57 PM +0200):
> thank you for you explanation. Now it makes sense to me
> and I'll probably end up using just one module ('default')
> containing all the controllers (which I was wrongly
> referring to as modules; i have to get used to the
> terminology).
> 
> The only think I will miss is not having the modular
> directory structure:
> 
> app
> - default
> - accounts
> - library
> - forum
> - service
> 
> instead I will have everything in one directory
> 
> app
> - default (containing everything)
> 
> But again, I think I can get used to that.

If any of your controllers start to seem unmanageable, or if you start
to notice that you could group related actions into separate
controllers, then you may still end up with your modular directory
structure. :-)

I definitely see the benefit of modules -- I was one of those pushing to
get them into the ZF MVC -- but I also think it's easy to abuse the
model. Unless you are planning on distributing the application as a
standalone module or creating a complex app with many screen types, in
most cases a single controller in the default module will suffice.

Something else to consider: you can always create these as modules with
a single index controller. Then create custom routing rules like the
following:

$forumRoute = new Zend_Controller_Router_Route(
'forum/:action/*',
array(
'module' => 'forum',
'controller' => 'index',
'action' => 'index'  // default action
)
);
$router->addRoute('forum', $forumRoute);

However, this is more overhead in your bootstrap.

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Zend Framework Presentation

2007-06-12 Thread Thomas Weidner

Hy fellows,

I held an presentation about the Zend Framework some days ago.
As not all of you where there... I want to share the presentation
with you.

You will find some generals about the Framework and some example about how 
to

use I18N core details.

If you are interested take a look at:
http://www.slideshare.net/thomasw/phpbootcamp-zend-framework
and play around with ZF...

Greetings
Thomas Weidner
I18N Team Leader for ZF 



Re: [fw-general] modular layout and routing

2007-06-12 Thread naioshi cozmicboy

Matthew,

thank you for you explanation. Now it makes sense to me
and I'll probably end up using just one module ('default')
containing all the controllers (which I was wrongly
referring to as modules; i have to get used to the
terminology).

The only think I will miss is not having the modular
directory structure:

app
- default
- accounts
- library
- forum
- service

instead I will have everything in one directory

app
- default (containing everything)

But again, I think I can get used to that.

Thanks again,

Naioshi


RE: [fw-general] RE: Many-to-many Relationship question

2007-06-12 Thread Bill Karwin
We have had a few similar feature requests for Zend_Db_Table
http://framework.zend.com/issues/browse/ZF-553
http://framework.zend.com/issues/browse/ZF-1182 

In general, I have declined those feature requests.  Zend_Db_Table
implements a specific pattern called Table Data Gateway, which does not
include support for all the SQL query clauses like WHERE, GROUP BY,
ORDER, etc.

If you need the flexibility of SQL, then you should probably use a SQL
query.

Regards,
Bill Karwin

> -Original Message-
> From: Jorisa [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, June 12, 2007 7:47 AM
> To: fw-general@lists.zend.com
> Subject: [fw-general] RE: Many-to-many Relationship question
> 
> 
> Ok, then what If I would like to fetch all Xrefs, with 
> status='likes'. As far as I know this isn't possible with the 
> current api and I think this would be a pretty common action.
> 
> for example
> 
> $where = $db->quoteInto("status = ?", "loves"); 
> $friend->findDependentRowset('FoodXref', null, $where);
> 
> Is this something I could post on the issue tracker as 
> suggesion or is this generally a bad idea?
> 
> Kind regards,
> Joris Aerts
> 
> 
> 
> Bill Karwin wrote:
> > 
> > Yes, in the current implementation of 
> findManyToManyRowset(), none of 
> > the columns from the FoodXref table are returned.
> >  
> > This is because a Zend_Db_Table_Rowset always contains columns from 
> > only one table.
> >  
> > So you'll have to do the query another way, as you describe.
> >  
> > Regards,
> > Bill Karwin
> > 
> > 
> > 
> > 
> > From: Jorisa [mailto:[EMAIL PROTECTED] 
> > Sent: Saturday, June 09, 2007 4:39 AM
> > To: fw-general@lists.zend.com
> > Subject: [fw-general] Many-to-many Relationship question
> > 
> > 
> > 
> > Hi, Suppose I've got 3 tables:
> > 
> > 
> > Friends
> > - id
> > - name
> > 
> > Food
> > - id
> > - name
> > 
> > FoodXref
> > - id
> > - friend_id
> > - food_id
> > - status
> > 
> > 
> > 
> > Now I want to fetch what food some friend likes or not, so I do
> > 
> > 
> > $friend = $friendsFactory->fetchById(3);
> > $foodlist = $friend->findManyToManyRowset('Food', 'FoodXref');
> > 
> > 
> > 
> > This way I get all the food linked to friend 3 by 
> FoodXref. But what 
> > if I want the status field from the xref table as well? (So 
> I can get 
> > Peter loves Pizza, Peter hates Salad)
> > 
> > Is there a simple solution to accomplish this? Or do I 
> need to fetch 
> > the Xref table, and then get the friend's name for every row myself?
> > 
> > Thanks.
> > 
> > Kind regards,
> > Joris Aerts
> > 
> > 
> > 
> > 
> > View this message in context: Many-to-many Relationship question
> > 
>  > 15
> > 4.html#a11039613> 
> > Sent from the Zend Framework mailing list archive 
> >   at Nabble.com.
> > 
> > 
> > 
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/Many-to-many-Relationship-question-tf389
> 4110s16154.html#a11080212
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 


Re: [fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread Shaun Rowe

Matthew Weier O'Phinney wrote:

Well, for many releases now, we've had the dispatcher wrapping the
dispatched action with output buffering, so it's all being trapped in
the response object already. It's not a good practice, however, to echo
directly and rely on this. 


Probably the best way to get them out of the habit is through education.
Stick an echo into a library somewhere that you know they'll use, and
see if they can figure out what happened -- and then point out why what
they're doing is no better.



Now that's what I call geurila programming! :p


Shaun



Re: [fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread Matthew Weier O'Phinney
-- Jakub Podhorský <[EMAIL PROTECTED]> wrote
(on Tuesday, 12 June 2007, 07:11 PM +0200):
> What about to start output buffering in preDispatch method and in postDispatch
> method clear this output and if there is any output in postDispatch you can 
> log
> it with controller and action name

Ouput buffering is already used in the dispatcher to capture content
echo'd by the action and its constituents, so the only way to enforce
this would be to turn off output buffering
($front->setParam('disableOutputBuffer')), and then write your own
plugins.


> ━━━
> 
> From: depace [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 12, 2007 6:22 PM
> To: fw-general@lists.zend.com
> Subject: [fw-general] Is there a way to disable "echo", "print" inside a 
> method
> 
>  
> 
> This sounds little stupid but if it is possible then it will save my ass being
> skinned..
> 
> the problem is while working in a team... the programmers instead of 
> displaying
> the data through template they have a habit of echoing from the method
> itself...
> have to trace where are all those crazy echosss .
> so it has been a lil pain in ass ...
> 
> it really is a pain to make people work in MVC .. dunno why is it so hard for
> people to understand it..
> 
> 

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


RE: [fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread Jakub Podhorský
What about to start output buffering in preDispatch method and in
postDispatch method clear this output and if there is any output in
postDispatch you can log it with controller and action name

 

 

  _  

From: depace [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 12, 2007 6:22 PM
To: fw-general@lists.zend.com
Subject: [fw-general] Is there a way to disable "echo", "print" inside a
method

 

This sounds little stupid but if it is possible then it will save my ass
being skinned.. 

the problem is while working in a team... the programmers instead of
displaying the data through template they have a habit of echoing from the
method itself... 
have to trace where are all those crazy echosss . 
so it has been a lil pain in ass ... 

it really is a pain to make people work in MVC .. dunno why is it so hard
for people to understand it.. 





Re: [fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread Matthew Weier O'Phinney
-- depace <[EMAIL PROTECTED]> wrote
(on Tuesday, 12 June 2007, 09:52 PM +0530):
> This sounds little stupid but if it is possible then it will save my ass being
> skinned..
> 
> the problem is while working in a team... the programmers instead of 
> displaying
> the data through template they have a habit of echoing from the method
> itself...
> have to trace where are all those crazy echosss .
> so it has been a lil pain in ass ...
> it really is a pain to make people work in MVC .. dunno why is it so hard for
> people to understand it..

Well, for many releases now, we've had the dispatcher wrapping the
dispatched action with output buffering, so it's all being trapped in
the response object already. It's not a good practice, however, to echo
directly and rely on this. 

Probably the best way to get them out of the habit is through education.
Stick an echo into a library somewhere that you know they'll use, and
see if they can figure out what happened -- and then point out why what
they're doing is no better.

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


Re: [fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread Shaun Rowe

depace wrote:
This sounds little stupid but if it is possible then it will save my ass 
being skinned..


the problem is while working in a team... the programmers instead of 
displaying the data through template they have a habit of echoing from 
the method itself...

have to trace where are all those crazy echosss .
so it has been a lil pain in ass ...

it really is a pain to make people work in MVC .. dunno why is it so 
hard for people to understand it..


Dude, tell them to stop doing that, there is no need! If they really 
wanna see something get them to log it with Zend_Log. No need for you to 
bend over backwards to accommodate them.


Go teach them the ways of changes. If they're not willing to compromise, 
there's point going down the MVC route...well there is but it'll be more 
painful than necessary.



Shaun


Re: [fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread till

On 6/12/07, depace <[EMAIL PROTECTED]> wrote:

This sounds little stupid but if it is possible then it will save my ass
being skinned..

the problem is while working in a team... the programmers instead of
displaying the data through template they have a habit of echoing from the
method itself...
have to trace where are all those crazy echosss .
so it has been a lil pain in ass ...

it really is a pain to make people work in MVC .. dunno why is it so hard
for people to understand it..


:D

That sounds whack, but did you try if disabled_functions (or something
like that) works on a per directory basis?

Till


Re: [fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread Stanislav Malyshev
the problem is while working in a team... the programmers instead of 
displaying the data through template they have a habit of echoing from 
the method itself...

have to trace where are all those crazy echosss .
so it has been a lil pain in ass ...


You can't really disable echo/print but you could set output buffering 
so you capture everything echo'ed/print'ed and then you can decide what 
to do with it.


--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/



[fw-general] Is there a way to disable "echo", "print" inside a method

2007-06-12 Thread depace

This sounds little stupid but if it is possible then it will save my ass
being skinned..

the problem is while working in a team... the programmers instead of
displaying the data through template they have a habit of echoing from the
method itself...
have to trace where are all those crazy echosss .
so it has been a lil pain in ass ...

it really is a pain to make people work in MVC .. dunno why is it so hard
for people to understand it..


Re: [fw-general] modular layout and routing

2007-06-12 Thread Matthew Weier O'Phinney
-- naioshi cozmicboy <[EMAIL PROTECTED]> wrote
(on Tuesday, 12 June 2007, 05:19 AM +0200):
> I'm new to ZF and I'm not sure which would be the optimal
> layout and routing scheme for my application.
> 
> I would like to have these modules:
> 
> - default
> - accounts
> - news
> - library
> - forum
> - service
> 
> each module having some actions (example):
> 
> - default (index, login, logout, sitemap, about, contact)
> - accounts (index, detail, add, edit, delete)
> - news (index, detail, add, edit, delete)
> - library (index, detail, add, edit, delete)
> - forum (index, detail, add, edit, delete)
> - service (index, stats, backup)

You're confusing modules with controllers. Controllers contain actions,
while modules contain controllers. The above should all be controllers
with the actions specified, in the default module.

You want to segregate into modules when a given application starts
needing multiple controllers in order to group its responsibilities. At
the most basic level, you might have, for instance, a blog module with
separate controllers like this:

blog/
controllers/
ListController.php  // various list actions -- by tag, by
// year, by month, by day, etc.
AdminController.php // for admin actions -- post, list
// comments, etc.
IndexController.php // fallback controller, handling viewing
// individual posts, errors, etc.

What I see based on your layout above are the following *controllers*:

default/
controllers/
IndexController.php // could contain sitemap and about actions
LoginController.php
ContactController.php
AccountsController.php
NewsController.php
LibraryController.php
ForumController.php
ServiceController.php

In most sites, you'll probably simply create additional controllers
under the default module; the relation they have is they all serve the
same site. I'd likely only create a new module when, for code clarity, I
need to group actions into multiple controllers, but consider them all
part of the same application. A common rule of thumb I follow is that if
a controller has more than 7 actions, I likely need to either refactor
to fewer actions, or refactor into multiple controllers (and thus a
module).

-- 
Matthew Weier O'Phinney
PHP Developer| [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/


[fw-general] Proposal: Zend_View Enhanced

2007-06-12 Thread Pádraic Brady
Hi all,

http://framework.zend.com/wiki/pages/viewpage.action?pageId=33071

Over the past few months I've had a lot of fun using the Zend Framework - kudos 
to all those involved. I complain a lot about ZF views, but that doesn't 
reflect my opinion on the whole framework (impressions to the contrary perhaps 
;)). Back on track...

I have submitted a proposal called "Zend_View Enhanced". If anyone's followed 
my blog since May, I've been talking a lot about Views and how I think they 
should be used. It's a whole bunch of wordy entries you can entertain yourself 
(or maybe send yourself to sleep) reading. The proposal revolves around adding 
some standard View Helpers and a handful of methods to Zend_View_Abstract. 
Helpers are generally preferable to lumping more stuff into 
Zend_View_Abstract...

In combination they allow a developer to construct output more flexibly. To put 
the idea across, I've defined four pieces of functionality for this proposal:

1. Partials
2. Controllers
3. Layouts
4. Placeholders

(Read the blog or Proposal for what these mean if you haven't seen the terms 
before.)

These are in addition to the currently available stuff I call:

5. Includes (typical PHP include)
6. Response Segmentation (Zend_Controller_Response_Http named segments)
7. Same-Scope Partials (using Zend_View_Abstract::render() for extra 
sub-templates)

Hopefully the Proposal makes for an interesting read. Not sure if its a 
direction everyone wants or feels is needed, but your feedback and critique is 
very welcome. I get the feeling these can get somewhat obscure, so bear in mind 
they are not intended to impinge on existing functionality and are intended as 
being completely backwards compatible.

The only unavailable dependent behaviour are some Setters for ViewRenderer (as 
I submitted in #ZF-1545). Proposal is currently marked "Under Contruction" 
until ZF-1545 is resolved or given a good kick out a door.

Any questions, kick them out there.
 
Pádraic Brady
http://blog.astrumfutura.com
http://www.patternsforphp.com





   
Ready
 for the edge of your seat? 
Check out tonight's top picks on Yahoo! TV. 
http://tv.yahoo.com/

[fw-general] recovering and editing from two tables.

2007-06-12 Thread José de Menezes Soares Neto

Hi friends,

I have two tables "users" and "clients". But "users" and "clients" have the
same form (but some fields for one and some for the other).

When I add, its ok. But when I edit some, the information cames only from
the table clients (and fills it fields) but the information from the table
users doesn't came and don't fill its fields...

Here is the code I use to recovery:

   $id = (int)$this->_request->getParam('id', 0);

   // Recupera os dados do cliente
   $clientes = $clientes->fetchRow('clie_id='.$id);
   $clientes = $clientes->toArray();
   extract($funcionarios);

   $smarty->assign('clientes', $clientes);

   // Recupera os dados de usuario (here is the problem)
   $usuarios = $usuarios->fetchRow('usu_id='.$id);
   $usuarios = $usuarios->toArray();
   extract($usuarios);

   $smarty->assign('usuarios', $usuarios);

Best regards,

José de Menezes


[fw-general] RE: Many-to-many Relationship question

2007-06-12 Thread Jorisa

Ok, then what If I would like to fetch all Xrefs, with status='likes'. As far
as I know this isn't possible with the current api and I think this would be
a pretty common action.

for example

$where = $db->quoteInto("status = ?", "loves");
$friend->findDependentRowset('FoodXref', null, $where);

Is this something I could post on the issue tracker as suggesion or is this
generally a bad idea?

Kind regards,
Joris Aerts



Bill Karwin wrote:
> 
> Yes, in the current implementation of findManyToManyRowset(), none of
> the columns from the FoodXref table are returned.
>  
> This is because a Zend_Db_Table_Rowset always contains columns from only
> one table.
>  
> So you'll have to do the query another way, as you describe.
>  
> Regards,
> Bill Karwin
> 
> 
> 
> 
>   From: Jorisa [mailto:[EMAIL PROTECTED] 
>   Sent: Saturday, June 09, 2007 4:39 AM
>   To: fw-general@lists.zend.com
>   Subject: [fw-general] Many-to-many Relationship question
>   
>   
> 
>   Hi, Suppose I've got 3 tables:
> 
>   
>   Friends
>   - id
>   - name
>   
>   Food
>   - id
>   - name
>   
>   FoodXref
>   - id
>   - friend_id
>   - food_id
>   - status
> 
>   
> 
>   Now I want to fetch what food some friend likes or not, so I do
> 
>   
>   $friend = $friendsFactory->fetchById(3);
>   $foodlist = $friend->findManyToManyRowset('Food', 'FoodXref');
> 
>   
> 
>   This way I get all the food linked to friend 3 by FoodXref. But
> what if I want the status field from the xref table as well? (So I can
> get Peter loves Pizza, Peter hates Salad)
> 
>   Is there a simple solution to accomplish this? Or do I need to
> fetch the Xref table, and then get the friend's name for every row
> myself?
> 
>   Thanks.
> 
>   Kind regards,
>   Joris Aerts
> 
> 
> 
> 
>   View this message in context: Many-to-many Relationship question
>  4.html#a11039613> 
>   Sent from the Zend Framework mailing list archive
>   at Nabble.com.
>   
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Many-to-many-Relationship-question-tf3894110s16154.html#a11080212
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Problem with Zend_Session::rememberMe()?

2007-06-12 Thread petemcw

So I am having a very strange issue that seems to involves
Zend_Session::rememberMe() and I believe Zend_Auth as well.

I am working with a fairly standard authentication/authorization setup using
the Zend Framework components and all was going very well.  A user could
post their credentials, the system would look them up and create a Zend_Auth
identity using Zend_Auth_Adapter_DbTable.  From that point the user was
logged in.  I implemented the Zend_Session::rememberMe() functionality and
after a few adjustments, this worked perfectly (at this point, using ZF
0.9).

So here is my problem.  It's been a few months, and I've noticed that
specifically the "remember me" functionality no longer works right.  If a
user logs in, without checking the "remember me" box, everything is great. 
If the "remember me" box is checked, the user is forwarded right back to the
login screen.  That's it, no errors, nothing except the user isn't logged
in.  Here is the remember me code:

// Check for remember me option
if (isset($data['remember_me']) && (int) $data['remember_me'] == 1) {
Zend_Session::rememberMe();
}

So this is what I know about the problem:
-  I first noticed it while using 0.9.3 – the application is currently
updated to 1.0.0RC1 and the problem is still present
-  After going through all the code and debugging, I know that when the
"remember me" box is checked, the user account is found, the
Zend_Auth_Adapter_DbTable finds and sets the correct user identity.  And
everything is good, but upon redirecting to the secured pages, the identity
object is being wiped out somehow
-  When the box is checked, the actual cookie is set…it just appears that
the Zend_Auth identity is wiped out

I even tried to create a brand new "blank" application test case using a
simple form and it appears to work, so I'm not convinced it is totally the
ZF to blame.  But I have not changed any code related to this functionality
since it worked and now it just doesn't work.  I know this is a specific
case, but if anyone would know of where else I could look to debug this or
if you've seen this before I could use the help.  I don't feel that I
understand all the ins and outs of the MVC functionality to fully grasp
where in the whole request process that this Zend_Auth stuff could be
overridden or removed.

Thanks for any suggestions!
--
--
Peter McWilliams <><
-- 
View this message in context: 
http://www.nabble.com/Problem-with-Zend_Session%3A%3ArememberMe%28%29--tf3908000s16154.html#a11080211
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Http_Client example - login / grab content

2007-06-12 Thread mike55

just played around with Zend_Http_Client. wanted to list the emails of a
freemail provider. i'm new to the zend framwork and no php pro. so beware.
the example works for gmx.net
you have to change one ore two words for your local language. see code. with
few changes this should work with every other website.

what it does:
get_page() retrieves a web-page. the third parameter is a array of post
parameters. for a GET just leave it blank.

print_page() displays
-the request
-the reponse with headers and body
-"fingerprint" (just the form elements of a page. so you can easily see
whats needed for a login )

extract_links() does exactly that. the regex is far from perfect. just a
hack.
it returns a two-dim array with href and link-text.

find_link() finds a href/linktext combo in the link-array returnd by
extract-links(). you need this, because the links are dynamic. just take the
non-dynamic part and the link-text to get a certain link on the page.

in this example, all the requested pages are combined on one page. doesn't
look good, but you see whats really happening.

hope this is helpful. comments and improvements welcome.

mike

http://mike55stuff.blogspot.com/2007/06/zendhttpclient-example.html
code:
http://mike55stuff.blogspot.com/2007/06/requestmethod-return-response-function.html
-- 
View this message in context: 
http://www.nabble.com/Zend_Http_Client-example---login---grab-content-tf3907720s16154.html#a11079391
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] CLI non-object error in Zend_Search_Lucene

2007-06-12 Thread Jemima

Further to this, I discovered that commenting out the line does cause
problems, and I believe the original issue was almost certainly an issue
with my code. Sorry to hassle you with it. 

Jemima

-- 
View this message in context: 
http://www.nabble.com/CLI-non-object-error-in-Zend_Search_Lucene-tf3902126s16154.html#a11079390
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Acl: Role not found in other controllers

2007-06-12 Thread wenbert

thanks darby. i have temporarily solved it by putting the ACL Object inside
the Zend_Auth object - during authentication. i serialized $acl and then
unserialized when i need to do an isAllow()... im not sure if this is the
best approach but it works for me as of the moment 
thanks for pointing out the plugins. i have so much to learn from ZF... i
will be experimenting with the Plugins first thing tomorrow... :)


Darby Felton wrote:
> 
> Hello,
> 
> In AuthController.php you setup an ACL object, which goes out of scope
> at the end of the script and is destroyed at that time.
> 
> In FooController.php you are creating a new and separate ACL object. Of
> course it does not have the information that the ACL object created in
> AuthController.php had - it's a different object! :)
> 
> If you need the ACL object (or any other data stored in a user variable,
> for that matter) available across all your controllers, you must persist
> the data somewhere (e.g., the PHP session, a database). But this is
> probably not the best approach. I understand that people have had a lot
> of success with implementing a front controller plugin that implements
> authorization with preDispatch().
> 
> For more information about creating a front controller plugin, please see:
> 
> http://framework.zend.com/manual/en/zend.controller.plugins.html
> 
> Hope this helps!
> 
> Best regards,
> Darby
> 
> wenbert wrote:
>> i have this in one of the controllers in my AuthController.php
>> 
>> // set access controlls 
>> // -
>> $acl = new Zend_Acl();
>> 
>> //define resources
>> $acl->add(new Zend_Acl_Resource('admin_pages'));
>> $acl->add(new Zend_Acl_Resource('claim'));
>> $acl->add(new Zend_Acl_Resource('views'));
>> $acl->add(new Zend_Acl_Resource('reports'));
>> $acl->add(new Zend_Acl_Resource('research'));
>> 
>> $roles = explode(' ',$data['group_names']);
>> foreach ($roles as $role) {
>> $myrole = new Zend_Acl_Role($role);
>> $acl->addRole($myrole);
>> 
>> if ($role == 'admin') {
>> $acl->allow($myrole, 'admin_pages', array('admin_access'));
>> } elseif ($role == 'xxx') {
>> $acl->allow($myrole, array('claim', 'views', 'reports'),
>> array('create_claim', 'save_claim', 'close_claim', 'view'));
>> } elseif ($role == 'yyy') {
>> $acl->allow($myrole, array('research', 'views', 'reports'),
>> array('research_open', 'view'));
>> }
>> //echo $acl->isAllowed($role, null, 'research_open') ? "$role:
>> allowed" : "$role: denied";
>> }
>> // -
>> 
>> BUT, i can't access the ACL in another FooController.php
>> Zend_Loader::loadClass('Zend_Acl');
>> Zend_Loader::loadClass('Zend_Acl_Role');
>> Zend_Loader::loadClass('Zend_Acl_Resource');
>> $acl = new Zend_Acl;
>> $acl->isAllowed('xxx', 'claim', 'create_claim') ? "myrole: allowed"
>> :
>> "myrole: denied";
>> 
>> i get an error that says:
>> Fatal error: Uncaught exception 'Zend_Acl_Role_Registry_Exception' with
>> message 'Role 'xxx' not found' 
>> 
>> how would i access the stuff i created in my AuthController.php from in
>> other controllers/actions?
>> so that I can do this: 
>> $acl->isAllowed('xxx', 'claim', 'create_claim') ? "myrole: allowed"
>> :
>> "myrole: denied";
>> in any part of my application?
>> 
>> any reply will be appreciated :)
>> thanks
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Acl%3A-Role-not-found-in-other-controllers-tf3905692s16154.html#a11078854
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Acl: Role not found in other controllers

2007-06-12 Thread Darby Felton
Hello,

In AuthController.php you setup an ACL object, which goes out of scope
at the end of the script and is destroyed at that time.

In FooController.php you are creating a new and separate ACL object. Of
course it does not have the information that the ACL object created in
AuthController.php had - it's a different object! :)

If you need the ACL object (or any other data stored in a user variable,
for that matter) available across all your controllers, you must persist
the data somewhere (e.g., the PHP session, a database). But this is
probably not the best approach. I understand that people have had a lot
of success with implementing a front controller plugin that implements
authorization with preDispatch().

For more information about creating a front controller plugin, please see:

http://framework.zend.com/manual/en/zend.controller.plugins.html

Hope this helps!

Best regards,
Darby

wenbert wrote:
> i have this in one of the controllers in my AuthController.php
> 
> // set access controlls 
> // -
> $acl = new Zend_Acl();
> 
> //define resources
> $acl->add(new Zend_Acl_Resource('admin_pages'));
> $acl->add(new Zend_Acl_Resource('claim'));
> $acl->add(new Zend_Acl_Resource('views'));
> $acl->add(new Zend_Acl_Resource('reports'));
> $acl->add(new Zend_Acl_Resource('research'));
> 
> $roles = explode(' ',$data['group_names']);
> foreach ($roles as $role) {
> $myrole = new Zend_Acl_Role($role);
> $acl->addRole($myrole);
> 
> if ($role == 'admin') {
> $acl->allow($myrole, 'admin_pages', array('admin_access'));
> } elseif ($role == 'xxx') {
> $acl->allow($myrole, array('claim', 'views', 'reports'),
> array('create_claim', 'save_claim', 'close_claim', 'view'));
> } elseif ($role == 'yyy') {
> $acl->allow($myrole, array('research', 'views', 'reports'),
> array('research_open', 'view'));
> }
> //echo $acl->isAllowed($role, null, 'research_open') ? "$role:
> allowed" : "$role: denied";
> }
> // -
> 
> BUT, i can't access the ACL in another FooController.php
> Zend_Loader::loadClass('Zend_Acl');
> Zend_Loader::loadClass('Zend_Acl_Role');
> Zend_Loader::loadClass('Zend_Acl_Resource');
> $acl = new Zend_Acl;
> $acl->isAllowed('xxx', 'claim', 'create_claim') ? "myrole: allowed" :
> "myrole: denied";
> 
> i get an error that says:
> Fatal error: Uncaught exception 'Zend_Acl_Role_Registry_Exception' with
> message 'Role 'xxx' not found' 
> 
> how would i access the stuff i created in my AuthController.php from in
> other controllers/actions?
> so that I can do this: 
> $acl->isAllowed('xxx', 'claim', 'create_claim') ? "myrole: allowed" :
> "myrole: denied";
> in any part of my application?
> 
> any reply will be appreciated :)
> thanks


Re: [fw-general] modular layout and routing

2007-06-12 Thread Karol Grecki

Looks like you don't need modules at all.
Modules have controller which have actions.
Scrap modules and you have default controller, accounts controller etc.

Cheers
Karol



naioshi cozmicboy wrote:
> 
> each module having some actions (example):
> 
> - default (index, login, logout, sitemap, about, contact)
> - accounts (index, detail, add, edit, delete)
> - news (index, detail, add, edit, delete)
> - library (index, detail, add, edit, delete)
> - forum (index, detail, add, edit, delete)
> 

-- 
View this message in context: 
http://www.nabble.com/modular-layout-and-routing-tf3905241s16154.html#a11078505
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Cache, storing objects

2007-06-12 Thread Johannes Schill

Thank you!

On 6/6/07, Fabien MARTY <[EMAIL PROTECTED]> wrote:


2007/6/6, Johannes Schill <[EMAIL PROTECTED]>:
> I have some trouble with Zend_Cache.
> Im trying to store objects in my cache, but it seems like if everything
isnt
> stored. Is there anything wrong with the automatic serialization or am i
> just missing something (probably doing something wrong as usual:) )
> [...]

I think this piece of PHP manual could help you :

---
In order to be able to unserialize() an object, the class of that
object needs to be defined. That is, if you have an object $a of class
A on page1.php and serialize this, you'll get a string that refers to
class A and contains all values of variabled contained in $a. If you
want to be able to unserialize this on page2.php, recreating $a of
class A, the definition of class A must be present in page2.php. This
can be done for example by storing the class definition of class A in
an include file and including this file in both page1.php and
page2.php.

---

Regards,

--
Fabien MARTY
[EMAIL PROTECTED]



Re: [fw-general] Has someone gotten the same different results?

2007-06-12 Thread Partout


And is there some expert who could help me to find the cause? 

Thanks in advance! Et Merci beaucoop!

Best regards,
David


Partout wrote:
> 
> My question is about the zend_search_lucene. I have searched the index
> with below: 
>  
> "business controller"  AND shanghai 
> 
> There is about 300 hits. But when I search with LUKE Toolbox again with
> the same phrase string, there is about only 7 results, and that is correct
> for my case.  And, there is only 14 documents in my index containing
> "business controller"  phrase.
> 
> I need to know why the Luke toolbox's results is not the same with
> zend_search_lucence. Is there some configuration needed? I use the Zend
> 1.0.0 RC1, and my demo script is below:
> 
>  require_once 'Zend/Search/Lucene.php';
> $query = "\"business controller\" AND Shanghai";
> //Zend_Search_Lucene_Analysis_Analyzer::setDefault(new
> Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
> //Zend_Search_Lucene_Search_QueryParser::setDefaultOperator(Zend_Search_Lucene_Search_QueryParser::B_AND);
> $index = Zend_Search_Lucene::open('index');
> $hits = $index->find($query);
> echo "result:".count($hits);
> ?>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Search_Lucene-gives-the-different-results-with-Luke-Toolbox-when-searching-boolean-phrases-tf3894860s16154.html#a11077673
Sent from the Zend Framework mailing list archive at Nabble.com.