标题: 讨教关于实现各种模块的问题
wjcx0113
新手上路
Rank: 1



UID 967
精华 0
积分 0
帖子 4
翻译 0
原创 0
阅读权限 10
注册 2008-4-6
状态 离线
发表于 2008-4-6 20:40  资料  短消息  加为好友 
讨教关于实现各种模块的问题

首先我已经实现了基本的MVC模式,能通过 .com/ 实现基本hello,world程序
现在我要实现的是 .com/blog ,./com/news 之类的模块,遇到了困难
我的目录树,ZF是1.5.0
/application
        /controllers
               IndexControllers.php
               BlogControllers.php
        /models
       / views         
             /scripts
                   /blog
                         index.phtml
                   /index   
                          index.phtml     
/ library
      /zend
      /Smarty
/ public
.htaccess
index.php
根据官方的文档7.3.2.2配置了参数
$front->setControllerDirectory(array(
    'default' => '../application/controllers',
    'blog'    => '../modules/blog/controllers',
    'news'    => '../modules/news/controllers',

可是运行的时候,输入.com/blog 就出现404错误
请问高手:
   我出现的问题在哪里?
  我该如何才能正确实现这些功能?

[ 本帖最后由 wjcx0113 于 2008-4-6 20:41 编辑 ]

顶部
haohappy
超级版主
Rank: 8Rank: 8
PHPEye站长


UID 2
精华 11
积分 110
帖子 280
翻译 6
原创 1
阅读权限 150
注册 2007-5-2
状态 离线
发表于 2008-4-6 21:04  资料  短消息  加为好友  添加 haohappy 为MSN好友 通过MSN和 haohappy 交谈





互助共享,共同成长。
顶部
wjcx0113
新手上路
Rank: 1



UID 967
精华 0
积分 0
帖子 4
翻译 0
原创 0
阅读权限 10
注册 2008-4-6
状态 离线
发表于 2008-4-6 21:06  资料  短消息  加为好友 
谢谢!怎么一直没有找到呢

顶部
wjcx0113
新手上路
Rank: 1



UID 967
精华 0
积分 0
帖子 4
翻译 0
原创 0
阅读权限 10
注册 2008-4-6
状态 离线
发表于 2008-4-6 21:55  资料  短消息  加为好友 
仔细看了这个教程,还是无法实现
我按照 他说的所谓的 指定模块的最容易的方法 改变了我的目录树,如下:
application/
        modules/
              default/i
                     controllers/
                       models/
                        views  /
              news/
                  controllers/
                     models/
                       views  /           
library/
      zend/
      Smarty/
public/
.htaccess
index.php
我的index.php是这样的:

<?php
error_reporting(E_ALL|E_STRICT);
date_default_timezone_set('Asia/shanghai');

set_include_path(dirname(__FILE__)
        . '/library' . PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php";
Zend_Loader::loadClass('Zend_Controller_Front');

// 获取前端控制器实例
$frontController = Zend_Controller_Front::getInstance();
$frontController->throwExceptions(true);
$front = Zend_Controller_Front::getInstance();

$front->addModuleDirectory('./application/modules');
// run!
$frontController->dispatch();

这样的话输入.com/ 还是能运行,可是输入.com/news 还是提示404错误.
我是新手,不知道原因啊,都是根据教程来的啊,怎么就不行呢?

[ 本帖最后由 wjcx0113 于 2008-4-7 18:05 编辑 ]

顶部
wjcx0113
新手上路
Rank: 1



UID 967
精华 0
积分 0
帖子 4
翻译 0
原创 0
阅读权限 10
注册 2008-4-6
状态 离线
发表于 2008-4-11 13:23  资料  短消息  加为好友 
已经解决了

顶部
liyong98847
新手上路
Rank: 1



UID 571
精华 0
积分 0
帖子 7
翻译 0
原创 6
阅读权限 10
注册 2007-11-16
状态 离线
发表于 2008-4-11 16:25  资料  短消息  加为好友 
回复 #5 wjcx0113 的帖子

怎么解决的?





学习
顶部
 


PHPEye开源社区


当前时区 GMT+8, 现在时间是 2008-11-21 20:08

    Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.012090 second(s), 6 queries , Gzip enabled

清除 Cookies - 联系我们 - PHPEye开源社区 - Archiver