2009年6月12日星期五

Re: [fw-mvc] Zend_Controller_Router_Route and script view

ok, i checked the wohle ecxeption thrown by ZF, i found that in the class
Zend_Layout_Controller_Plugin_Layout the method $this->getLayout() returned
an empty string. Now my route looks like

$route = new Zend_Controller_Router_Route(
'default/user/group/:group',
array(
'group' => 'member',
'controller' => 'user',
'action' => 'group'
),
array('mode' => '(member|...)')
);

and i think this works fine! Just added default/ to the route.


blinky68858877 wrote:
>
> Yes I did, if i comment out the route in the bootstrap und call the
> following url
>
> http://..../user/group/group/test
>
> all works correctly. The script shows
> .../application/default/view/scripts/user/group.phtml
>
> And the param group is correct filled with "test", only the few lines
> postet earlier caused the script to look for ".phtml" withput a name.
>
> Bevor i add the routes in the bootstrap i call
>
> self::$frontController = Zend_Controller_Front::getInstance();
> self::$frontController->throwExceptions(true);
> self::$frontController->returnResponse(true);
> self::$frontController->setControllerDirectory(
> array(
> 'default' => self::$root . '/application/default/controllers',
> 'admin' => self::$root . '/application/admin/controllers'
> )
> );
>
> and acl, auth setups. All worked very fine. ACL, Pages and so on.
>
>
> Jeroen Keppens wrote:
>>
>> Hi,
>>
>> I created a controller called UserController with an action user/
>> group.phtml.
>>
>> I then added your code (approx the same) to my bootstrap. It worked
>> fine for me.
>>
>> Can you verify that you have set up your controller correctly, created
>> the user directory in the view scripts and added a file group.phtml in
>> it?
>>
>> I'm assuming you did, but as I can't reproduce the issue I want to
>> check the basics are setup correctly.
>>
>> Tnx
>> Jeroen Keppens
>> http://blog.keppens.biz
>>
>>
>> On 12 Jun 2009, at 06:53, blinky68858877 wrote:
>>
>>>
>>> Hello,
>>> Im very new in using ZF. But everything works fine for me without
>>> Zend_Controller_Router_Route
>>> in my Bootstrap i call
>>>
>>> $router = self::$frontController->getRouter();
>>>
>>> $route = new Zend_Controller_Router_Route(
>>> 'user/group/:group',
>>> array(
>>> 'group' => 'member',
>>> 'controller' => 'user',
>>> 'action' => 'group'
>>> ),
>>> array('group' => '(member|...)') // ... stands for more ;)
>>> );
>>>
>>> $router->addRoute('user_group', $route);
>>>
>>> wehn i now create a link with this rout the url created is right.
>>> But if i
>>> klick the link, following message appears:
>>>
>>> Fatal error: Uncaught exception 'Zend_View_Exception' with message
>>> 'script
>>> '.phtml' not found in path
>>> (D:\xampp\htdocs\zend\application\layouts\;D:\xampp\htdocs\zend
>>> \application\default\views\scripts\)'
>>> in
>>>
>>> Truly, an empty script file (.phtml) woun't exist. But why trys
>>> these route
>>> to changse the script path? If am calling thes controller and action
>>> without
>>> a parameter ist works.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Zend_Controller_Router_Route-and-script-view-tp23992824p23992824.html
>>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Zend_Controller_Router_Route-and-script-view-tp23992824p24001276.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: