Re: [fw-general] Best practice to share identity map across mappers? Static registry?

2009-08-31 Thread Marian Meres
Hello Hector,

 Is there a reason you don't want to go with a static identity map?

Well, I consider usage of static map in this case most simple and even correct.

But as I'm in the planning phase and always questioning the design, I
want to make sure I'm doing it the correct way. And after reading many
posts on this topic recently from people I consider much more
experienced (among others mainly Matthew's), it looks like trying to
avoid the static registry usage may be worth the energy. Perhaps even
if I am unable to clearly see the reasons (other than testing)...

Thanks.

M.

Some notes here: http://misko.hevery.com/code-reviewers-guide/


On Mon, Aug 31, 2009 at 6:34 AM, Hector Virgen djvir...@gmail.com wrote:

 Marian,
 A static identity map is the way to go. Page 291 of Php objects, patterns, 
 and practice by Matt Zandstra demonstrates how to build a simple but 
 effective identity map. Is there a reason you don't want to go with a static 
 identity map?
 --
 Hector


 On Sun, Aug 30, 2009 at 10:32 AM, Marian Meres marian.me...@gmail.com wrote:

 Hello Benjamin,

 thank you... but either I can't follow, or I must not have described 
 properly the question. Because I do not understand how the factory could 
 help you to share the map, unless you do not share the factory then...

 Example:

 class MapperFactory
 {
    protected $_identityMap;
    public function create($name)
    {
        $mapperClass = $this-_somePrefix . $name;
        $mapper = new $mapperClass();
        $mapper-setIdentityMap($this-getIdentityMap($name));
        return $mapper;
    }
 }

 // somewhere in log on (user service)
 $mapperFactory = new MapperFactory();
 $userMapper = $mapperFactory-create('user');
 $user = $userMapper-find(1); // find also saves the user identity.

 // somewhere in article model
 class Article
 {
    // lazy load author
    public function getAuthor()
    {
        if (null == $this-_author) {
            $mapperFactory = new MapperFactory();
            $userMapper = $mapperFactory-create('user');
            $this-_author = $userMapper-find($this-_authorId);
        }
        return $this-_author;
    }
 }

 My question is, how to design the whole thing so that the later model can 
 reuse the identity set in the log on service (if applicable), while trying 
 to avoid implementing static something somewhere. My understanding is, that 
 without introducing new domain superlayer this could hardly be done, but 
 is it worth it then? Why just not live with the static, with proper 
 resetings (I know the test issues).

 Zend_Application is nice example where it works well (the good, non static 
 container), but is this approach applicable to pure domain classes, where 
 there is no front controller to pull the container from?

 Thank you again.

 And, BTW, respect for the Zend_Entity work! Very inspiring.

 Regards,
 M.


 On Sun, Aug 30, 2009 at 5:17 PM, Benjamin Eberleikont...@beberlei.de wrote:
  hello,
 
  If you dont instantiate your mappers through a factory you probably will 
  have
  lots of work to do if you dont make access to the identity map global via a
  static method.
 
  greetings,
  Benjamin
 
  On Sunday 30 August 2009 04:58:32 pm Marian Meres wrote:
  Hi All,
 
  I have many domain models where each has its own data mapper. These
  mappers are spread across many places as a) services use mappers, b)
  mapper x uses mapper y, c) and even models use mappers (only in the
  case of lazy loading).
 
  I want mappers to utilize the identity map pattern (which is itself
  pretty straightforward). I guess the whole pattern makes more sense
  when used as a shared map across the mappers rather than for each to
  have its own.
 
  Since the mappers usage (and instantiation) is wide spread (at least
  in my case), the only solution I could think of is always a sort of a
  static one (either through static members, or static managers, or
  even some injectable containers which default to static
  Zend_Registry).
 
  What would you suggest, other than the static way?
 
  Thank you in advance.
 
  M.
 
 
  --
  Benjamin Eberlei
  http://www.beberlei.de
 




Re: [fw-general] Complex ACL

2009-08-31 Thread debussy007

About privileges, all depends how you're going to code it I guess.
Concretely (for the access rights) I have my controllers as resources and
actions as privileges. 
My controller names are litteraly stored in my DB, however I am conscious
that the Model shouldn't know about the Controller or the View. So that's
what you're trying to achieve, I suggest you to read that article:
http://www.aviblock.com/blog/2009/03/19/acl-in-zend-framework/
Note that he doesn't mention privileges when he's showing the snippet of
code to suggest.
As in my case, it allows simply to do something like:
$resource = $request-getControllerName();
$privilege = $this-getPrivilege($request-getActionName());
$role = Zend_Auth::getInstance()-getIdentity()-username;
$acl-isAllowed($role, $resource, $privilege)

However I realize right now that I'll need a supplementary ACL object for
the edition accesses. Some users may have access only to some limited
parts of the site and this cannot be conveyed by controller names. Then I'll
need a third one for the other modules (public site) as those will be
implemented as the customer wants it, which again, may not be based on
controller names.
O gosh ..

By doing it abstract you won't encoutner those problems, but I guess it will
be more fastidious to code it.



netlynx wrote:
 
 
 debussy007 wrote:
 
 1. Where are the privileges ?
 It seems that often in a CMS there are privileges, e.g. a user may be
 able to view the list of pages but not to update them. Some may
 publish or delete them, etc. 
 Of course you can keep it simple but keep this into mind if you have to
 implement it some day.
 
 
 Ahh, I see what you are saying, I was making the assumption in my logic
 that a role would carry certain privileges.  In this respect, an author
 say would have the privilege of creating a document/article, and editing
 their 'own' document.  An editor would have rights to create and edit any
 document.  A publisher would have rights to publish, but not edit
 documents.  So in answer to your question, I was just assuming the
 privileges based on their role, however, I should not have assumed that, I
 will consider that in my schema.
 
 
 debussy007 wrote:
 
 2. Groups - Roles
 I see that you have a many to many connection between your groups and
 roles. Why don't you simply make of a group a role, and delete the
 UserRole, GroupRole and Roles table ? To affect roles to a user you would
 simply affect them to one or more groups which each may inherit of other
 groups. In my case I have a hierarchy in Groups table.
 If the user is not inside a group, he has access to nothing. 
 Of course you'll have to add a table between your roles and your
 resources.
 
 
 I was trying to figure that out too, my logic on this point was a group,
 could have 1 or more roles assigned to it (ie.  group:
 {category}_forum_moderators, could post messages (role:author), and
 accept/reject others messages (role: moderator)) and a role could be
 assigned to multiple groups (ie. group: {category}_forum_moderators (role:
 author), and {category}_forum_members {role: author}).  Looking at it from
 that perspective, I suppose it could be viewed your way too, by making a
 user part of the {category}_forum_moderator *and* the
 {category}_forum_member groups, thus also giving them the same rights.  My
 main thoughts behind this is essentially to make this as flexible as
 possible.  If you look at an operating system privileges structure, you
 basically have user/group/everyone -- read/write/execute privileges
 (windows of course breaks this down a little further but essentially the
 same idea).  A CMS would incorporate a slightly more granular set of rules
 (overall read/create/delete/modify), but in the case of say a publisher
 having rights to publish a document, well, that is 'modify' rights, but
 only allows them to modify the published field of a document, not 'modify'
 rights to modify the contents of the document.  So I think I still like
 the group concept, and the roles would define the granular access of the
 group and/or the user.
 
 
 debussy007 wrote:
 
 3. Content rights
 I have supplementary tables to handle the access on specific parts/pages
 of the site. Each group of user may have access on specific category's of
 the site.
 So I distinguish two kind of groups: access groups which restrict the
 access on the cms admin interface (menu manager, layout manager, images
 library, etc.) with the content groups (restrict the access to some
 part of the site). Don't know what you think about this, tell me )
 
 
 I think that goes back to part 2.  I see what you are saying, and I think
 in my layout, I am just defining both types of groups under one category. 
 From a security standpoint, I am actually considering moving the admin
 stuff to a completely different server, possibly a different
 domain/subdomain (though thats just a side thought right now).  *However*
 limited administrative tasks specifically related to things 

Re: [fw-general] Zend Single Quote Problem

2009-08-31 Thread Matthew Weier O'Phinney
-- pyarlagadda yarlagadda...@gmail.com wrote
(on Sunday, 30 August 2009, 04:38 PM -0700):
 I have a problem displaying the single quote on HTML using Zend Framework.
 
 I have a string stored in MySQL database. I fetch it using Zend Framework,
 escape it using $this-escape($string) and then try to display. When I do
 that, it is shown like:
 
 �Swiss banks�
 
 The frist and last characters are supposed to be single quotes.
 
 I can display it with Single Quotes without using Zend framework by directly
 connecting to MySQL and then escaping it with htmlspecialchars function. I
 tried to using htmlspecialchars after fetching the data using Zend
 framework. It simply doesn't work. 
 
 Can somebody help me figure out what is wrong with the Zend framework while
 displaying the Single Quotes?

Most likely it's an encoding issue.

Internally, Zend_View uses htmlspecialchars() by default when you call
escape() -- but it does so using the encoding 'ISO-8859-1' (Latin-1) by
default as well. It's likely that your single quotes are stored in the
database as special characters outside the Latin-1 character set. Try
setting your view's encoding to UTF-8 to see if that corrects the issue.

You can accomplish this in a couple of ways:

 * If you are initializing Zend_View via configuration with
   Zend_Application, simply specify an encoding key for the View
   resource:

   resources.view.encoding = UTF-8

 * Manually update it prior to calling escape() by calling the
   setEncoding() method:
 
   $view-setEncoding('UTF-8');

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


[fw-general] Zend_Search_Lucen setting rank of individual field

2009-08-31 Thread Joó Ádám
Hi,

I’m a bit confused about Zend_Search_Lucen’s query boosting. How can I
specify how valuable is a hit on a specific field? E.g. i want an
expression to have a higher rank in a title field than in a content
field.

Any method to achieve this?


Thanks,
Ádám


Re: [fw-general] Modular layout and ACL - how to make it work and make it easy.

2009-08-31 Thread Ralph Schindler

Wow, lots going on here.  I'll try to help where I can.

I actually blogged about the situation you descibed about blog posts and 
owners:


http://ralphschindler.com/2009/08/13/dynamic-assertions-for-zend_acl-in-zf

In that scenario, your assertion would likely be interacting with the 
database to determine the proper conclusion.


As for the other modules, you can probably take advantage of the module 
initialization:


http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.modules

This will allow you to set things up prior to routing (if there is an 
application wide ACL object.)  This way, each module can inject its own 
rules into the ACL for the rest of the system to consume, if that is 
your intended goal.


I would assume that since you are using a database to store the fine 
grained information, you'll likely be using the ACL to describe what 
roles have access to as opposed to what exact users have access to. 
This is where your system will become assertion heavy, which IMO is not 
a bad thing.  It keeps the ACL checks fairly succinct throughout the 
rest of the applicaiton, and most of the actual business logic for 
determining access inside your assertions, which are more than likely 
inside your models folder (you are modeling access controls after all).


Hope this gets you started,
ralph


taking assertions into consideration. Some modules, such as the Blog, 
needs to make use of assertions to allow the owner of a post to edit it 
but not edit every other post. So ok, each module also implements some 
assertions. But how do I, when constructing the ACL from the database, 
take assertions into consideration? My first idea was to store assertion 
names in the database to, when registering a module. So that when 
building the ACL and stumbling across a resource which needs to have 
access defined with an assertion in it, the assertions class name such 
as Blog_Acl_Assertion_IsPostOwner and it would then instantiate the 
assertion class when building the ACL. But somehow, I don't find that 
idea very appealing.
 
Therefore, I'd like to query you guys if you experience with working 
with something like this or just an idea on how to make this happen.
 
Thank you for reading on through all my babble.
 
Kind regards

Christian Rasmussen


Re: [fw-general] Zend_Tool and modules

2009-08-31 Thread Ralph Schindler

Thats a good point, can you open an improvement issue for it?

Thanks,
Ralph

iceangel89 wrote:
i noticed Zend_Tool still does not handle modules very well. 

1. upon creation i think 


resources.frontController.moduleDirectory = APPLICATION_PATH /modules

should be added to application.ini

2. Class names should be named with the Module prefix 


eg. Admin_IndexController


Re: [fw-general] Problem with setRedirect() -- it's not redirecting

2009-08-31 Thread Ralph Schindler
Hmm. $response-setRedirect() assumes you are providing it a url so its 
probably best if that were an absolute path.


Also, it does not stop the dispatchloop from executing, so you might 
have to do $request-setDispatched(true);


To get a sense of how redirecting is handled, you might want to have a 
look at the Redirector action helper:


http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Controller/Action/Helper/Redirector.php

specifically, have a look at gotoUrl() as well as redirectAndExit()

-ralph


Gregorio wrote:

Hello, everybody:

I've got a controller helper plugin that has a preDispatch method in it.

It's checking to see if the user has logged in via an off-site
authentication service, and if not, redirects the user to an Authentication
controller do that part of the work.

However, the redirect isn't working. I took a look at the header stack and
it wasn't there. However, if I add a dummy header, it works. Here's some
code to help explain:


class Plugin_CasAuth extends Zend_Controller_Plugin_Abstract
{
   
public function preDispatch(Zend_Controller_Request_Abstract $request)

{
$request = $this-getRequest();
$response = $this-getResponse();
$session = new Zend_Session_Namespace('Zend_Auth');

// No need for any more processing if this is the Authenticate
controller.
if ('authenticate' === $request-getControllerName()) {
return true;
}
 
if (empty($session-storage))

{
$response-setRedirect('authenticate');
// If I comment the following line, there's no redirect. User
gets sent
// directly to the main index controller.
$response-setHeader(Test, This is a test!);
}
}
}


The problem is in the last if block.

Any ideas?

Thanks!
Greg 


[fw-general] Idea for desinging this form

2009-08-31 Thread neobeacon

http://www.nabble.com/file/p25228110/Picture1.png 

I hope to use parial() view helper to add Meta data Information  div and
the Tinymce textarea divs from script files.

If I add other whole form to view and if form submitted to submittedform
action(action = /submittedform),How to I access posted data?


In other word If I add a form only by view,How to get POST values and can I
set validaters and filters for elements.

If you have any idea please post to me.Thanks
-- 
View this message in context: 
http://www.nabble.com/Idea-for-desinging-this-form-tp25228110p25228110.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Application module resource types

2009-08-31 Thread hobodave

I'm struggling trying to get this working. 

I need to add a resourceType to all of my modules:

'report' = array(
'path' = 'reports/',
'namespace' = 'Report'
)

Is there a way to do this in a DRY fashion? Id rather not add a
Bootstrap.php class for all of my modules. Can this be done just in a
_initModules() method in application/Bootstrap.php? If so, how? The only way
I can see to do it, is to iterate over the modules, which seems clunky as
I'm sure something else in the bootstrap process is already doing that.
Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Zend_Application-module-resource-types-tp25229498p25229498.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to email the result of a dispatched request (or better how to save generated html)

2009-08-31 Thread David Mintz
On Sun, Aug 30, 2009 at 9:31 AM, fab2008 f.napole...@gmail.com wrote:


 Hi all,

 I have a page with some news generated using ZF stack (Zend_MVC,
 Zend_Layout, Zend_View, Zend_Navigation, etc); this page is available for
 web browsing, but I need also to email this page with some additional info.
 Suppose I have a link like Send this page to a friend that bring to a
 form
 with from and to fields and a name field. When an user fill this form I
 want
 to email the complete news page (possibly using a different layout) with an
 header div that says This page was sent to you by friend_name
 friend_email.

 I want to avoid duplication of code, so I want to use the same
 implementation of the web page, but i need the generated content in a
 string, in this way I can email the generated HTML.

 Which is the best way for doing this in a controller action?



within a controller action, I have done something like

$this-_helper-layout-setLayout('foobaz');
$mailer = new Zend_Mail( );
$mailer-addTo( $user-email, $user-firstname $user-lastname )
 -setBodyText ( $this-view-render( 'your/view.phtml' ) )
-setFrom ( 'interpret...@nysd.uscourts.gov', Southern District
Interpreters )-setSubject ( SDNY Interpreters: Password Retrieval
)-send ();
}




-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


[fw-general] uasort, or functions that requiere a callback

2009-08-31 Thread j.padron

Hi,

I have a DB model class (extends Zend_Db_Table_Abstract) from where I return
data. In one of the methods I have to uasort(array, callback) arrays
(several merged). The problem is that I don't know where to put and declare
the function compare and call it as string like uasort requiere.

Where must I put this function, inside dir estructure, in order to be
accesible from my model?

Thanks in advance.
Jorge
-- 
View this message in context: 
http://www.nabble.com/uasort%2C-or-functions-that-requiere-a-callback-tp25229618p25229618.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to email the result of a dispatched request (or better how to save generated html)

2009-08-31 Thread David Mintz
On Mon, Aug 31, 2009 at 4:01 PM, David Mintz vtbludg...@gmail.com wrote:



 On Sun, Aug 30, 2009 at 9:31 AM, fab2008 f.napole...@gmail.com wrote:


 Hi all,

 I have a page with some news generated using ZF stack (Zend_MVC,
 Zend_Layout, Zend_View, Zend_Navigation, etc); this page is available for
 web browsing, but I need also to email this page with some additional
 info.
 Suppose I have a link like Send this page to a friend that bring to a
 form
 with from and to fields and a name field. When an user fill this form I
 want
 to email the complete news page (possibly using a different layout) with
 an
 header div that says This page was sent to you by friend_name
 friend_email.

 I want to avoid duplication of code, so I want to use the same
 implementation of the web page, but i need the generated content in a
 string, in this way I can email the generated HTML.

 Which is the best way for doing this in a controller action?



[Damn this gmail! your focus accidentally gets on the send button and you
press the wrong key and presto! your email is sent prematurely, speaking of
email. Hate it when that happens. Anyway, I meant to say...]

$this-_helper-layout-setLayout('foobaz');
$mailer = new Zend_Mail();
$mailer-addTo( $user-email, $user-firstname $user-lastname )
   -setBodyHtml( $this-view-render( 'your/view.phtml' ) )
   -setFrom ( 'some...@example.org', Whomever )
   -setSubject ( Your subject line )
   -send ();

HTH.



-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness


Re: [fw-general] Best practices, environment setup

2009-08-31 Thread swilhelm

I would also be interested in such 'best practices.' 

I am using a git repository and deploying to media temple and slicehost
hosted staging and production servers. 

I would also be interested in seeing how people develop a single admin
module that can be leveraged across several different websites (that is to
say the code is shared, but the roles, application contollers and user
databases differ across sites).

- Steve W. 


Themselves wrote:
 
 I've been looking for something like this too. It's all well and fine to
 install all the Zend products with the intention of integrating them in to
 a
 homogenous whole, but the reality is that there's very little in the way
 of
 documentation looking at the problem from a broader development
 perspective.
 I'm trying to nut my way through and develop my own series of best
 practices
 with regards to all this, but my particular sticking point is still the
 Zend
 Server to Zend Studio integration, which seems to be focused around using
 your local machine as the development server - a situation which obviously
 doesn't scale terribly well. I've tried finding some good examples of
 using
 external Zend Server instances via a local Zend Studio, but so far,
 nothing...
 
 On Fri, Aug 28, 2009 at 5:28 AM, Robert Gormley rgorm...@mgcare.com
 wrote:
 
  Has anyone got a good pointer to a resource, or able to offer some
 advice, on a ‘best practices’ set-up for ZF, Server, for use with
 Studio...
 Something that’s nicely organized and elegant. Things like


- nice ways to address development and test environments on the same
server (use of Apache ENV for example, or hostname)
- awareness of multiple sites on the same server
- other common best practices, like ‘root of the project’ being
 outside
the web root, etc


 I realize these are all fairly common/well-known things, but I’m trying
 to
 find a nice document/blog, what have you, that does a good job of
 encapsulating a lot of these ‘best practices’.

 Robert

 
 

-- 
View this message in context: 
http://www.nabble.com/Best-practices%2C-environment-setup-tp25180222p25230154.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: Re: [fw-general] Best to use CLI in my ZF 1.9 Application

2009-08-31 Thread swilhelm

should optionally require admin credentials passed as arguments or should
confirm CLI is being run by particular system users (e.g. root).


lightflowmark wrote:
 
 I'm actually working on a proposal to do exactly this at the moment.
 
 What features would people like to see on this?
 
 Currently, the proposed Zend_Schedule component will:
 1)  be run via CLI scripts from the cron
 
 2)uses Zend_Application to load the bootstrap of an existing
 application to load config, include paths, etc.
 
 3)load user-written classes which define tasks - e.g. mailTasks,
 databaseTasks, etc.
 
 4)run functions from those classes based on a prefix - e.g. you might
 have a script running every day which runs all functions prefixed 'daily',
 which would run mailTasks::daily_Emails(),
 databaseTasks::daily_DoArchiving(), etc. and another script running every
 hour which would run all functions prefixes 'hourly' 
 
 It's actually very simple to implement as outlined, and I'd be interested
 to see what other features people would want from this.
 
 Yours,
 Mark
 
 
 
 
 Raphael Stolt-2 wrote:
 
 Hi Stefan,
 
 
 
 
 You might also take a look at Zend_Tool_Project_Providers which allow you
 to
 create custom providers which handle the scenarios you described in the
 first mail. Plus by hooking them into the Zend Tool environment you can
 call
 them as desired via CLI.
 
 Hope that helps a bit.
 
 Cheers,
 
 Raphael Stolt
 
 2009/8/20 Stefan Sturm stefan.s.st...@googlemail.com
 
 Hello,

 I found this tutorial to setup a cli enviroment:

 http://webfractor.wordpress.com/2008/08/14/using-zend-framework-from-the-command-line/

 But I would like to use Zend_Application to handle this...

 Perhaps somebody can help me on this.

 Thanks and greetings,
 Stefan Sturm

 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Best-to-use-CLI-in-my-ZF-1.9-Application-tp25045676p25230433.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] uasort, or functions that requiere a callback

2009-08-31 Thread j.padron

Reply myself

Place the protected function inside the class, and call:

uasort($result, array($this, 'orderArrayNatural'));

Thxs anyway


j.padron wrote:
 
 Hi,
 
 I have a DB model class (extends Zend_Db_Table_Abstract) from where I
 return data. In one of the methods I have to uasort(array, callback)
 arrays (several merged). The problem is that I don't know where to put and
 declare the function compare and call it as string like uasort requiere.
 
 Where must I put this function, inside dir estructure, in order to be
 accesible from my model?
 
 Thanks in advance.
 Jorge
 

-- 
View this message in context: 
http://www.nabble.com/uasort%2C-or-functions-that-requiere-a-callback-tp25229618p25230702.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] How to email the result of a dispatched request (or better how to save generated html)

2009-08-31 Thread fab2008

After some trials I decided to switch to a CLI version of this script,
because in some cases I need to send the same email to multiple recipients.
My solutions is similar to yours, this is a proof of concept:

// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, 
APPLICATION_PATH . '/configs/application.ini');
$application-bootstrap();

$view = new Zend_View();
$view-setScriptPath(APPLICATION_PATH . '/views/scripts/index');

$articles = new Mailing_Model_Articles();

$view-articles = $articles-fetchTodaysNews();

$layoutVars = array ();

$layoutVars['content'] = $view-render('index.phtml');

$layout = new Zend_Layout(
array (
'layoutPath' = APPLICATION_PATH . 
'/layouts/scripts/', 
'view' = $view));

$friends = array (
array ('name' = 'friend1', 'email' = 'f...@example.com'), 
array ('name' = 'friend2', 'email' = 'b...@example.com'));

$mail = new Zend_Mail();
$mail-setSubject('News')-setFrom('f...@example.com');

foreach ($friends as $friend) {
$view-friend = $friend['name'];
$layout-assign($layoutVars);
$mail-addTo($friend['email']);
$mail-setBodyHtml($layout-render());
$mail-send();
$mail-clearRecipients();
}

Thanks anyway for your response.


David Mintz-2 wrote:
 
 On Mon, Aug 31, 2009 at 4:01 PM, David Mintz vtbludg...@gmail.com wrote:
 
 [Damn this gmail! your focus accidentally gets on the send button and you
 press the wrong key and presto! your email is sent prematurely, speaking
 of
 email. Hate it when that happens. Anyway, I meant to say...]
 
 $this-_helper-layout-setLayout('foobaz');
 $mailer = new Zend_Mail();
 $mailer-addTo( $user-email, $user-firstname $user-lastname )
-setBodyHtml( $this-view-render( 'your/view.phtml' ) )
-setFrom ( 'some...@example.org', Whomever )
-setSubject ( Your subject line )
-send ();
 
 HTH.
 
 -- 
 David Mintz
 http://davidmintz.org/
 
 The subtle source is clear and bright
 The tributary streams flow through the darkness
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-email-the-result-of-a-dispatched-request-%28or-better-how-to-save-generated-html%29-tp25211572p25230917.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Problem with setRedirect() -- it's not redirecting

2009-08-31 Thread Gregorio


Hi, Ralph:

Thanks for taking the time to check this out and for the lead.

$response-sendHeaders() seems to have done it.

I see what you mean about setRedirect(); Is there a better way than using
Response's setRedirect() method? Maybe something that has a signature like
this:
setRedirect($controller, $action)

Thanks!
Greg




Ralph Schindler-2 wrote:
 
 Hmm. $response-setRedirect() assumes you are providing it a url so its 
 probably best if that were an absolute path.
 
 Also, it does not stop the dispatchloop from executing, so you might 
 have to do $request-setDispatched(true);
 
 To get a sense of how redirecting is handled, you might want to have a 
 look at the Redirector action helper:
 
 http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Controller/Action/Helper/Redirector.php
 
 specifically, have a look at gotoUrl() as well as redirectAndExit()
 
 -ralph
 
 
 Gregorio wrote:
 Hello, everybody:
 
 I've got a controller helper plugin that has a preDispatch method in it.
 
 It's checking to see if the user has logged in via an off-site
 authentication service, and if not, redirects the user to an
 Authentication
 controller do that part of the work.
 
 However, the redirect isn't working. I took a look at the header stack
 and
 it wasn't there. However, if I add a dummy header, it works. Here's some
 code to help explain:
 
 
 class Plugin_CasAuth extends Zend_Controller_Plugin_Abstract
 {

 public function preDispatch(Zend_Controller_Request_Abstract
 $request)
 {
 $request = $this-getRequest();
 $response = $this-getResponse();
 $session = new Zend_Session_Namespace('Zend_Auth');
 
 // No need for any more processing if this is the Authenticate
 controller.
 if ('authenticate' === $request-getControllerName()) {
 return true;
 }
  
 if (empty($session-storage))
 {
 $response-setRedirect('authenticate');
 // If I comment the following line, there's no redirect. User
 gets sent
 // directly to the main index controller.
 $response-setHeader(Test, This is a test!);
 }
 }
 }
 
 
 The problem is in the last if block.
 
 Any ideas?
 
 Thanks!
 Greg 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-setRedirect%28%29it%27s-not-redirecting-tp25193870p25231923.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Zend_Search_Lucene: Read-only access to index?

2009-08-31 Thread mooware

Hello there,

I have an index generated by Apache Lucene, and I'd like to access it with
Zend_Search_Lucene, but only for searching.
When I give PHP write access to the index, it works flawless, but I don't
want it to have write access.
But when I take away the write access, I get an error because
Zend_Search_Lucene tries to create a lock-file called 'read.lock.file'.

Can I somehow switch this behaviour off? I only want to read the index, so I
don't think the lock-file would be necessary.

Thanks for your help!
-- 
View this message in context: 
http://www.nabble.com/Zend_Search_Lucene%3A-Read-only-access-to-index--tp25232681p25232681.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend Single Quote Problem

2009-08-31 Thread pyarlagadda

It solved the problem. Thank you very much Matthew.

Regards,
Praveen

Matthew Weier O'Phinney-3 wrote:
 
 -- pyarlagadda yarlagadda...@gmail.com wrote
 (on Sunday, 30 August 2009, 04:38 PM -0700):
 I have a problem displaying the single quote on HTML using Zend
 Framework.
 
 I have a string stored in MySQL database. I fetch it using Zend
 Framework,
 escape it using $this-escape($string) and then try to display. When I do
 that, it is shown like:
 
 �Swiss banks�
 
 The frist and last characters are supposed to be single quotes.
 
 I can display it with Single Quotes without using Zend framework by
 directly
 connecting to MySQL and then escaping it with htmlspecialchars
 function. I
 tried to using htmlspecialchars after fetching the data using Zend
 framework. It simply doesn't work. 
 
 Can somebody help me figure out what is wrong with the Zend framework
 while
 displaying the Single Quotes?
 
 Most likely it's an encoding issue.
 
 Internally, Zend_View uses htmlspecialchars() by default when you call
 escape() -- but it does so using the encoding 'ISO-8859-1' (Latin-1) by
 default as well. It's likely that your single quotes are stored in the
 database as special characters outside the Latin-1 character set. Try
 setting your view's encoding to UTF-8 to see if that corrects the issue.
 
 You can accomplish this in a couple of ways:
 
  * If you are initializing Zend_View via configuration with
Zend_Application, simply specify an encoding key for the View
resource:
 
resources.view.encoding = UTF-8
 
  * Manually update it prior to calling escape() by calling the
setEncoding() method:
  
$view-setEncoding('UTF-8');
 
 -- 
 Matthew Weier O'Phinney
 Project Lead| matt...@zend.com
 Zend Framework  | http://framework.zend.com/
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend-Single-Quote-Problem-tp25216714p25232860.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Getting POSTed values of a form which build by view script

2009-08-31 Thread neobeacon

If I build a form by using  view script (using html tags/without using zend's
form elements) how to get posted values from action's page ?
-- 
View this message in context: 
http://www.nabble.com/Getting-POSTed-values-of-a-form-which-build-by-view-script-tp25233310p25233310.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Getting POSTed values of a form which build by view script

2009-08-31 Thread neobeacon

If I build a form by using  view script (using html tags/without using zend's
form elements) how to get posted values from action's page ?
-- 
View this message in context: 
http://www.nabble.com/Getting-POSTed-values-of-a-form-which-build-by-view-script-tp25233309p25233309.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Getting POSTed values of a form which build by view script

2009-08-31 Thread Brenton Alker
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

neobeacon wrote:
 If I build a form by using  view script (using html tags/without using zend's
 form elements) how to get posted values from action's page ?

In a controller action:

$this-_request-getPost(); // will return an array of all $_POST values
$this-_request-getPost('name'); // will return the value of $_POST['name']
and
$this-_getParam('name'); // will return something similar to
$_REQUEST['name'] (the value from a combination of $_GET and $_POST, but
includes data parsed from the route)

- --

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/
http://twitter.com/tekerson

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqcgzMACgkQ7bkAtAithusztQCeJt/2yWwsPJmv0IXt3oXUmPwa
UNwAn1wex5Dy7mJuKsT56KTkUygsc7mS
=MhWN
-END PGP SIGNATURE-


Re: [fw-general] Zend_Tool and modules

2009-08-31 Thread iceangel89

ok created an improvement issue
http://framework.zend.com/issues/browse/ZF-7743. i hope its done ok, its my
1st time adding an issue

Ralph Schindler-2 wrote:
 
 Thats a good point, can you open an improvement issue for it?
 
 Thanks,
 Ralph
 
 iceangel89 wrote:
 i noticed Zend_Tool still does not handle modules very well. 
 
 1. upon creation i think 
 
 resources.frontController.moduleDirectory = APPLICATION_PATH /modules
 
 should be added to application.ini
 
 2. Class names should be named with the Module prefix 
 
 eg. Admin_IndexController
 
 

-- 
View this message in context: 
http://www.nabble.com/Zend_Tool-and-modules-tp25203069p25233431.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] view.php?id=01 to /view/id/01

2009-08-31 Thread neobeacon

To genarate page content with using GET['id'] and using database tables,

I create viewAction() in ArticleController class

What I want to do to get GET['id'] from viewAction() ?

Do I want to configure Zend router to get /view/id/01 url strucure?
-- 
View this message in context: 
http://www.nabble.com/view.php-id%3D01--to---view-id-01-tp25234061p25234061.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Getting POSTed values of a form which build by view script

2009-08-31 Thread Sean Utt
You can use Zend_Form with viewscripts to generate arbitrary layout, and 
still get the benefits of Server SideValidation and Dojo too.


-- Sean

- Original Message - 
From: neobeacon neobea...@gmail.com

To: fw-general@lists.zend.com
Sent: Monday, August 31, 2009 7:02 PM
Subject: [fw-general] Getting POSTed values of a form which build by view 
script





If I build a form by using  view script (using html tags/without using 
zend's

form elements) how to get posted values from action's page ?
--
View this message in context: 
http://www.nabble.com/Getting-POSTed-values-of-a-form-which-build-by-view-script-tp25233309p25233309.html

Sent from the Zend Framework mailing list archive at Nabble.com.







[fw-general] Including regular Zend Form elements with a Zend Dojo form.

2009-08-31 Thread Cameron
Hi guys, just a quick one.

I want to be able to add a regular textarea to a Zend_Dojo form - the Dojo
editor is a tiny bit crappy, and i'd really rather use something else. The
problem is that the text area that Zend_Dojo outputs isn't an actual
textarea, and thus 3rd party editors tend to have difficulty attaching
themselves to it. Is it even possible to include normal Zend Form textareas
with Zend Dojo forms?


Re: [fw-general] Getting POSTed values of a form which build by view script

2009-08-31 Thread neobeacon

I also want to use Zend_Form But I don't know how to design this form using
Zend_Form.I know how to add form elements and filters and validators.IF you
have any idea please send.Thanks.

And also I got the logic to get POST[] values.Thanks in deep.

http://www.nabble.com/file/p25234466/Picture1.png 
-- 
View this message in context: 
http://www.nabble.com/Getting-POSTed-values-of-a-form-which-build-by-view-script-tp25233309p25234466.html
Sent from the Zend Framework mailing list archive at Nabble.com.