Re: [fw-general] Validation for multi-column unique constraints

2007-09-28 Thread Alex Netkachov
I prefer combination of the following methods:
1. Check the uniqueness using a SELECT query.
2. Display error
3. After fixing error, execute data modification statemenet.
4. In case of error I can do either of the following:
4.1. parse error message and display error or if it fails
4.2. just show the general database error message and optionally
4.3. show the general database error message with recording exact
message text to log

Sincerely,
Alex

On 9/29/07, lauren49 <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I understand that checking for a value's uniqueness against a db table
> within in application is not a stable method and should not be relied upon
> but the exception message thrown by a save attempt when a value is not
> unique really doesn't make much sense to the user
>
> Caught exception: Zend_Db_Statement_Exception
> Message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate
> entry '12-Report 21' for key 2
>
> Instead I'd rather report a more user-friendly error message to the user
> such as
>
> 'Report 21' already exists
>
> I'm very curious to hear how other's may have handled this problem.
>
> Thank you,
> Lauren
>
>
> --
> View this message in context: 
> http://www.nabble.com/Validation-for-multi-column-unique-constraints-tf4537684s16154.html#a12951118
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


-- 
http://www.alexatnet.com/ - consulting, blog, articles and support for
PHP, ZF, JavaScript and web development.


Re: [fw-general] Using Zend_Auth credential

2007-09-28 Thread Daniel Rossi
You might need to extend DB_Table and add an extra option. Is there  
such an API that already uses this and wraps with acls for groups /  
rights / permissions from a db ?


On 28/09/2007, at 7:19 PM, Michael Raymond wrote:


Hi all,

How can I achieve to authenticate users only if the user match  
their password and the status is active?


(in the user table status field value 1=active; 0=inactive)

AuthController

$authAdapter->setTableName($config->system- 
>userTableName);
$authAdapter->setIdentityColumn($config->system- 
>userColumn);
$authAdapter->setCredentialColumn($config->system- 
>passwordColumn);


$authAdapter->setIdentity($post->username);
$authAdapter->setCredential($post->password);

$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);




---







RE: [fw-general] PDO_MYSQL vs. MYSQLI

2007-09-28 Thread Andi Gutmans
Not sure what the answer is re: Zend_Db. Maybe Bill can answer when he's
back.
While MySQLi today is considered more mature, as Zend_Db is built on the
PDO interface there may be advantages to using pdo_mysql. Also, MySQL
has committed to PDO which means that any shortcomings will be
addressed.

You are likely not to go wrong with either...

Andi

> -Original Message-
> From: Josh Team [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 28, 2007 7:30 AM
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] PDO_MYSQL vs. MYSQLI
> 
> I personally like mysqli.
> 
> On 9/28/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> > -- Aljosa Mohorovic <[EMAIL PROTECTED]> wrote
> > (on Friday, 28 September 2007, 02:39 PM +0200):
> > > is there any difference in using MYSQLI or PDO_MYSQL?
> >
> > Yes. There are some methods that are specifically implemented in
> mysqli
> > that are not available to pdo_mysql (multi_query comes to mind).
That
> > said, MySQL has said they will be standardizing the
> > mysqli/mysqlnd/pdo_mysql drivers so they play nice together.
> >
> > --
> > Matthew Weier O'Phinney
> > PHP Developer| [EMAIL PROTECTED]
> > Zend - The PHP Company   | http://www.zend.com/
> >


[fw-general] Validation for multi-column unique constraints

2007-09-28 Thread lauren49

Hi,

I understand that checking for a value's uniqueness against a db table
within in application is not a stable method and should not be relied upon
but the exception message thrown by a save attempt when a value is not
unique really doesn't make much sense to the user

Caught exception: Zend_Db_Statement_Exception
Message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate
entry '12-Report 21' for key 2

Instead I'd rather report a more user-friendly error message to the user
such as

'Report 21' already exists

I'm very curious to hear how other's may have handled this problem.

Thank you,
Lauren


-- 
View this message in context: 
http://www.nabble.com/Validation-for-multi-column-unique-constraints-tf4537684s16154.html#a12951118
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Ldap authentication

2007-09-28 Thread Kexiao Liao

I try to use LDAP (Active Directory) Adapter to do the authentication against
Microsoft AD server using Ldap.php from the Zend Framework web site. Is
there any more information regarding how to use Ldap to bind to the AD
server?
-- 
View this message in context: 
http://www.nabble.com/Ldap-authentication-tf4536348s16154.html#a12946988
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Creating a admin 'page' using ZF's MVC

2007-09-28 Thread robert mena
Hi till,

Thanks for the reply.

I'll take that under consideration.   Probably in order to have some sort of
standard I will probably define that all admin actions for a given 'module'
will be put under a AdminSomethingController and put in init the
Zend_Auth/Acl to control the access to authenticated/authorized users.

- rb

On 9/26/07, till <[EMAIL PROTECTED]> wrote:
>
> On 9/26/07, robert mena <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am migrating my regular apps to use ZF's MVC.   Currently I have an
> admin
> > directory where I put all my php that perform administration actions and
> > protect this admin with a .htaccess.
> >
> > Ex. a news module
> >
> > /var/www/html/news.php
> > /var/www/html/admin/news/search.php add.php update.php
> > delete.php
> >
> > I already have all action in a controller and they are working fine but
> I
> > need to do something in order to :
> > a) force the admin actions to require authentication.  I already know
> how to
> > use Zend_Auth, but need to force this for several actions if possible
> > without repeating myself.  Should I put in init()?
>
> I think I put mine in preDispatch() but init() should work as well.
>
> > b) find out if it's better to have two separate controllers one for
> > 'outside' usage NewsController = i.e see the news, send comments, and
> other
> > AdminNewsController for all administrative tasks.
>
> You could make the actions and use Zend_Acl - at least that is what I
> would do if it's not too big of a project. If there is a lot of
> backend stuff to be done it might make also sense to do another
> NewsController - if complexity requires it.
>
>
> Cheers,
> Till
>


[fw-general] Return value of insert method of Zend_Db_Table_Abstract

2007-09-28 Thread Kexiao Liao

The return value of insert method of Zend_Db_Table_Abstract is a The primary
key of the row inserted. However When I try to access the return value, it
is just null, the new row has been successfully insert into table. 

Is there anyway we can get the primary key of this newly inserted row?
Thanks.


-- 
View this message in context: 
http://www.nabble.com/Return-value-of-insert-method-of-Zend_Db_Table_Abstract-tf4535082s16154.html#a12942350
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] howto save data after Zend_Filter_Input::isValid()?

2007-09-28 Thread Aljosa Mohorovic
so i have model (Zend_Db_Table_Row) and i pass data from model to
Zend_Filter_Input ($model->toArray()) and after i check if
$input->isValid() returns true i would like to save model with data
from Zend_Filter_Input because filters and validators are already
applied.

Zend_Filter_Input has setData() but no getData or getCleanData(), what
do you recommend?

Aljosa


Re: [fw-general] Zend_Currency Documentation

2007-09-28 Thread Darby Felton
Hi,

I'll remedy this oversight today. Thanks for the report!

Best regards,
Darby

Kamil wrote:
> There is no link in menu.
> 


Re: [fw-general] form generation functionality

2007-09-28 Thread Matthew Weier O'Phinney
Jurriën - 

-- Jurriën Stutterheim <[EMAIL PROTECTED]> wrote
(on Friday, 28 September 2007, 03:28 PM +0200):
> My Form proposal is a bit out of date (I need to find some time and  
> patience to update it ;), but the general idea I'm describing is  
> still valid.

I've been reading through all three current Zend_Form proposals. :-)

> To get a better picture of how I invisioned Zend_Form you could check  
> out my implementation from it's SVN:
> 
> http://tools.assembla.com/svn/zfcomponents/
> 
> In that implementation are two things not described in the proposal  
> yet: Builder classes and Plugins.
> 
> The builder plugins allow for form instancing from e.g. a Db_Table  
> object.

I'm approaching this slightly differently in my current iteration, and
instead having it in config files. With a config file implementation, it
would be trivial to also add on db support.

> The plugins can be used to customize the controller flow defined in  
> the FormHandler action helper.

I didn't see the class skeleton in the proposal before, but just now
looked at the action helper in your SVN repo. I see the hooks:

  * preHandling()
  * preProcess()
  * postProcess()
  * preAssign()
  * postAssign()
  * postHandling()

Can you give some use cases as to what you might do in each hook? I'm
not entirely sure how useful these would be, or what actions I might
want to perform.

Otherwise, your action helper is basically what I've been envisioning.
:-)

> For a demonstration on how it would work there is a sampleapp in the  
> Examples dir.
> 
> Also, I post form related stuff on my blog: www.norm2782.com
> 
> Hopefully my work on the form component will be a source of inspiration.

It has, as have the other proposals and frameworks I've been reviewing.

> Maybe we could discuss forms on #zftalk some time.

Ssshh... don't let others know I sometimes hang out in there... ;-)


> On 27 Sep 2007, at 15:20, Matthew Weier O'Phinney wrote:
> 
> >-- Daniel Rossi <[EMAIL PROTECTED]> wrote
> >(on Thursday, 27 September 2007, 10:59 AM +1000):
> >>Hi was wondering if there is any such forms generation functionality
> >>as yet when using the model classes ? I believe it would be a good
> >>thing to have although the form element generation currently is set
> >>in helpers ?
> >
> >I have been assigned as the Zend lead for a Zend_Form component,  
> >and am
> >currently reviewing the existing proposals as well as solutions in  
> >other
> >frameworks and languages.
> >
> >The current consensus is that the form component will collect form
> >elements, which will each have their own validations, filters, and
> >renderers (i.e., you will be able to specify the view helper used to
> >render a form element).
> >
> >However, the form component will initially be de-coupled from  
> >models as
> >we don't have any generalized solution for models yet (specific models
> >exist already, of course, in such components as Zend_Service, Zend_Db,
> >Zend_XmlRpc_Client, etc). In internal discussions, we've talked about
> >the possibility of adding form generation from models, and any  
> >solution
> >we adopt for a form component will be flexible enough to make this
> >possible.
> >
> >-- 
> >Matthew Weier O'Phinney
> >PHP Developer| [EMAIL PROTECTED]
> >Zend - The PHP Company   | http://www.zend.com/
> >
> 

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


Re: [fw-general] PDO_MYSQL vs. MYSQLI

2007-09-28 Thread Josh Team
I personally like mysqli.

On 9/28/07, Matthew Weier O'Phinney <[EMAIL PROTECTED]> wrote:
> -- Aljosa Mohorovic <[EMAIL PROTECTED]> wrote
> (on Friday, 28 September 2007, 02:39 PM +0200):
> > is there any difference in using MYSQLI or PDO_MYSQL?
>
> Yes. There are some methods that are specifically implemented in mysqli
> that are not available to pdo_mysql (multi_query comes to mind). That
> said, MySQL has said they will be standardizing the
> mysqli/mysqlnd/pdo_mysql drivers so they play nice together.
>
> --
> Matthew Weier O'Phinney
> PHP Developer| [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
>


Re: [fw-general] PDO_MYSQL vs. MYSQLI

2007-09-28 Thread Matthew Weier O'Phinney
-- Aljosa Mohorovic <[EMAIL PROTECTED]> wrote
(on Friday, 28 September 2007, 02:39 PM +0200):
> is there any difference in using MYSQLI or PDO_MYSQL?

Yes. There are some methods that are specifically implemented in mysqli
that are not available to pdo_mysql (multi_query comes to mind). That
said, MySQL has said they will be standardizing the
mysqli/mysqlnd/pdo_mysql drivers so they play nice together.

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


[fw-general] Controllers with no view object

2007-09-28 Thread redphantm

I want to make a model of a Tag table in a database. I want to be able to add
tags to many different other object such as Bugs or comments or products or
anything like that, but still have only one controller with the create,
remove, update, and delete actions. This would mean sticking to the Don't
Repeat Yourself (DRY) concept. Is the proper way to do this is make a
controller with these actions, but not have it render any views, and make
view helpers to get input boxes and such for it? i would think making middle
models such as BugTags for the linking.
-- 
View this message in context: 
http://www.nabble.com/Controllers-with-no-view-object-tf4534733s16154.html#a12941233
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Currency Documentation

2007-09-28 Thread Kamil

There is no link in menu.


Re: [fw-general] Zend_Currency Documentation

2007-09-28 Thread Thomas Weidner

Try this one...

http://framework.zend.com/manual/en/zend.currency.html

Greetings
Thomas
I18N Team Leader

- Original Message - 
From: "holografix ." <[EMAIL PROTECTED]>

To: 
Sent: Friday, September 28, 2007 3:16 PM
Subject: [fw-general] Zend_Currency Documentation



Hi

Am I missing something ? I can't find any documentation for Zend_Currency,
recently promoted to core.

Cheers
holo





Re: [fw-general] form generation functionality

2007-09-28 Thread Jurriën Stutterheim

Hi Matthew,


My Form proposal is a bit out of date (I need to find some time and  
patience to update it ;), but the general idea I'm describing is  
still valid.
To get a better picture of how I invisioned Zend_Form you could check  
out my implementation from it's SVN:


http://tools.assembla.com/svn/zfcomponents/

In that implementation are two things not described in the proposal  
yet: Builder classes and Plugins.


The builder plugins allow for form instancing from e.g. a Db_Table  
object.
The plugins can be used to customize the controller flow defined in  
the FormHandler action helper.


For a demonstration on how it would work there is a sampleapp in the  
Examples dir.


Also, I post form related stuff on my blog: www.norm2782.com

Hopefully my work on the form component will be a source of inspiration.

Maybe we could discuss forms on #zftalk some time.

On 27 Sep 2007, at 15:20, Matthew Weier O'Phinney wrote:


-- Daniel Rossi <[EMAIL PROTECTED]> wrote
(on Thursday, 27 September 2007, 10:59 AM +1000):

Hi was wondering if there is any such forms generation functionality
as yet when using the model classes ? I believe it would be a good
thing to have although the form element generation currently is set
in helpers ?


I have been assigned as the Zend lead for a Zend_Form component,  
and am
currently reviewing the existing proposals as well as solutions in  
other

frameworks and languages.

The current consensus is that the form component will collect form
elements, which will each have their own validations, filters, and
renderers (i.e., you will be able to specify the view helper used to
render a form element).

However, the form component will initially be de-coupled from  
models as

we don't have any generalized solution for models yet (specific models
exist already, of course, in such components as Zend_Service, Zend_Db,
Zend_XmlRpc_Client, etc). In internal discussions, we've talked about
the possibility of adding form generation from models, and any  
solution

we adopt for a form component will be flexible enough to make this
possible.

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





[fw-general] Zend_Currency Documentation

2007-09-28 Thread holografix .
Hi

Am I missing something ? I can't find any documentation for Zend_Currency,
recently promoted to core.

Cheers
holo


Re: [fw-general] Using Zend_Auth credential

2007-09-28 Thread Niko Sams
try this:
$authAdapter->setCredentialTreatment('? AND status=1')

however you should save your password encypted, and use something like this:
$authAdapter->setCredentialTreatment('PASSWORD(?) AND status=1')

niko

Am Freitag, 28. September 2007 schrieb Michael Raymond:
> Hi all,
>  
> How can I achieve to authenticate users only if the user match their
> password and the status is active?
>  
> (in the user table status field value 1=active; 0=inactive)
>  
> AuthController 
>  
> $authAdapter->setTableName($config->system->userTableName);
> $authAdapter->setIdentityColumn($config->system->userColumn);
>  
> $authAdapter->setCredentialColumn($config->system->passwordColumn);
>  
> $authAdapter->setIdentity($post->username);
> $authAdapter->setCredential($post->password);
>  
> $auth = Zend_Auth::getInstance();
> $result = $auth->authenticate($authAdapter);
>  


[fw-general] PDO_MYSQL vs. MYSQLI

2007-09-28 Thread Aljosa Mohorovic
is there any difference in using MYSQLI or PDO_MYSQL?

Aljosa


[fw-general] PDO_MYSQL vs. MYSQLI

2007-09-28 Thread Aljosa Mohorovic
is there any difference in using MYSQLI or PDO_MYSQL?

Aljosa


Re: [fw-general] PHP version question

2007-09-28 Thread Marco
>
> Does anyone use ZF on RHEL5 using its standard PHP 5.1 package? If so does
> ZF work fully?


AFAIK the min PHP version for ZF is 5.1.4, RHEL5 comes with 5.1.6 as default
so should work without any issues as long as you have the extensions for PDO
etc enabled if you require DB access.

Regards

Marco


[fw-general] PHP version question

2007-09-28 Thread Keith Pope

Hi,

Does anyone use ZF on RHEL5 using its standard PHP 5.1 package? If so does ZF 
work fully? 

Keith Pope
Web Developer
--

allpay.net Limited, Fortis et Fides, Whitestone Business Park, Whitestone, 
Hereford, HR1 3SE.

Registered in England No. 02933191. UK VAT Reg. No. 666 9148 88.



Telephone: 0870 243 3434, Fax: 0870 243 6041.

Website: www.allpay.net

Email: [EMAIL PROTECTED]



This email, and any files transmitted with it, is confidential and intended 
solely for the use of the individual or entity to whom it is addressed. If you 
have received this email in error please notify the allpay.net Information 
Security Manager at the number above.


Re: [fw-general] getRequest

2007-09-28 Thread Matthew Weier O'Phinney
-- Waigani <[EMAIL PROTECTED]> wrote
(on Thursday, 27 September 2007, 04:10 PM -0700):
> $request  = Zend_Controller_Front::getInstance()->getRequest();
> print_r($request);
> 
> in the bootstrap index.php prints nothing. 

Because it's not yet instantiated.

$front->dispatch() creates a request object if none has been set, which
is why you don't need to create one typically. However, prior to that,
unless you instantiate and attach your own, you won't get on back from
getRequest().

> I've tried everyway I can think of to getModuleName() from the
> bootstrap with no luck. I also tried $request = new
> Zend_Controller_Request_Http(); $request->getModuleName();

It won't contain the module name until *after* routing. The request
object, at initialization, is simply an encapsulation of the request
environment, and doesn't know how to associate portions of itself with
the module, controller, action, etc. The router makes those
associations.

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


Re: [fw-general] Adding params to the Request

2007-09-28 Thread Matthew Weier O'Phinney
-- Ralph Schindler <[EMAIL PROTECTED]> wrote
(on Thursday, 27 September 2007, 03:25 PM -0500):
> Actually, I did find that Rowset->toArray() does indeed return a
> reference to a protected member of the rowset object instead of an
> array.  I marked that as a bug for rowset.
> 
> http://framework.zend.com/issues/browse/ZF-1898
> 
> could that be the issue Matthew?

I just added the following to my tests:

class Foo
{
protected $_bar = array('la' => 'la', 'nanny' => 'goat');

public function &getBar()
{   
return $this->_bar;
}
}

$o = new Foo;
$req->setParams($o->getBar());
echo "Addended params:\n", var_export($req->getParams(), 1), "\n\n";

But this still worked fine. I'll see if I can recreate the issue
utilizing Zend_Db_Table shortly.


> Matthew Weier O'Phinney wrote:
> >-- Ralf Kramer <[EMAIL PROTECTED]> wrote
> >(on Thursday, 27 September 2007, 02:54 AM +0200):
> >>I'd like to inject the results of a DB operation to as params to the
> >>request. This happens within my controller.
> >>
> >>$user = $this->User->find( $user_id );
> >>$this->getRequest()->setParams($user->toArray());
> >>
> >>Now I'd like to gain access to this array within a view helper by:
> >>$value =  $this->request->getParam($paramName);
> >>
> >>But it fails, they dump of
> >>Zend_Debug::dump($this->request->getParams());
> >>shows:
> >>
> >>array(6) {
> >>  ["module"] => string(5) "admin"
> >>  ["controller"] => string(4) "user"
> >>  ["action"] => string(4) "edit"
> >>  ["user_id"] => string(1) "1"
> >>  ["layout"] => string(14) "layouts/quasda"
> >>  [0] => array(5) {
> >>["user_id"] => string(1) "1"
> >>["user_email"] => string(13) "[EMAIL PROTECTED]"
> >>["user_password"] => string(41) 
> >>"*B1EDFC17CD796ACEEF507E8DD7A0BE7367F13894"
> >>["user_firstname"] => string(4) "Ralf"
> >>["user_lastname"] => string(6) "Kramer"
> >>  }
> >>}
> >>
> >>Yesterday it worked, so I suspect the 1.0.2 Release to have changed the 
> >>logic of $rowset->toArray() or $request->setParams()?
> >
> >The issue definitely isn't in the request object. I just tried the
> >following:
> >
> >$req = new 
> >Zend_Controller_Request_Http('http://weierophinney.net/matthew');
> >$req->setParam('foo', 'bar');
> >$req->setParam('bar', 'baz');
> >echo "Original params:\n", var_export($req->getParams(), 1), "\n\n";
> >
> >$params = array('baz' => 'bat', 'fly' => 'away');
> >$req->setParams($params);
> >echo "Addended params:\n", var_export($req->getParams(), 1), "\n\n";
> >
> >and received what I'd expect:
> >
> >Original params:
> >array (
> >'foo' => 'bar',
> >'bar' => 'baz',
> >)
> >
> >Addended params:
> >array (
> >'foo' => 'bar',
> >'bar' => 'baz',
> >'baz' => 'bat',
> >'fly' => 'away',
> >)
> >
> >Take a look at what toArray() returns -- that may be the cause of the
> >issue.
> >
> 
> 

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


[fw-general] Using Zend_Auth credential

2007-09-28 Thread Michael Raymond
Hi all,
 
How can I achieve to authenticate users only if the user match their
password and the status is active?
 
(in the user table status field value 1=active; 0=inactive)
 
AuthController 
 
$authAdapter->setTableName($config->system->userTableName);
$authAdapter->setIdentityColumn($config->system->userColumn);
 
$authAdapter->setCredentialColumn($config->system->passwordColumn);
 
$authAdapter->setIdentity($post->username);
$authAdapter->setCredential($post->password);
 
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($authAdapter);
 
 


--- 




Re: [fw-general] Using a complete HTML Template

2007-09-28 Thread Martin Carpentier
P­ádraic, Matthew,

Thank you both for your excellent explanation. It's a lot clearer to me now.
All that's left to do is try it out and see how to implement both in my
application.

I'll report back the results.

Thanks,

Martin

On 9/26/07, Pádraic Brady <[EMAIL PROTECTED]> wrote:
>
> Hi Martin
> 
> >What is still not clear to me though is how they relate to each other.
>
> ZVE proposes a variety of helpers to facilitate some nifty dynamic View
> construction using partial templates, controller calls, and place holders.
> Zend_Layout will provide a high-level layout system. So both at present are
> complementary. In case its confusing - ZVE had a Layout component, but it
> will not be implemented in Zf Core (Zend_Layout enters here ;)).
>
> >Are they providing complementary functionnality to a (global) solution
> for layouts and templates ?
> >If so, how would they work together in an application ?
>
> Yes. ZVE is primarily template driven - so it operates at a lower level on
> any templates which are aggregated at the higher level represented as a
> Layout (Zend_Layout). A lot of it is just making reusable views more easily
> written and wired together.
>
> Regards,
> Martin
>
>
>
> On 9/20/07, Pádraic Brady < [EMAIL PROTECTED]> wrote:
> >
> > Hi Ralf,
> >
> > >The MVC component determines (somehow), based on the route, which view
> > >script is supposed to be rendered. This view script will have such a
> > >structure which renders a valid HTML document:
> >
> > The MVC component utilises an optional (enabled by default) plugin
> > called Zend_Controller_Action_Helper_ViewRenderer which insitutes a
> > convention of mapping Module/Controller/Action names to a relevent view
> > script name. So IndexController::saveAction() will automatically render the
> > view script at
> > {viewBasePath}/index/save.phtml.
> >
> > You can modify the convention by altering a few settings on the
> > ViewRenderer (covered at least once in the past day on the mailing lists
> > ;)). Or even disable the automated rendering if you prefer.
> >
> > >I'd like to have it vice versa, where the layout is a full HTML
> > document
> > >which renders the related view script. So I managed my application to
> > >work with this "layout" view script:
> >
> > Indeed, there have been proposals for achieving this hanging around from
> > months addressing the concept of common "Layouts". This was captured in two
> > proposals - Zend_View Enhanced and Zend_Layout. The Zend_Layout methodology
> > has been decided to be used in ZF 1.1 so I can point you to the
> > soon-to-be-official approach offered by Ralph Schindler.
> >
> > Unfortunately the ZF Wiki cannot be referred to since it is perfectly
> > useless to anyone in GMT and is presently offline as usual. But there's a
> > good blog post containing all the details and a brief tutorial of usage:
> > http://www.spotsec.com/blogs/archive/the-basics-of-zend_layout-ahem-xend_layout.html
> >
> >
> > In combination with Zend_Layout, pretty much all of the remaining
> > Zend_View Enhanced (excepting its Layout solution) is also to be implemented
> > in ZF 1.1. This adds concepts such as Partials, Components (controller
> > calls), Placeholders (capture data from view scripts for inclusion in a
> > Layout/Other View), and some other stuff.
> >
> > In combination, both ZL and ZVE should be sufficient to resolve most of
> > the problems people currently have with Zend_View.
> >
> > Regards,
> > Paddy
> >
> >
> > Pádraic Brady
> >
> > http://blog.astrumfutura.com
> > http://www.patternsforphp.com
> > OpenID Europe Foundation Member-Subscriber 
> >
> >
> > - Original Message 
> > From: Ralf Kramer <[EMAIL PROTECTED]>
> > To: fw-general@lists.zend.com
> > Sent: Thursday, September 20, 2007 12:30:46 AM
> > Subject: [fw-general] Using a complete HTML Template
> >
> > Hi,
> >
> > as I understood the common process of template rendering it works in
> > this manner:
> >
> > The MVC component determines (somehow), based on the route, which view
> > script is supposed to be rendered. This view script will have such a
> > structure which renders a valid HTML document:
> >
> > render('layouts/__header.phtml'); ?>
> > some stuff fromView ?> 
> > render('layouts/__footer.phtml'); ?>
> >
> >
> > I'd like to have it vice versa, where the layout is a full HTML document
> >
> > which renders the related view script. So I managed my application to
> > work with this "layout" view script:
> >
> > 
> > 
> > 
> > header stuff
> > render( $this->viewScript ) ?>
> > footer stuff
> > 
> > 
> >
> > In my controller I do this on postDispatch()
> > public function postDispatch()
> > {
> > $this->view->viewScript = $this->getRequest()->getControllerName()
> > . "/" . $this->getRequest()->getActionName()
> > . ".phtml";
> > $this->_helper->viewRenderer->renderScript("layouts/main.phtml" );
> > }
> >
> >
> > It works, but

[fw-general] Zend Framework templating

2007-09-28 Thread ApAdrian

Hi all.

I am new to Zend Framework and i have some questions that I could not find
any answer by google-ing.

For example: i have a regular category->products website. In the index
controller i have just an index method that will list some welcome messages
etc. I also have a controller named products.

So in controller Products i have a method list that will handle the listing
of products in specific category.

So far so good. The HTML page has some sections: on the top there is the
header with a menu, on the left is a list of categories, in the center is
the content area (different with each controller/method) then on the right a
list of hot items, top rated etc.

The problem is: how can I populate this sections without having to write a
code that will take the categories/hot products/top rated and pass it to the
$this->view object in every controller's init() function? I think it can be
done using Plugins or Helpers but i could not find anywhere any actual
tutorials on this.

If anybody has any ideea or maybe a link would be great.

Thanks,
Adrian
-- 
View this message in context: 
http://www.nabble.com/Zend-Framework-templating-tf4533176s16154.html#a12936760
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Forward to another module doesn't work

2007-09-28 Thread debussy007


It's getting worse with the time.
The day before yesterday I could not forward to module but I could forward
to action/controller

But sicne yesterday I cannot even forward to a controller, only action !!

Instead of telling me that it doesn't find the action in the current
cotnroller, 
the error message should tell me why it doesn't take the correct controller
I specify in the params. 
I have no inforamtion about this at all.
Also I checked my applciation structure, everything seems ok.

Please can you tell me how I can even debug this ??
Any tips ??

Thank you ! 


debussy007 wrote:
> 
> Hello,
> 
> Whenever I try to forward to another module, 
> it keep trying to find the action/controller inside the current module.
> It's like it doesn't consider the third parameter of _forward method,
> which specifies the module.
> 
> e.g. with this code in the "default" module : 
> 
> $this->_forward('index','auth','partners');
> return;
> 
> I have the following error : 
> 
> Uncaught exception 'Zend_View_Exception' with message 'script
> 'auth/index.phtml' not found in path
> (.\application\modules\default\views\scripts\)'
> 
> As you see it tries to find the action/controller in default module, even
> if I specified to find it in the "partners" module.
> 
> My application structure is the following :
> 
> - application
> |-- modules
> |--- admin
>|--- controllers
>|--- models
>|--- views
> |--- default
>|--- controllers
>|--- models
>|--- views
> |--- partners
>|--- controllers
>|--- models
>|--- views
> 
> I have the following in my bootstrap :
> 
> error_reporting(E_ALL|E_STRICT);
> date_default_timezone_set('Europe/Brussels');
> ini_set('display_errors', true);
> ini_set('include_path', ini_get('include_path') 
>   . PATH_SEPARATOR . './library'
>   . PATH_SEPARATOR . './application/modules/default/models/'
>   . PATH_SEPARATOR . './application/modules/partners/models/'
>   . PATH_SEPARATOR . './application/helpers/');
> [...]
> $front = Zend_Controller_Front::getInstance();
> $front->addModuleDirectory('./application/modules');
> $front->setBaseUrl($config->baseUrl);
> if($config->test) 
>   $front->throwExceptions(true);
> $front->dispatch();
> 
> Thank you for any help!
> 

-- 
View this message in context: 
http://www.nabble.com/Forward-to-another-module-doesn%27t-work-tf4526568s16154.html#a12936321
Sent from the Zend Framework mailing list archive at Nabble.com.