2011年1月31日星期一

Re: [fw-mvc] Alternate location for models

The only hard and fast rule about models, is that there is no hard and fast
rules. Every situation is different. If you're going for an old fashioned
active record approach, it sort of makes sense to maybe put them in a
directory called model (still very debatable if this is called a "model").

I tend to put my *domain* objects in a directory called domain, under my
library.

On Tue, Feb 1, 2011 at 2:43 AM, Joe Balancio <jlbalancio@gmail.com> wrote:

>
> Is it generally a hard fast rule that models should be placed in the web
> app's models folder? Or web app's module's models folder?
>
> What are some use cases where the models can be placed elsewhere, like the
> library?
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Alternate-location-for-models-tp3250615p3250615.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>

[fw-mvc] Alternate location for models

Is it generally a hard fast rule that models should be placed in the web
app's models folder? Or web app's module's models folder?

What are some use cases where the models can be placed elsewhere, like the
library?
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Alternate-location-for-models-tp3250615p3250615.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] Form Validators

Something like this.

pastie for a better view of it
http://pastie.org/1516522

On Mon, 2011-01-31 at 16:24 -0500, Thomas List wrote:
> I am trying to write custom form validation for a multiselect box. I was easily able to write validators for other text boxes, but I tried to create a validator for the select box, and it still returns the system error message. Here is the code and I want to check if the array is empty. Looking at again now, it doesn't look like I'm checking the array correctly.
>
> $this -> addElement( 'multiselect', 'incentiveId', array(
> 'label' => '<h1>Please select energy topics of interest:</h1>',
> 'escape' => false,
> 'required' => true,
> 'multioptions' => array(
> '5' => 'Energy Efficiency',
> '6' => 'Wind Technology',
> '7' => 'Geothermal System',
> '8' => 'Solar Technology',
> '9' => 'All'
> ),
> 'validators' => array(array('validator'=>'NotEmpty', true,
> array('messages'=>array('isEmpty'=>'Please Select A Type Of Incentive')))),
> 'decorators' => array(
> 'ViewHelper',
> 'Errors',
> array( 'HtmlTag', array( 'tag' => 'dd' ) ),
> array( 'Label', array( 'tag' => 'dt', 'escape' => false) )
> )
> ));
>
>
> A pointer in the right direction would greatly be appreciated, since there don't seem to correct answers from websites.
>
> Regards,
> Thomas List
>

--
MvH
Antoine Hedgecock <antoine@pmg.se>
PMG Media Group AB

[fw-mvc] Form Validators

I am trying to write custom form validation for a multiselect box. I was easily able to write validators for other text boxes, but I tried to create a validator for the select box, and it still returns the system error message. Here is the code and I want to check if the array is empty. Looking at again now, it doesn't look like I'm checking the array correctly.

$this -> addElement( 'multiselect', 'incentiveId', array(
'label' => '<h1>Please select energy topics of interest:</h1>',
'escape' => false,
'required' => true,
'multioptions' => array(
'5' => 'Energy Efficiency',
'6' => 'Wind Technology',
'7' => 'Geothermal System',
'8' => 'Solar Technology',
'9' => 'All'
),
'validators' => array(array('validator'=>'NotEmpty', true,
array('messages'=>array('isEmpty'=>'Please Select A Type Of Incentive')))),
'decorators' => array(
'ViewHelper',
'Errors',
array( 'HtmlTag', array( 'tag' => 'dd' ) ),
array( 'Label', array( 'tag' => 'dt', 'escape' => false) )
)
));


A pointer in the right direction would greatly be appreciated, since there don't seem to correct answers from websites.

Regards,
Thomas List

Re: [fw-gdata] Caching Calendar data with Zend_Cache

When I would do a print_r the first thing that it would put was
"__PHP_Incomplete_Class Object". I think I just figured out how to fix it. I
need to include the files for Zend_Gdata so it knows how to read the file
that is cached.

On Sun, Jan 30, 2011 at 7:59 PM, Hector Virgen <djvirgen@gmail.com> wrote:

> However, when I try to cache the calendar data I get errors about my
>> foreach loop at the end.
>
>
> What are the errors?
>
> --
> *Hector Virgen*
> Sr. Web Developer
> http://www.virgentech.com
>

RE: [fw-mvc] get $view in bootstrap

Hi,

Make sure you have an empty array in the application.ini:

resources.view[] =

Regards,
Jachim Coudenys

-----Oorspronkelijk bericht-----
Van: sina miandashti [mailto:miandashti@gmail.com]
Verzonden: zaterdag 29 januari 2011 15:11
Aan: Zend MVC
Onderwerp: [fw-mvc] get $view in bootstrap

hi

i have the following code in my bootstrap

public function _initjQuery() {
$view = $this->getResource("view");
}

i dont know why the $view is NULL after Run


--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin

--
This email was Anti Virus scanned.

2011年1月30日星期日

Re: [fw-gdata] Caching Calendar data with Zend_Cache

>
> However, when I try to cache the calendar data I get errors about my
> foreach loop at the end.


What are the errors?

--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com

2011年1月29日星期六

[fw-gdata] Caching Calendar data with Zend_Cache

I'm trying to cache the calendar data that I get from Zend_Gdata_Calendar
with Zend_Cache. I've tested both pieces separately. I can successfully
cache something, and I can successfully retrieve my calendar data. However,
when I try to cache the calendar data I get errors about my foreach loop at
the end. I think it has to do with the serialization. However, it yells at
me if I turn the serialization to false. When I look at a print_r of what is
being cached it different from what is being pulled from
Zend_Gdata_Calendar.

Has anyone successfully done this before? Or can anyone help me figure out
where I've gone wrong? Below is my code.

require_once '../library/Zend/Cache.php';
$frontendOptions = array('lifetime' => 60, 'automatic_serialization' =>
true);
$backendOptions = array('cache_dir' => 'd:\temp\tmp');
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions,
$backendOptions);

if( ($result = $cache->load('calendar')) === false) {
$startDate = date("Y-m-d", time());
$endDate = date("Y-m-d", time() + (14 * 24 * 60 * 60));
$user = 'myusername@gmail.com';
// get calendar stuff to result
require_once '../library/Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$gdataCal = new Zend_Gdata_Calendar();
$query = $gdataCal->newEventQuery();
$query->setUser($user);
$query->setVisibility('public');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setSortorder('ascend');
$query->setStartMin($startDate);
$query->setStartMax($endDate);
$result = $gdataCal->getCalendarEventFeed($query);

//save it to the cache
$cache->save($result, 'calendar');
}
else {
echo "This one is from cache!<br/></br>";
}

echo "<ul>\n";
foreach($result as $event) {
echo "\t<li>" . $event->title->text;
foreach($event->when as $when) {
echo " (" . date("M j g:ia", strtotime($when->startTime)) . ")\n";
}
echo "\t</li>\n";
}
echo "</ul>\n";

Re: [fw-mvc] get $view in bootstrap

Le 29/01/11 15:26, sina miandashti a écrit :
> Zend_Application_Bootstrap_Exception: Resource matching "view" not found
> in C:\Users\Sina
> Miandashti\Desktop\xampp\htdocs\vando\library\Zend\Application\Bootstrap\BootstrapAbstract.php
> on line /691/

You're probably trying to bootstrap/get a resource that doesn't exist.
Do you init your view object somewhere?

Check both in your application.ini or in your Bootstrap that your view
object is created somewhere.

Re: [fw-mvc] get $view in bootstrap

Le 29/01/11 15:11, sina miandashti a écrit :
> $view = $this->getResource("view");

You need to bootstrap the resource first:

$this->bootstrap('view');
$view = $this->getResource('view');

It should work.

[fw-mvc] get $view in bootstrap

hi

i have the following code in my bootstrap

public function _initjQuery() {
$view = $this->getResource("view");
}

i dont know why the $view is NULL after Run


--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin

2011年1月28日星期五

Re: [fw-webservices] Zend_Service_Amazon_Ses

Thanks for the information Matthew! That was me on fw-general, and I'll try
to get in contact with Konr so we're not duplicating our efforts.

Best,
Nick

On Fri, Jan 28, 2011 at 9:46 AM, Matthew Weier O'Phinney
<matthew@zend.com>wrote:

> -- Nick Miller <nicholas.j.miller@gmail.com> wrote
> (on Friday, 28 January 2011, 09:31 AM -0600):
> > My company is in need of an Amazon Simple Email Service module and I
> would
> > be willing to contribute it to Zend Framework. I just signed a CLA and I
> am
> > curious what the next step would be to move forward? I believe I have to
> > write a proposal and supply a POC, but I am not sure how to get access to
> > the wiki.
> >
> > Any help, or direction to resources would be much appreciated.
>
> Once you receive notification that your CLA has been processed, you'll
> have access to post on the wiki. Follow the proposal process, as
> outlined here:
>
> http://framework.zend.com/wiki/display/ZFPROP/Proposal+Process
>
> Also, are you the same one who pinged on fw-general about this? If not,
> you may wish to reach out to that person to collaborate.
>
> Thanks!
>
> --
> Matthew Weier O'Phinney
> Project Lead | matthew@zend.com
> Zend Framework | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>

Re: [fw-webservices] Zend_Service_Amazon_Ses

-- Nick Miller <nicholas.j.miller@gmail.com> wrote
(on Friday, 28 January 2011, 09:31 AM -0600):
> My company is in need of an Amazon Simple Email Service module and I would
> be willing to contribute it to Zend Framework. I just signed a CLA and I am
> curious what the next step would be to move forward? I believe I have to
> write a proposal and supply a POC, but I am not sure how to get access to
> the wiki.
>
> Any help, or direction to resources would be much appreciated.

Once you receive notification that your CLA has been processed, you'll
have access to post on the wiki. Follow the proposal process, as
outlined here:

http://framework.zend.com/wiki/display/ZFPROP/Proposal+Process

Also, are you the same one who pinged on fw-general about this? If not,
you may wish to reach out to that person to collaborate.

Thanks!

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

[fw-webservices] Zend_Service_Amazon_Ses

Hi Everyone,

My company is in need of an Amazon Simple Email Service module and I would
be willing to contribute it to Zend Framework. I just signed a CLA and I am
curious what the next step would be to move forward? I believe I have to
write a proposal and supply a POC, but I am not sure how to get access to
the wiki.

Any help, or direction to resources would be much appreciated.

Best,
Nick

Re: [fw-mvc] Re: How to extend Zend_View?

> I don't think that's what i'm looking for. I dont want to create a
differnt
> layout, i just want everything to work as normal (which it does if i dont
> use my own view), with only one exception - when it cant find a
> view-template. see class below.
>
Maybe it's an obvious question, but does it work when you replace your
own view by $view = new Zend_View();?

How do you set up your layout? What's weird is that your layout is not
found in your views/scripts path which is not the defaut path for layouts.

By the way, do you use your application.ini to configure your layout?
If you do, it is overriden by the Bootstrap::_initView() method, try
changing the name with _initMyView() and do:

Bootstrap.php
<?php
protected function _initMyView()
{
$this->bootstrap('view'); // be sure you bootstrap default views
paramters before to set your own
// Excudo_View extends Zend_View
$view = new Excudo_View();

// Add it to the ViewRenderer
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper( 'ViewRenderer' );
$viewRenderer->setView($view);

return $view;
}

Hope that helps

[fw-mvc] Re: How to extend Zend_View?

Jigal Sanders wrote:
>
> I think you have not enabled your layout for your application.
>
> Here is how you can enable your layout:
> http://framework.zend.com/manual/en/learning.quickstart.create-layout.html
>

I don't think that's what i'm looking for. I dont want to create a differnt
layout, i just want everything to work as normal (which it does if i dont
use my own view), with only one exception - when it cant find a
view-template. see class below.


Nicolas Forgerit wrote:
>
> You probably forgot to call parent::__construct() in your deriving
> classes constructor. The parent's constructor then should fill your
> object with the expected params.

I don't have a constructor in my subclass, so the one from Zend_View is
already called.

This is what my class looks like:

class Excudo_View extends Zend_View
{
protected function _script($name)
{
try {
parent::_script($name);
} catch (Zend_View_Exception $e) {
// not found, we're gonna try the base path
if (strpos($name, "/"))
{
$parts = explode("/", $name);
$name = end($parts);
}
else
{
; // $name = $name
}
if (is_readable(APPLICATION_PATH ."/views/scripts/_base/".$name))
{
return APPLICATION_PATH ."/views/scripts/_base/".$name;
}
else
{
throw $e;
}
}
}
}

Basically, what it should do is check if the view-file exists in the
expected path and if not it should load a generic one defined in the _base
folder.
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-extend-Zend-View-tp3243933p3244321.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] How to extend Zend_View?

I think you have not enabled your layout for your application.

Here is how you can enable your layout:
http://framework.zend.com/manual/en/learning.quickstart.create-layout.html

On Fri, Jan 28, 2011 at 9:21 AM, themarty <marty.korse@gmail.com> wrote:

>
> For a specific website i lack one functionality in Zend_View, so i want to
> extend it and use my extended version instead of Zend_View
>
> Most solutions that deal with this issue recommend to do it this way:
>
> Bootstrap.php
> <?php
> protected function _initView()
> {
> // Excudo_View extends Zend_View
> $view = new Excudo_View();
>
> // Add it to the ViewRenderer
> $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper( 'ViewRenderer' );
> $viewRenderer->setView($view);
>
> return $view;
> }
> ?>
>
> However, when i do it this way, i run into the following error:
>
> An exception occured: script 'layout.phtml' not found in path
> (./views\scripts/)
>
> When i var_dump the $view variable and compare it to a var_dump of this
> one:
> $view = Zend_Layout::getMvcInstance()->getView();
> i see that by that time in the bootstrap the view object already has set
> numerous properties, which is probably why i run into these errors.
>
> Instead of trying to set all those properties manually before i call
> setView() it would be nicer if i could somehow let the framework know it
> shouldn't use Zend_View, but Excudo_View instead. Is there a way to do
> this?
> (in application.ini for example).
> If there is not: what would be the cleanest way to ensure Excudo_View is
> loaded the same way Zend_View is loaded?
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/How-to-extend-Zend-View-tp3243933p3243933.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>

--
Met vriendelijke groet,

Jigal Sanders
A.J. Ernststraat 739
1082 LK Amsterdam
Mobiel: 06-42111489

Re: [fw-mvc] How to extend Zend_View?

Hey!

You probably forgot to call parent::__construct() in your deriving
classes constructor. The parent's constructor then should fill your
object with the expected params.

Ciao Nico


On Fri, Jan 28, 2011 at 9:21 AM, themarty <marty.korse@gmail.com> wrote:
>
> For a specific website i lack one functionality in Zend_View, so i want to
> extend it and use my extended version instead of Zend_View
>
> Most solutions that deal with this issue recommend to do it this way:
>
> Bootstrap.php
> <?php
>        protected function _initView()
>        {
>                // Excudo_View extends Zend_View
>                $view = new Excudo_View();
>
>                // Add it to the ViewRenderer
>                $viewRenderer =
> Zend_Controller_Action_HelperBroker::getStaticHelper( 'ViewRenderer' );
>                $viewRenderer->setView($view);
>
>                return $view;
>        }
> ?>
>
> However, when i do it this way, i run into the following error:
>
> An exception occured: script 'layout.phtml' not found in path
> (./views\scripts/)
>
> When i var_dump the $view variable and compare it to a var_dump of this one:
> $view = Zend_Layout::getMvcInstance()->getView();
> i see that by that time in the bootstrap the view object already has set
> numerous properties, which is probably why i run into these errors.
>
> Instead of trying to set all those properties manually before i call
> setView() it would be nicer if i could somehow let the framework know it
> shouldn't use Zend_View, but Excudo_View instead. Is there a way to do this?
> (in application.ini for example).
> If there is not: what would be the cleanest way to ensure Excudo_View is
> loaded the same way Zend_View is loaded?
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-extend-Zend-View-tp3243933p3243933.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>

[fw-mvc] How to extend Zend_View?

For a specific website i lack one functionality in Zend_View, so i want to
extend it and use my extended version instead of Zend_View

Most solutions that deal with this issue recommend to do it this way:

Bootstrap.php
<?php
protected function _initView()
{
// Excudo_View extends Zend_View
$view = new Excudo_View();

// Add it to the ViewRenderer
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper( 'ViewRenderer' );
$viewRenderer->setView($view);

return $view;
}
?>

However, when i do it this way, i run into the following error:

An exception occured: script 'layout.phtml' not found in path
(./views\scripts/)

When i var_dump the $view variable and compare it to a var_dump of this one:
$view = Zend_Layout::getMvcInstance()->getView();
i see that by that time in the bootstrap the view object already has set
numerous properties, which is probably why i run into these errors.

Instead of trying to set all those properties manually before i call
setView() it would be nicer if i could somehow let the framework know it
shouldn't use Zend_View, but Excudo_View instead. Is there a way to do this?
(in application.ini for example).
If there is not: what would be the cleanest way to ensure Excudo_View is
loaded the same way Zend_View is loaded?
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-extend-Zend-View-tp3243933p3243933.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2011年1月25日星期二

[fw-db] Re: SOAP Call using Zend_Soap_Client

did you find the solution to this problem, im working with the navteq maps
also, and couldnt find the way to call the searchFree method.

thanks
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/SOAP-Call-using-Zend-Soap-Client-tp674227p3237432.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-mvc] Creating Zip Files

Hey Thomas,

so you have some .pdf files on your server and want to zip them for
sending them packaged to the requesting client.

The steps would be (assuming you're using PHP's zipping functionalities):
1) Collect the .pdf contents into a temporary zip file. (see PHPs-docs)
2) Set Zend_Controller_Response's MIME-type to "application/zip".
3) Set the Response's content to the temporary zip-file & send it.

The client's browser should now being able to decide what to do with
the server's zip (maybe it just asks for download).

Hope it helps a bit!

Ciao Nico

On Tue, Jan 25, 2011 at 6:55 PM, Thomas List <thomaslist@hotmail.com> wrote:
>
> Hello,
>
> I am trying to create a zip file so I can download multiple .pdf files.  The problem I am having is that when I create the Zip file, I do not know where it gets created, and the files are never written to it.
> I am using the pretty standard code :
>
>  if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) {
>             exit("cannot open <$archive_file_name>\n");
>          }
>
> to create the file, but I am unable to set the file path because I do not know where the zip file is located.  Does anyone know where the file is created so I can write the files to it and download a zip file with something in it?
>
> Regards,
> Thomas
>

Re: [fw-mvc] Creating Zip Files

-- Thomas List <thomaslist@hotmail.com> wrote
(on Tuesday, 25 January 2011, 12:55 PM -0500):
> I am trying to create a zip file so I can download multiple .pdf
> files. The problem I am having is that when I create the Zip file, I
> do not know where it gets created, and the files are never written to
> it.
> I am using the pretty standard code :
>
> if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) {
> exit("cannot open <$archive_file_name>\n");
> }
>
> to create the file, but I am unable to set the file path because I do
> not know where the zip file is located. Does anyone know where the
> file is created so I can write the files to it and download a zip file
> with something in it?

This question is not related to Zend Framework, but rather to the PHP
language itself. Please ask on the php-general mailing list instead
(list of PHP mailing lists is found here:
http://php.net/mailing-lists.php)

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

[fw-mvc] Creating Zip Files

Hello,

I am trying to create a zip file so I can download multiple .pdf files. The problem I am having is that when I create the Zip file, I do not know where it gets created, and the files are never written to it.
I am using the pretty standard code :

if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) {
exit("cannot open <$archive_file_name>\n");
}

to create the file, but I am unable to set the file path because I do not know where the zip file is located. Does anyone know where the file is created so I can write the files to it and download a zip file with something in it?

Regards,
Thomas

2011年1月24日星期一

[fw-mvc] Re: apc-error using Zend_Application with Zend_Test

I solved this problem.

Be careful when you add zend library. In my case I have like that:

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path()
)));


I already have had zend repozitory in other path. Get_include_path got it as
a result.

Now just comment some lib, for example, realpath(APPLICATION_PATH .
'/../library')
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/apc-error-using-Zend-Application-with-Zend-Test-tp671319p3234473.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] How do I clear a request in a phpunit test ?

-- Zladivliba Voskuy <nospampam@hotmail.fr> wrote
(on Saturday, 22 January 2011, 09:44 AM +0100):
>
> I have a very strange behavior unit testing (note my code works normally though) :
>
> I login through a POST request :
>
> $this->request->setPost(array(
> 'email' => $this->TestUserEmail,
> 'password' => $this->TestUserPassword,
> ));
> $this->dispatch('/user/login');
> $this->assertRedirect;
> $this->assertTrue(Zend_Auth::getInstance()->hasIdentity());
>
> Then send a GET request (to a REST controller) :
>
> $this->request->setMethod('GET');
> $this->dispatch('/test/167);
> $this->assertAction('index');

You need to reset the request and response objects between requests:

$this->resetRequest()
->resetResponse();

Better is to simply manipulate Zend_Auth directly, which allows you to
pretend a previous request had been made; for an example, read the
following blog post:

http://www.littlehart.net/atthekeyboard/2010/06/03/testing-controllers-hiding-behind-zend_auth/

> I log the request on the GET function of the REST controller like this :
>
> $logger = Zend_Registry::get('logger');
> $logger->notice("RECEIVED GET REQUEST : ". print_r($params, true) . "query : " . print_r($this->_request->getParams(), true));
>
> And I get this :
>
> 2011-01-21T10:23:17+00:00 NOTICE (5): RECEIVED GET REQUEST : Array
> (
> [id] => 167
> [email] => unittest@test.net
> [password] => test
> )
> query : Array
> (
> [controller] => jrs
> [action] => index
> [module] => default
> [id] => 167
> [table] => test
> [email] => unittest@test.net
> [password] => test
> )
>
> So the problem is that the login data is persistent. I've search everywhere I could but I can't find a way to clear this data. Anyone knows how to do this ?
> Thanks !Z.
>
>
> --
> My dojo & zend framework experience, the good, the bad with code samples ;-)
>
> http://practicalphpajax.wordpress.com/
>
>
>

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Re: [fw-mvc] inject a html code after <form>

Am 23.01.2011, 13:32 Uhr, schrieb Jurian Sluiman
<subscribe@juriansluiman.nl>:

> But one remark: I would use the description for text only and *not*
> html. The
> markup should be rendered by an additional decorator or view helper, but
> I
> wouldn't recommend to append/prepend html with the description decorator.

Create a new element and use the view-helper "formNote".
More infos: http://framework.zend.com/issues/browse/ZF-10205

2011年1月23日星期日

Re: [fw-mvc] inject a html code after <form>

On Sunday 23 Jan 2011 13:15:36 sina miandashti wrote:
> I tried
> http://framework.zend.com/apidoc/core/Zend_Form/Zend_Form.html#setDescripti
> on ... before
> not showing ... maybe a bug !

By default Zend_Form does not add the description decorator to the form, only
to the form elements. You can add it yourself:

$form->addDecorator('Description');

If you want to have the decorator on all form instances, you can extend
Zend_Form and override Zend_Form#loadDefaultDecorators(), see
http://pastie.org/1489597

But one remark: I would use the description for text only and *not* html. The
markup should be rendered by an additional decorator or view helper, but I
wouldn't recommend to append/prepend html with the description decorator.

Regards, Jurian
--
Jurian Sluiman
Soflomo - http://soflomo.com

Re: [fw-mvc] inject a html code after <form>

I gave up on decorators a long time ago, and just output them using the form
view helpers. It makes my designer much happier.


On Sun, Jan 23, 2011 at 7:15 AM, sina miandashti <miandashti@gmail.com>wrote:

> I tried
>
> http://framework.zend.com/apidoc/core/Zend_Form/Zend_Form.html#setDescription
> ... before
> not showing ... maybe a bug !
>
> On Sun, Jan 23, 2011 at 2:06 PM, Kaiuwe <dr.kaiuwe@googlemail.com> wrote:
>
> > Or simply use the opportunity to set a description for the form:
> >
> http://framework.zend.com/apidoc/core/Zend_Form/Zend_Form.html#setDescription
> >
> > Am 23.01.2011, 11:31 Uhr, schrieb Jurian Sluiman <
> > subscribe@juriansluiman.nl>:
> >
> >
> > On Sunday 23 Jan 2011 10:48:49 sina miandashti wrote:
> >>
> >>> hi
> >>>
> >>> i try so hard injecting a html code after <form> in my zend_form
> object
> >>>
> >>> i also try creating a custom form_element
> >>>
> >>> but not works
> >>>
> >>> actually dont know how to set the html code of a element
> >>>
> >>> any possible way?
> >>>
> >>
> >> What is your use case of the html? If it is always the same, you could
> >> look at
> >> view helpers. Instead of printing your form, you use the view helper:
> >>
> >> <?php echo $this->form?>
> >> <?php echo $this->extendForm($this->form)?>
> >>
> >> You create a view helper which accepts a Zend_Form object and renders
> some
> >> html after it:
> >>
> >> <?php
> >> public function extendForm(Zend_Form $form)
> >> {
> >> return $form->__toString() . $this->_html();
> >> }
> >>
> >> public function _html ()
> >> {
> >> return '<p>This is my HTML</p>';
> >> }
> >>
> >> Otherwise, if it's really a part of the form (e.g. some controls), you
> can
> >> create a decorator. In you init() of your form, you can do something
> like:
> >>
> >> <?php
> >> public function init()
> >> {
> >> // Add your elements
> >> $this->loadDefaultDecorators();
> >> $this->addDecorator('myControls');
> >> }
> >>
> >> Regards, Jurian
> >>
> >
> >
>
>
> --
> ________________
> Sincerely
> Sina Miandashti
> MuSicBasE.ir & InvisionPower.ir Admin
>

Re: [fw-mvc] inject a html code after <form>

I tried
http://framework.zend.com/apidoc/core/Zend_Form/Zend_Form.html#setDescription
... before
not showing ... maybe a bug !

On Sun, Jan 23, 2011 at 2:06 PM, Kaiuwe <dr.kaiuwe@googlemail.com> wrote:

> Or simply use the opportunity to set a description for the form:
> http://framework.zend.com/apidoc/core/Zend_Form/Zend_Form.html#setDescription
>
> Am 23.01.2011, 11:31 Uhr, schrieb Jurian Sluiman <
> subscribe@juriansluiman.nl>:
>
>
> On Sunday 23 Jan 2011 10:48:49 sina miandashti wrote:
>>
>>> hi
>>>
>>> i try so hard injecting a html code after <form> in my zend_form object
>>>
>>> i also try creating a custom form_element
>>>
>>> but not works
>>>
>>> actually dont know how to set the html code of a element
>>>
>>> any possible way?
>>>
>>
>> What is your use case of the html? If it is always the same, you could
>> look at
>> view helpers. Instead of printing your form, you use the view helper:
>>
>> <?php echo $this->form?>
>> <?php echo $this->extendForm($this->form)?>
>>
>> You create a view helper which accepts a Zend_Form object and renders some
>> html after it:
>>
>> <?php
>> public function extendForm(Zend_Form $form)
>> {
>> return $form->__toString() . $this->_html();
>> }
>>
>> public function _html ()
>> {
>> return '<p>This is my HTML</p>';
>> }
>>
>> Otherwise, if it's really a part of the form (e.g. some controls), you can
>> create a decorator. In you init() of your form, you can do something like:
>>
>> <?php
>> public function init()
>> {
>> // Add your elements
>> $this->loadDefaultDecorators();
>> $this->addDecorator('myControls');
>> }
>>
>> Regards, Jurian
>>
>
>


--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin

Re: [fw-mvc] inject a html code after <form>

Or simply use the opportunity to set a description for the form:
http://framework.zend.com/apidoc/core/Zend_Form/Zend_Form.html#setDescription

Am 23.01.2011, 11:31 Uhr, schrieb Jurian Sluiman
<subscribe@juriansluiman.nl>:

> On Sunday 23 Jan 2011 10:48:49 sina miandashti wrote:
>> hi
>>
>> i try so hard injecting a html code after <form> in my zend_form
>> object
>>
>> i also try creating a custom form_element
>>
>> but not works
>>
>> actually dont know how to set the html code of a element
>>
>> any possible way?
>
> What is your use case of the html? If it is always the same, you could
> look at
> view helpers. Instead of printing your form, you use the view helper:
>
> <?php echo $this->form?>
> <?php echo $this->extendForm($this->form)?>
>
> You create a view helper which accepts a Zend_Form object and renders
> some
> html after it:
>
> <?php
> public function extendForm(Zend_Form $form)
> {
> return $form->__toString() . $this->_html();
> }
>
> public function _html ()
> {
> return '<p>This is my HTML</p>';
> }
>
> Otherwise, if it's really a part of the form (e.g. some controls), you
> can
> create a decorator. In you init() of your form, you can do something
> like:
>
> <?php
> public function init()
> {
> // Add your elements
> $this->loadDefaultDecorators();
> $this->addDecorator('myControls');
> }
>
> Regards, Jurian

Re: [fw-mvc] inject a html code after <form>

On Sunday 23 Jan 2011 10:48:49 sina miandashti wrote:
> hi
>
> i try so hard injecting a html code after <form> in my zend_form object
>
> i also try creating a custom form_element
>
> but not works
>
> actually dont know how to set the html code of a element
>
> any possible way?

What is your use case of the html? If it is always the same, you could look at
view helpers. Instead of printing your form, you use the view helper:

<?php echo $this->form?>
<?php echo $this->extendForm($this->form)?>

You create a view helper which accepts a Zend_Form object and renders some
html after it:

<?php
public function extendForm(Zend_Form $form)
{
return $form->__toString() . $this->_html();
}

public function _html ()
{
return '<p>This is my HTML</p>';
}

Otherwise, if it's really a part of the form (e.g. some controls), you can
create a decorator. In you init() of your form, you can do something like:

<?php
public function init()
{
// Add your elements
$this->loadDefaultDecorators();
$this->addDecorator('myControls');
}

Regards, Jurian
--
Jurian Sluiman
Soflomo - http://soflomo.com

Re: [fw-mvc] inject a html code after <form>

You have to look at form decorators.
And to create a custom form element, there are tutorials on the internet.

On Sun, Jan 23, 2011 at 10:48 AM, sina miandashti <miandashti@gmail.com>wrote:

> hi
>
> i try so hard injecting a html code after <form> in my zend_form object
>
> i also try creating a custom form_element
>
> but not works
>
> actually dont know how to set the html code of a element
>
> any possible way?
>
> --
> ________________
> Sincerely
> Sina Miandashti
> MuSicBasE.ir & InvisionPower.ir Admin
>

--
Met vriendelijke groet,

Jigal Sanders
A.J. Ernststraat 739
1082 LK Amsterdam
Mobiel: 06-42111489

[fw-mvc] inject a html code after <form>

hi

i try so hard injecting a html code after <form> in my zend_form object

i also try creating a custom form_element

but not works

actually dont know how to set the html code of a element

any possible way?

--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin

2011年1月22日星期六

[fw-mvc] How do I clear a request in a phpunit test ?

I have a very strange behavior unit testing (note my code works normally though) :

I login through a POST request :

$this->request->setPost(array(
'email' => $this->TestUserEmail,
'password' => $this->TestUserPassword,
));
$this->dispatch('/user/login');
$this->assertRedirect;
$this->assertTrue(Zend_Auth::getInstance()->hasIdentity());

Then send a GET request (to a REST controller) :

$this->request->setMethod('GET');
$this->dispatch('/test/167);
$this->assertAction('index');

I log the request on the GET function of the REST controller like this :

$logger = Zend_Registry::get('logger');
$logger->notice("RECEIVED GET REQUEST : ". print_r($params, true) . "query : " . print_r($this->_request->getParams(), true));

And I get this :

2011-01-21T10:23:17+00:00 NOTICE (5): RECEIVED GET REQUEST : Array
(
[id] => 167
[email] => unittest@test.net
[password] => test
)
query : Array
(
[controller] => jrs
[action] => index
[module] => default
[id] => 167
[table] => test
[email] => unittest@test.net
[password] => test
)

So the problem is that the login data is persistent. I've search everywhere I could but I can't find a way to clear this data. Anyone knows how to do this ?
Thanks !Z.


--
My dojo & zend framework experience, the good, the bad with code samples ;-)

http://practicalphpajax.wordpress.com/

2011年1月21日星期五

Re: [fw-mvc] Re: ACL stuck in a loop

-- Nathan Garlington <garlinto@gmail.com> wrote
(on Friday, 21 January 2011, 02:24 PM -0700):
> Alright, got it figured out! I thought that resetting the controller name
> and action name in the request object, and then setting isDispatched(false)
> caused the dispatcher to dispatch the request to the new controller and
> action. But such is not the case, at least not in the way I have implemented
> it above.
>
> What is the "proper" ZF way to go about handling a case where the user does
> not have access to the resource? I solved the problem using the Redirector
> action helper. Would this be using the redirector in line with it's intent,
> or is there another way using the methods exposed to the Controller Plugin
> itself?

I typically define a special exception, such as
"UnauthorizedAccessException", and throw that. In my ErrorController's
errorAction(), I add an additional case statement:

case ($errors->exception instanceof UnauthorizedAccessException):
$this->getResponse()->setHttpResponseCode(401);
$this->view->message = 'You do not have rights to perform this action.';
break;

This way, I don't need to do redirects, nor do I need to provide
additional logic in my actions if the user doesn't have permissions -- I
simply throw the exception, and know that the error controller will
notify them.


> On Fri, Jan 21, 2011 at 9:43 AM, Nathan Garlington <garlinto@gmail.com>wrote:
>
> > Thanks for the quick replies! Kevin, I would love to run Zend Server but
> > I'm running a this code on a production server, and don't have a test
> > machine atm. :(
> >
> > tendor wrote:
> > >Try this
> > >
> > >ACL Class:
> > > $this->add(new Zend_Acl_Resource('default'))
> > > ->add(new Zend_Acl_Resource('default:index'), 'default')
> > > ->add(new Zend_Acl_Resource('default:error'), 'default')
> > > ->add(new Zend_Acl_Resource('default:user'), 'default');
> > >
> >
> > So you think the problem may lie in the way the module is specified? I
> > guess I'll give that a try...
> >
> > --regards,
> > nathan
> >
> >
> >
> > On Fri, Jan 21, 2011 at 9:27 AM, tendor <marjarosz@gmail.com> wrote:
> >
> >>
> >> Try this
> >>
> >> ACL Class:
> >> $this->add(new Zend_Acl_Resource('default'))
> >> ->add(new Zend_Acl_Resource('default:index'), 'default')
> >> ->add(new Zend_Acl_Resource('default:error'), 'default')
> >> ->add(new Zend_Acl_Resource('default:user'), 'default');
> >>
> >> $this->allow('guest', 'default:error');
> >> $this->allow('guest', 'default:index', array('some action', '
> >> some
> >> action'));
> >> $this->allow('guest', 'default:user');
> >>
> >> Using simple:
> >>
> >> if(!$this->_acl->isAllowed(Zend_Registry::get('role'),
> >> $module.':'.$resource, $action)){
> >> $request->setControllerName('index')
> >> ->setActionName('login');
> >> }
> >> --
> >> View this message in context:
> >> http://zend-framework-community.634137.n4.nabble.com/ACL-stuck-in-a-loop-tp3230017p3230042.html
> >> Sent from the Zend MVC mailing list archive at Nabble.com.
> >>
> >
> >

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Re: [fw-mvc] Re: ACL stuck in a loop

Alright, got it figured out! I thought that resetting the controller name
and action name in the request object, and then setting isDispatched(false)
caused the dispatcher to dispatch the request to the new controller and
action. But such is not the case, at least not in the way I have implemented
it above.

What is the "proper" ZF way to go about handling a case where the user does
not have access to the resource? I solved the problem using the Redirector
action helper. Would this be using the redirector in line with it's intent,
or is there another way using the methods exposed to the Controller Plugin
itself?

--regards,
nathan


On Fri, Jan 21, 2011 at 9:43 AM, Nathan Garlington <garlinto@gmail.com>wrote:

> Thanks for the quick replies! Kevin, I would love to run Zend Server but
> I'm running a this code on a production server, and don't have a test
> machine atm. :(
>
> tendor wrote:
> >Try this
> >
> >ACL Class:
> > $this->add(new Zend_Acl_Resource('default'))
> > ->add(new Zend_Acl_Resource('default:index'), 'default')
> > ->add(new Zend_Acl_Resource('default:error'), 'default')
> > ->add(new Zend_Acl_Resource('default:user'), 'default');
> >
>
> So you think the problem may lie in the way the module is specified? I
> guess I'll give that a try...
>
> --regards,
> nathan
>
>
>
> On Fri, Jan 21, 2011 at 9:27 AM, tendor <marjarosz@gmail.com> wrote:
>
>>
>> Try this
>>
>> ACL Class:
>> $this->add(new Zend_Acl_Resource('default'))
>> ->add(new Zend_Acl_Resource('default:index'), 'default')
>> ->add(new Zend_Acl_Resource('default:error'), 'default')
>> ->add(new Zend_Acl_Resource('default:user'), 'default');
>>
>> $this->allow('guest', 'default:error');
>> $this->allow('guest', 'default:index', array('some action', '
>> some
>> action'));
>> $this->allow('guest', 'default:user');
>>
>> Using simple:
>>
>> if(!$this->_acl->isAllowed(Zend_Registry::get('role'),
>> $module.':'.$resource, $action)){
>> $request->setControllerName('index')
>> ->setActionName('login');
>> }
>> --
>> View this message in context:
>> http://zend-framework-community.634137.n4.nabble.com/ACL-stuck-in-a-loop-tp3230017p3230042.html
>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>
>
>

[fw-mvc] Re: ACL stuck in a loop

Hi,
try a thing like this

if ($this->getAcl()->has($actionLevel) && !$this->getAcl()->isAllowed($role,
$actionLevel)) {
if (!$auth->hasIdentity()) {
$this->loginAccess();
} else {
$this->denyAccess();
}
}

bye.
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/ACL-stuck-in-a-loop-tp3230017p3230505.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] Re: ACL stuck in a loop

Try this

ACL Class:
$this->add(new Zend_Acl_Resource('default'))
->add(new Zend_Acl_Resource('default:index'), 'default')
->add(new Zend_Acl_Resource('default:error'), 'default')
->add(new Zend_Acl_Resource('default:user'), 'default');

$this->allow('guest', 'default:error');
$this->allow('guest', 'default:index', array('some action', ' some
action'));
$this->allow('guest', 'default:user');

Using simple:

if(!$this->_acl->isAllowed(Zend_Registry::get('role'),
$module.':'.$resource, $action)){
$request->setControllerName('index')
->setActionName('login');
}
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/ACL-stuck-in-a-loop-tp3230017p3230042.html
Sent from the Zend MVC mailing list archive at Nabble.com.

RE: [fw-mvc] ACL stuck in a loop

If nobody can see the problem from the code (I can't, off the top of my head) try downloading the Zend Server 30 day trial and run a code trace on it (after bumping up the trace dump size to at least 500MB, and dropping the max_execution time to 10 seconds or so (expect a lot of data)). That should tell you what data is causing the long running request.

Kevin Schroeder
Technology Evangelist
Zend Technologies, Ltd.
www.zend.com
www.twitter.com/kpschrade
www.eschrade.com


-----Original Message-----
From: Nathan Garlington [mailto:garlinto@gmail.com]
Sent: Friday, January 21, 2011 10:15 AM
To: Zend Framework MVC List
Subject: [fw-mvc] ACL stuck in a loop

Hi all,

Using ZF-11.1.2, php-5.3.5

Trying to implement an ACL, and I keep getting "Maximum execution time of 30
seconds exceeded in /var/www/library/Zend-1.11.2/Acl.php on line 886" in my
error log. I am sure it's my implementation of Zend_Acl. It must be that I
don't quite understand the way the allow/deny rules work.

My understanding is that all resources are denied from a role unless
explicitly allowed. What is wrong with the code below that makes the server
hiccup?

class My_Bootstrap_Resource_Acl extends
Zend_Application_Resource_ResourceAbstract
{
public function init()
{
// configure access
$acl = new Zend_Acl();
$acl->add(new Zend_Acl_Resource('index'))
->add(new Zend_Acl_Resource('blog'))
->add(new Zend_Acl_Resource('contact'))
->add(new Zend_Acl_Resource('cart'))
->add(new Zend_Acl_Resource('checkout'))
->add(new Zend_Acl_Resource('process'))
->add(new Zend_Acl_Resource('order'))
->add(new Zend_Acl_Resource('account'))
->add(new Zend_Acl_Resource('error'))
->add(new Zend_Acl_Resource('login'))
->add(new Zend_Acl_Resource('logout'))
->addRole(new Zend_Acl_Role('guest')) // define the roles; note the
inheritance
->addRole(new Zend_Acl_Role('member')) // can comment freely without being
moderated
// define the access list; note the inheritance here as well
->allow('guest', array('index', 'blog', 'trailers', 'hitches', 'truckbeds',
'contact', 'cart', 'login', 'error'))
->deny('guest', 'blog', 'comment') //guest cannot comment but can do
everything else related to the blog resource, i.e. 'view'
->allow('member');
Zend_Registry::set('acl', $acl);
return $acl;
}
}

The $acl is set in the registry so that I can grab it in a front controller
plugin and use Zend_Auth to figure out the role of the current user, and
apply it to the configured acl.

class My_Plugin_AuthAccess extends Zend_Controller_Plugin_Abstract
{
private $_auth;
private $_acl;
private $_notAuthenticated = array(
'default', // module
'login', // controller
'index', // action
);
private $_notAllowed = array(
'default', // module
'error', // controller
'privileges', // action
);
public function preDispatch($request)
{
$acl = Zend_Registry::get('acl');
$auth = Zend_Auth::getInstance();

if ($auth->hasIdentity()) {
$role = 'member';
} else {
$role = 'guest';
}
$controller = $request->controller;
$action = $request->action;
$module = $request->module;
$resource = $controller;
if (!$acl->has($resource)) {
$resource = NULL;
}
if (!$acl->isAllowed($role, $resource, $action)) {
if (!$auth->hasIdentity()) {
list($module, $controller, $action) = $this->_notAuthenticated;
} else {
list($module, $controller, $action) = $this->_noAllowed;
}
$request
->setModuleName($module)
->setControllerName($controller)
->setActionName($action);
$request->setDispatched(false);
}
}
}

Are my implementations correct? Any help would be greatly appreciated.

PS: As a side note, php keeps telling me that strict standards are not being
upheld in my implementation of
Zend_Controller_Plugin_Abstract::preDispatch(), and it sites the last line
of my class. I've studied the code for the abstract class and can't see
where I went wrong. Any ideas on that?

--regards,
nathan

[fw-mvc] ACL stuck in a loop

Hi all,

Using ZF-11.1.2, php-5.3.5

Trying to implement an ACL, and I keep getting "Maximum execution time of 30
seconds exceeded in /var/www/library/Zend-1.11.2/Acl.php on line 886" in my
error log. I am sure it's my implementation of Zend_Acl. It must be that I
don't quite understand the way the allow/deny rules work.

My understanding is that all resources are denied from a role unless
explicitly allowed. What is wrong with the code below that makes the server
hiccup?

class My_Bootstrap_Resource_Acl extends
Zend_Application_Resource_ResourceAbstract
{
public function init()
{
// configure access
$acl = new Zend_Acl();
$acl->add(new Zend_Acl_Resource('index'))
->add(new Zend_Acl_Resource('blog'))
->add(new Zend_Acl_Resource('contact'))
->add(new Zend_Acl_Resource('cart'))
->add(new Zend_Acl_Resource('checkout'))
->add(new Zend_Acl_Resource('process'))
->add(new Zend_Acl_Resource('order'))
->add(new Zend_Acl_Resource('account'))
->add(new Zend_Acl_Resource('error'))
->add(new Zend_Acl_Resource('login'))
->add(new Zend_Acl_Resource('logout'))
->addRole(new Zend_Acl_Role('guest')) // define the roles; note the
inheritance
->addRole(new Zend_Acl_Role('member')) // can comment freely without being
moderated
// define the access list; note the inheritance here as well
->allow('guest', array('index', 'blog', 'trailers', 'hitches', 'truckbeds',
'contact', 'cart', 'login', 'error'))
->deny('guest', 'blog', 'comment') //guest cannot comment but can do
everything else related to the blog resource, i.e. 'view'
->allow('member');
Zend_Registry::set('acl', $acl);
return $acl;
}
}

The $acl is set in the registry so that I can grab it in a front controller
plugin and use Zend_Auth to figure out the role of the current user, and
apply it to the configured acl.

class My_Plugin_AuthAccess extends Zend_Controller_Plugin_Abstract
{
private $_auth;
private $_acl;
private $_notAuthenticated = array(
'default', // module
'login', // controller
'index', // action
);
private $_notAllowed = array(
'default', // module
'error', // controller
'privileges', // action
);
public function preDispatch($request)
{
$acl = Zend_Registry::get('acl');
$auth = Zend_Auth::getInstance();

if ($auth->hasIdentity()) {
$role = 'member';
} else {
$role = 'guest';
}
$controller = $request->controller;
$action = $request->action;
$module = $request->module;
$resource = $controller;
if (!$acl->has($resource)) {
$resource = NULL;
}
if (!$acl->isAllowed($role, $resource, $action)) {
if (!$auth->hasIdentity()) {
list($module, $controller, $action) = $this->_notAuthenticated;
} else {
list($module, $controller, $action) = $this->_noAllowed;
}
$request
->setModuleName($module)
->setControllerName($controller)
->setActionName($action);
$request->setDispatched(false);
}
}
}

Are my implementations correct? Any help would be greatly appreciated.

PS: As a side note, php keeps telling me that strict standards are not being
upheld in my implementation of
Zend_Controller_Plugin_Abstract::preDispatch(), and it sites the last line
of my class. I've studied the code for the abstract class and can't see
where I went wrong. Any ideas on that?

--regards,
nathan

[fw-mvc] Re: Zend Email

I am doing something:

With Attachment:

public function sendBodyEmail($mailto, $subject, $mailfrom,$from, $body)
{
try {
$mail = new Zend_Mail('UTF-8');
$mail->setType(Zend_Mime::MULTIPART_RELATED)
->addAttachment($this->_at)
->setSubject($subject)
->addTo($mailto)
->setFrom ( $mailfrom,$from )
->setBodyHtml($body);
$result = $mail->send ();
} catch ( Zend_Mail_Exception $e ) {
$e->getMessage ();
$result = false;
}
return $result;

}

No Attachment:

public static function sendBodyEmail($mailfrom,$from, $subject, $body,
$toemail, $toname)
{

try {

$mail = new Zend_Mail ('utf-8');
$mail->addTo ( $toemail, $toname)
->setFrom ( $mailfrom,$from )
->setSubject ( $subject )
->setBodyHtml ( $body );
$result = $mail->send ();
} catch ( Zend_Mail_Exception $e ) {
$e->getMessage ();
return $result;
}
return $result;
}

aplication.ini

;Mail
resources.mail.transport.type = "smtp"
resources.mail.transport.host = "smtp.googlemail.com"
resources.mail.transport.auth = "login"
resources.mail.transport.port = "465"
resources.mail.transport.ssl = "ssl"
resources.mail.transport.username = "email@gmail.com"
resources.mail.transport.password = "pass"
resources.mail.transport.register = "true"

resources.mail.defaultFrom.email = "email@gmail.com"
resources.mail.defaultFrom.name = "name"
resources.mail.defaultReplyTo.email = "email@gmail.com"
resources.mail.defaultReplyTo.name = "name"
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Email-tp3229929p3229973.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] Zend Email

Hi Thomas,

check your local mail log to ensure its definitely being sent. Not
sure where you would find this on Mac OS X but is located @
/var/log/mail.log for most linux distributions. It may well be your mta
isn't running, or not doing what it should.

Also I'm guessing $to is a valid email address?

Also it may be the address your sending it to is catching it as spam if
you've not correctly configured an MX record for the domain your sending
form. Check you junk / spam folder to make sure its not fallen into any of
those.

As far as the syntax goes, it looks like you've got it pretty spot on to me.

On Fri, Jan 21, 2011 at 3:41 PM, Thomas List <thomaslist@hotmail.com> wrote:

>
> Hello All,
>
> I am trying to create a Contact Us page using the Zend framework, and it's
> behaving strangely....I sent out a bunch of test emails for various
> configurations of the code in the controller, and I received the emails this
> morning. I'm currently testing it on my local environment, which is Mac OS
> X, with Darwin OS. I feel like I'm dancing around with the code, but just
> not getting the correct configuration for sending email from a Zend/PHP
> class.
>
> This is the code I am using right now:
>
> require_once ('Zend/Mail.php');
> //$tr = new Zend_Mail_Transport_Smtp('localhost');
> // Zend_Mail::setDefaultTransport($tr);
> $mail = new Zend_Mail();
> $mail->setBodyText('$message');
> $mail->setFrom($yourEmail, 'Thomas List');
> $mail->addTo($to, 'Thomas List');
> $mail->setSubject($subject);
> $mail->send();
>
> I am not sure which way to go on this one...it seems that there are several
> solutions out there on the web, but they don't seem to work either. Any
> ideas would be very much appreciated.
>
> Regards,
> Thomas
>

[fw-mvc] Zend Email

Hello All,

I am trying to create a Contact Us page using the Zend framework, and it's behaving strangely....I sent out a bunch of test emails for various configurations of the code in the controller, and I received the emails this morning. I'm currently testing it on my local environment, which is Mac OS X, with Darwin OS. I feel like I'm dancing around with the code, but just not getting the correct configuration for sending email from a Zend/PHP class.

This is the code I am using right now:

require_once ('Zend/Mail.php');
//$tr = new Zend_Mail_Transport_Smtp('localhost');
// Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail();
$mail->setBodyText('$message');
$mail->setFrom($yourEmail, 'Thomas List');
$mail->addTo($to, 'Thomas List');
$mail->setSubject($subject);
$mail->send();

I am not sure which way to go on this one...it seems that there are several solutions out there on the web, but they don't seem to work either. Any ideas would be very much appreciated.

Regards,
Thomas

2011年1月20日星期四

[fw-mvc] Re: CSS Issue

harish wrote:
>
> CSS Issue -
>
> I'm processing a request on Index page and after the request is successful
> i'm redirecting it back to Index page.
>
> First time when I open Index page everything works fine but after
> redirecting it back to Index page the CSS and the images do not appear.
>
> I just wanted to let you know I'm not using any layouts, I've just put all
> of my pages separately in the "views" section with respective actions.
>

It sounds like you're saying, you're going to:
http://yoursite/index.php (things work)
and then redirecting sends you to:
http://yoursite/index/ (things don't work)

Looks like you don't have url rewriting set up:
For Apache, IIS, Lighttpd:
http://framework.zend.com/manual/en/zend.controller.router.html

I also recommend reading:
http://framework.zend.com/manual/en/zend.controller.quickstart.html

Cheers,
David
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/CSS-Issue-tp3225491p3228859.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] Re: Config appnamespace

I am doing so:

aplication
|- models
| |--Form
| | |---Reservations.php
| |-Room.php
|
|-modules
|--hotelfornt
| |-controller
| |-views
|
|--hotelreservation


aplication.ini:

resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"

Bootstrap:

protected function _initAutoload() {
$modelLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));

return $modelLoader;
}

Using Form:
new Model_Form_Reservations();
Using Room:
new Model_Room();
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Config-appnamespace-tp3228784p3228799.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] Config appnamespace

Hi,

I got problems with configure application autoloader.
If I have 2 separated modules as following.
And my application is follow recommended structure that have application.ini
file

application/
|--config/
|--layouts/
|--modules/
| |--hotelfront/
| |--models/
| |--Room.php
| |--hotelreservation/
| |--forms/
| |--Reservation.php
library/
public/

I decide to take advantage of using Zend_Application.
If I want to load resource like this:

Hotelfront_Model_Room
Hotelreservation_Form_Reservation

What should i do? Is appnamespace directive (in ZF 1.10) a solution for this
situation? If so how?
What is exactly appnamespace for?
Thank you.

regards.

tik50
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Config-appnamespace-tp3228784p3228784.html
Sent from the Zend MVC mailing list archive at Nabble.com.

Re: [fw-mvc] Re: CSS Issue

Hey!

The problem seems to be an issue with uri-rewriting of our favourite
native american, Apache. :)

He matches a standard RewriteRoule of your .htaccess, let's say
RewriteRule ^.*$ /index.php [NC,L]
to the requests. So let's say you give the uri to your image foobar.png
/media/images/foobar.png
the client, i.e. your browser, who wants to fetch all other files like
.css, .js or .png, now gets the uri
<yourdomain>/index.php
which is, of course not right, cause your images are in
<yourdomain>/media/images/

So, just put a line like that into your .htaccess file ABOVE the
standard RewriteRule
RewriteRule media/(.*)\.(css|jpe?g|gif|png)$ - [L,T=image/*]
which advises the apache to NOT OVERWRITE the uri to
<yourdomain>/index.php
but to let it just as it is. The general form of RewriteRules is kinda like that
RewriteRule <regex-pattern-to-be-matched> <overwriting-uri>
[<one-or-more-flags>]

Consider reading some documentation about the uri rewriting [1] or the
apache docs [2]. The flag L stands for LAST (last matched rule, i.e.
stop matching request against rules) and T for TYPE (image, you
see..). The flag NC above stands for "NO CASE" which results in
case-insensitive pattern-matching.

Hope that helps you a little bit!

Ciao Nico

[1] http://www.widexl.com/tutorials/mod_rewrite.html
[2] http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html


On Thu, Jan 20, 2011 at 3:30 PM, harish <harish.20007@gmail.com> wrote:
>
> Hello David,
>
> I'm new to Zend, and thanks a lot for the the solution regarding "forward"
> issue, i was struggling with this all day.
>
> CSS Issue -
>
> I'm processing a request on Index page and after the request is successful
> i'm redirecting it back to Index page.
>
> First time when I open Index page everything works fine but after
> redirecting it back to Index page the CSS and the images do not appear.
>
> I just wanted to let you know I'm not using any layouts, I've just put all
> of my pages separately in the "views" section with respective actions.
>
> I really appreciate your help.
>
> Thanks,
>
> Harish
>
> --
> View this message in context: http://zend-framework-community.634137.n4.nabble.com/CSS-Issue-tp3225491p3225517.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>

[fw-mvc] Re: CSS Issue

Hello David,

I'm new to Zend, and thanks a lot for the the solution regarding "forward"
issue, i was struggling with this all day.

CSS Issue -

I'm processing a request on Index page and after the request is successful
i'm redirecting it back to Index page.

First time when I open Index page everything works fine but after
redirecting it back to Index page the CSS and the images do not appear.

I just wanted to let you know I'm not using any layouts, I've just put all
of my pages separately in the "views" section with respective actions.

I really appreciate your help.

Thanks,

Harish

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/CSS-Issue-tp3225491p3225517.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] Re: CSS Issue

Harish,

_forward() does not do a redirect, but rather forwards the *current* request
on to another controller.
Use _redirect() instead.

http://framework.zend.com/manual/en/zend.controller.action.html#zend.controller.action.utilmethods

Not enought info for the CSS issue though. A shot in the dark would be that
there's an issue with the rewrite rule you're using.

Cheers,
David
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/CSS-Issue-tp3225491p3225502.html
Sent from the Zend MVC mailing list archive at Nabble.com.

[fw-mvc] CSS Issue

Hello,

I'm facing issue with CSS paths, when I genrally run index.php it works fine
but when I again click on index page all off the CSS and images do not
appear.

Also, when I use _forward in zend and redirect the URL still remains the
same, so on refresh it gives an error.

Thanks,

Harish


--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/CSS-Issue-tp3225491p3225491.html
Sent from the Zend MVC mailing list archive at Nabble.com.

2011年1月19日星期三

Re: [fw-mvc] AjaxContext action helper not disabling layouts?

Are you also passing in the "format=html" parameter in your AJAX request?

--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com

On Wed, Jan 19, 2011 at 1:24 PM, Nathan Garlington <garlinto@gmail.com>wrote:

> I'm using ZF-1.11.2. In the init() method of my controller is this code:
>
> // configure the ajax context switch helper
> $ajaxContext = $this->_helper->getHelper('AjaxContext');
> $ajaxContext
> ->addActionContext('sortmanufacturer', 'html')
> ->addActionContext('sorttype', 'html')
> ->addActionContext('emailoffer', 'html')
> ->addActionContext('emailfriend', 'html')
> ->initContext();
>
> But i noticed that the entire view w/ layout is being returned. I'm having
> to explicitly include:
>
> $this->_helper->layout->disableLayout();
>
> in each action in which a switch occurs. I should mention that the actions
> in which this behavior occurs are not accessed via a typical http
> request...they are being called by XHR only without having a typical http
> view. For example, the action manufacturerAction() will, in it's
> viewscript,
> make a call to sortmanufacturerAction via XHR. But sortmanufacturerAction
> is
> returning the layout in it's response. sortmanufacturerAction() is never
> accessed as a stand-alone action. I don't know if this matters, but this
> wasn't the behavior prior to 1.11 as far as I know (hadn't tested it in a
> while prior to upgrading to 1.11.2, and can't remember what version I
> upgraded from, sorry!). All I had to do was setup the context switch as
> above and nothing else was needed.
>
> Am I using the ajaxContext incorrectly, or am I misunderstanding how it
> works, or both?
>
> --regards,
> nathan
>

[fw-mvc] AjaxContext action helper not disabling layouts?

I'm using ZF-1.11.2. In the init() method of my controller is this code:

// configure the ajax context switch helper
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext
->addActionContext('sortmanufacturer', 'html')
->addActionContext('sorttype', 'html')
->addActionContext('emailoffer', 'html')
->addActionContext('emailfriend', 'html')
->initContext();

But i noticed that the entire view w/ layout is being returned. I'm having
to explicitly include:

$this->_helper->layout->disableLayout();

in each action in which a switch occurs. I should mention that the actions
in which this behavior occurs are not accessed via a typical http
request...they are being called by XHR only without having a typical http
view. For example, the action manufacturerAction() will, in it's viewscript,
make a call to sortmanufacturerAction via XHR. But sortmanufacturerAction is
returning the layout in it's response. sortmanufacturerAction() is never
accessed as a stand-alone action. I don't know if this matters, but this
wasn't the behavior prior to 1.11 as far as I know (hadn't tested it in a
while prior to upgrading to 1.11.2, and can't remember what version I
upgraded from, sorry!). All I had to do was setup the context switch as
above and nothing else was needed.

Am I using the ajaxContext incorrectly, or am I misunderstanding how it
works, or both?

--regards,
nathan

Fwd: [fw-db] About Zend

Hey!

I think you need to fetch some informations about what happens exactly:
(I assume you are using Zend_Application and you give the configs'
path to its constructor.)

1. First of all, see whether your settings are correctly loaded. Maybe
try var_dump()-ing Zend_Application::getOptions() after you've loaded
the config-file.

2. Then, see if your configurations are used to load ZendX_Db_Adapter.
I don't know your application architecture, but try var_dump()-ing the
object, you are using to build and execute the query and see whether
its db-configurations are correctly set.

3. What is the kind of error? I mean, is it an uncaught exception? May
an exception be suppressed by your configurations? If yes, switch off
the suppression for your development environment. Or is there not any
reaction (that would be bad. try getting your system more verbose if
so).
Generally, try to play with your system. Make it more verbose (only
for developmental concerns). Try setting var_dumps() (with (maybe) a
subsequent call to die()) in several points of your application.
Sorry, to be helping in such a superficial way, but we would need some
further application details for helping concretely.

Best regards,
Ciao Nico

Re: [fw-db] About Zend

Hey!

I think you need to fetch some informations about what happens exactly:
(I assume you are using Zend_Application and you give the configs' path to
its constructor.)

1. First of all, see whether your settings are correctly loaded. Maybe try
var_dump()-ing Zend_Application::getOptions() after you've loaded the
config-file.

2. Then, see if your configurations are used to load ZendX_Db_Adapter. I
don't know your application architecture, but try var_dump()-ing the object,
you are using to build and execute the query and see whether its
db-configurations are correctly set.

3. What is the kind of error? I mean, is it an uncaught exception? May an
exception be suppressed by your configurations? If yes, switch off the
suppression for your development environment. Or is there not any reaction
(that would be bad. try getting your system more verbose if so).

Generally, try to play with your system. Make it more verbose (only for
developmental concerns). Try setting var_dumps() (with (maybe) a subsequent
call to die()) in several points of your application. Sorry, to be helping
in such a superficial way, but we would need some further application
details for helping concretely.

Best regards,
ciao Nico

[fw-db] Re: Sqlite utf 8

In The Definitive Guide
to SQLite I found
[Some settings such as page size and character encoding (UTF-8, UTF-16,
etc.) cannot be changed once the database is created, so this interim is
where you have a chance
to specify them.]

So you should set the utf 8 encoding in the script where you create the DB.

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Sqlite-utf-8-tp3217424p3225437.html
Sent from the Zend DB mailing list archive at Nabble.com.

Re: [fw-db] About Zend

Inline:

> db.params.adapterNamespace = "ZendX_Db_Adapter"

It should go without saying that you actually need to have the ZendX
(Zend Extras) library if you plan to use Firebird and make sure it is in
your include_path. As this line was missing in your first code example,
you should check to make sure you have the library for
ZendX/Db/Adapter/Firebird.php in your project.

-ralph

Res: [fw-db] About Zend

Hi, try using

db.adapter = "Firebird"
db.params.adapterNamespace = "ZendX_Db_Adapter"
db.params.username = "SYSDBA"
db.params.password = "MASTERKEY"
db.params.host = 10.2.1.5
db.params.port = "3051"
db.params.dbname = "D:\UDB\TEST\LAWYERNUDB.FDB"
db.params.charset = "utf8"
Atenciosamente,
Luiz Fernando - 47 8406-3631
Profire ltda


________________________________
De: Steve Rayner <SRayner@williams-refrigeration.co.uk>
Para: "fw-db@lists.zend.com" <fw-db@lists.zend.com>
Enviadas: Quarta-feira, 19 de Janeiro de 2011 14:31:40
Assunto: RE: [fw-db] About Zend


Try this;

db.adapter = "Firebird"
db.params.adapterNamespace = "ZendX_Db_Adapter"
db.params.username = "SYSDBA"
db.params.password = "MASTERKEY"
db.params.dbname = "10.2.1.5/3051:D:\UDB\TEST\LAWYERNUDB.FDB"
db.params.charset = "utf8"

I notice you are not using the default port. I could not get that to work, so
let me know if you have any success.

Regards

Steve Rayner

-----Original Message-----
From: Konstantin ********** [mailto:konstantinovedernikov@gmail.com]
Sent: 18 January 2011 08:31
To: fw-db@lists.zend.com
Subject: [fw-db] About Zend

Hello!

My name is Konstantin. I'm a web-developer. I'm creating web-system for law
department by Zend Fraimwork.
Could you help me with one point please. I'm using FireBird. If i wrote:
db.adapter = Firebird
db.config.host = 10.2.1.5/3051:D:\UDB\TEST\LAWYERNUDB.FDB
db.config.username = SYSDBA
db.config.password = MASTERKEY
db.config.dbname =
I haven't data. Query doesn't work.

Thank you!!!

-
Williams Refrigeration is a trading name of AFE Group Limited.
Registered in England & Wales under Registered Number 3872673. Registered
Office Address - Bryggen Road, North Lynn, Industrial Estate, Kings Lynn,
Norfolk, PE30 2HZ

Williams Refrigeration filters email attachments for spam and viruses and
malicious content with Sophos Puremessage. While every care has been made to
ensure that this message is secure and virus free, we cannot be held responsible
for any damage arising from computer viruses and advise that you perform your
own checks on this and any other inbound messages.

This e-mail and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed. If
you have received this email in error or are having trouble sending email to us
please notify the system administrator - postmaster@williams-refrigeration.co.uk

Any views or opinions expressed in this e-mail are those of the sender and do
not necessarily coincide with those of Williams Refrigeration or the AFE Group.

RE: [fw-db] About Zend

Try this;

db.adapter = "Firebird"
db.params.adapterNamespace = "ZendX_Db_Adapter"
db.params.username = "SYSDBA"
db.params.password = "MASTERKEY"
db.params.dbname = "10.2.1.5/3051:D:\UDB\TEST\LAWYERNUDB.FDB"
db.params.charset = "utf8"

I notice you are not using the default port. I could not get that to work, so let me know if you have any success.

Regards

Steve Rayner

-----Original Message-----
From: Konstantin ********** [mailto:konstantinovedernikov@gmail.com]
Sent: 18 January 2011 08:31
To: fw-db@lists.zend.com
Subject: [fw-db] About Zend

Hello!

My name is Konstantin. I'm a web-developer. I'm creating web-system for law
department by Zend Fraimwork.
Could you help me with one point please. I'm using FireBird. If i wrote:
db.adapter = Firebird
db.config.host = 10.2.1.5/3051:D:\UDB\TEST\LAWYERNUDB.FDB
db.config.username = SYSDBA
db.config.password = MASTERKEY
db.config.dbname =
I haven't data. Query doesn't work.

Thank you!!!

-
Williams Refrigeration is a trading name of AFE Group Limited.
Registered in England & Wales under Registered Number 3872673. Registered
Office Address - Bryggen Road, North Lynn, Industrial Estate, Kings Lynn, Norfolk, PE30 2HZ

Williams Refrigeration filters email attachments for spam and viruses and malicious content with Sophos Puremessage. While every care has been made to ensure that this message is secure and virus free, we cannot be held responsible for any damage arising from computer viruses and advise that you perform your own checks on this and any other inbound messages.

This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error or are having trouble sending email to us please notify the system administrator - postmaster@williams-refrigeration.co.uk

Any views or opinions expressed in this e-mail are those of the sender and do not necessarily coincide with those of Williams Refrigeration or the AFE Group.

2011年1月18日星期二

Re: [fw-mvc] Using Action Helpers to disable the action dispatch

Matthew,

Thanks for your response. I've learned 2 things since I've posted: 1)
The ContextSwitch action helper does not hook into preDispatch() at
all (doh!), and 2) Running $this->getRequest()->setDispatched(false);
within the preDispatch() method of an action helper will cause an
infinite loop, and an eventual timeout. I'm pretty sure this has to do
with the Do..While loop within the Front Controller's dispatch()
method. I could be wrong.

The solution (for me) is to extend Zend_Controller_Action, add
protected $_cancelAction = false, and a setCancelAction($flag) method
for changing it. Then, within the controller action's dispatch()
method, modify the IF statement to read:

if ($this->getRequest()->isDispatched() && !$this->_cancelAction) {

Once these modifications were made, a simple call to
setCancelAction(true) anywhere within the controller action's or
action helper's preDispatch() or init() method will prevent the action
from being executed, along with the controller action's postDispatch()
method. However, the action helper's postDispatch() will still
execute.

Mission accomplished!

On Mon, Jan 17, 2011 at 6:42 AM, Matthew Weier O'Phinney
<matthew@zend.com> wrote:
> -- No Spam <nospamchicago@gmail.com> wrote
> (on Saturday, 15 January 2011, 12:29 AM -0800):
>> I'd like to bypass the action dispatch from within an Action Helper.
>> I'm using a customized ContextSwitch action helper to switch the
>> context of a request, and within a certain context, I don't need to
>> execute the action. I simply need for the Action Helper to execute
>> it's pre- and postDispatch functions (which set some view variables).
>>
>> I've attempted to do this via the Action Helper's preDispatch() method
>> using $this->getRequest()->setDispatched(false).
>
> Pass a boolean "true" value instead.
>
>> However, it's not actually modifying the request within the Action
>> Controller. I've tried modifying the request, then setting the Action
>> Controller's request to the modified one. Still, no dice.
>>
>> How would I go about this?
>>
>> Thanks.
>>
>
> --
> Matthew Weier O'Phinney
> Project Lead            | matthew@zend.com
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>

[fw-db] About Zend

Hello!

My name is Konstantin. I'm a web-developer. I'm creating web-system for law
department by Zend Fraimwork.
Could you help me with one point please. I'm using FireBird. If i wrote:
db.adapter = Firebird
db.config.host = 10.2.1.5/3051:D:\UDB\TEST\LAWYERNUDB.FDB
db.config.username = SYSDBA
db.config.password = MASTERKEY
db.config.dbname =
I haven't data. Query doesn't work.

Thank you!!!

2011年1月17日星期一

Re: [fw-mvc] Using Action Helpers to disable the action dispatch

-- No Spam <nospamchicago@gmail.com> wrote
(on Saturday, 15 January 2011, 12:29 AM -0800):
> I'd like to bypass the action dispatch from within an Action Helper.
> I'm using a customized ContextSwitch action helper to switch the
> context of a request, and within a certain context, I don't need to
> execute the action. I simply need for the Action Helper to execute
> it's pre- and postDispatch functions (which set some view variables).
>
> I've attempted to do this via the Action Helper's preDispatch() method
> using $this->getRequest()->setDispatched(false).

Pass a boolean "true" value instead.

> However, it's not actually modifying the request within the Action
> Controller. I've tried modifying the request, then setting the Action
> Controller's request to the modified one. Still, no dice.
>
> How would I go about this?
>
> Thanks.
>

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

2011年1月15日星期六

Re: [fw-db] Re: How can I group my queries with a Zend_Db_Select statement?

On Jan 15, 2011, at 8:51 AM, jbeall wrote:

>
> Ok, I think I found the answer. Let me know if this is the "right"
> way to do
> it. I put everything I want inside the same conditional group in
> the same
> where() call, like this:
>
> $select = $select->where('firstname LIKE ? OR lastname LIKE ?',
> 'Paul');
> $select = $select->where('gamedate ?', '2010-06-25');

Yes, this is the best way to do this particular expression, given the
simple interface of Zend_Db_Select.

Regards,
Bill Karwin

[fw-db] Re: How can I group my queries with a Zend_Db_Select statement?

Ok, I think I found the answer. Let me know if this is the "right" way to do
it. I put everything I want inside the same conditional group in the same
where() call, like this:

$select = $select->where('firstname LIKE ? OR lastname LIKE ?', 'Paul');
$select = $select->where('gamedate ?', '2010-06-25');

This yields SQL with the firstname/lastname conditional inside a single set
of parentheses, just like I want.

Thanks for any feedback!
--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-can-I-group-my-queries-with-a-Zend-Db-Select-statement-tp3219254p3219258.html
Sent from the Zend DB mailing list archive at Nabble.com.