akingsky 2015-01-29 10:17:33 33744次浏览 24条评论 10 2 0

MoBlog

下载

github仓库:https://github.com/mojifan/MoBlog

coding仓库: https://coding.net/u/mojifan/p/MoBlog/git

演示

网址: http://moblog.coding.io/

说明

1.MoBlog是一个基于Yii2开发的博客系统,目前一些功能正在完善

2.数据库设计直接采用typecho的数据库结构,功能结构也是模仿typecho

3.为了部署到coding演示平台,省掉了yii命令部署方式

安装

1.下载或clone源码,运行composer install安装依赖

2.导入common/data/blog.sql文件到数据库,配置common/config/main-local.php文件中数据库组件

3.配置nginx或apache网站根目录到web文件夹

4.前台访问index.php文件,后台访问admin.php文件

5.后台账号admin 密码123456

协议

MIT

觉得很赞
  • 评论于 2015-01-29 15:20 举报

    后台登录不了,密码错误!

    1 条回复
    评论于 2015-01-29 16:19 回复

    在线演示的密码改了

  • 评论于 2015-02-02 10:51 举报

    此源码不错......

  • 评论于 2015-02-26 16:45 举报

    博客前台的模板方便说一下..我发觉太多缺的了.看自己能不能补全一下..

    2 条回复
    评论于 2015-02-26 17:39 回复

    什么意思?前台模板是扒的多说的博客

    评论于 2015-02-27 09:46 回复

    @akingsky: 好..谢谢啦.

  • 评论于 2015-03-04 11:43 举报

    不错,可以使用。后台密码:123456

  • 评论于 2015-03-22 13:42 举报

    小编你好,composer install怎么弄啊!我是小白,不会呀!麻烦你教我弄一下,谢谢!

    1 条回复
    评论于 2015-03-22 16:16 回复

    就是你装一个composer,然后在根目录下面,运行composer命令就可以了。

    觉得很赞
  • 评论于 2015-03-22 16:26 举报

    整个框架和原来的不太一样,楼主做了一些修改,对于我这种新手来说,还是有一点吃力啊。
    访问后台管理页admin.php的时候,自动跳转到http://localhost/MoBlog/web/admin.php/site/login
    然后提示404,有人知道怎么解决么?给点提示吧

    6 条回复
    评论于 2015-03-26 22:58 回复

    不好意思这种目录情况没有处理 ,最好是将apache /nginx 的web根目录 设置到moblog/web目录 下 然后localhost/admin.php这样访问,

    评论于 2015-03-27 17:39 回复

    同样的错误,访问localhost/admin.php 自动跳转到 http://localhost/MoBlog/web/admin.php/site/login ,然后提示404。。。

    评论于 2015-03-28 10:52 回复

    可否贴一下 nginx/apache的配置

    评论于 2015-04-02 09:28 回复

    server {
            listen 8080;
            server_name localhost;
            root /home/wwwroot/MyBlog/web;
            index index.php index.html index.htm;
            location ~ \.php$ {
                    fastcgi_pass 127.0.0.1:9000;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
            }
            location / {
                    try_files $uri $uri/ /index.php?$args;
            }
         }
    }
    
    评论于 2015-11-23 15:00 回复

    location /admin.php {

    		try_files $uri $uri/ /admin.php?$args;
    	}  添加一下这个就ok了
    
    评论于 2016-01-27 22:47 回复

    location /admin.php {
        try_files $uri $uri/ /admin.php?$args;
    }
    

    这行非常管用。楼主解释问题很负责任。赞。

  • 评论于 2015-03-24 14:33 举报

    额,第一次用Yii。。
    可否说下路由规则在哪里定义啊。

    1 条回复
    评论于 2015-03-26 23:01 回复

    如果要自定义路由规则 是在配置文件 urlManager 组件 rules属性

  • 评论于 2015-04-13 17:21 举报

    撰写新文章时报错啊:
    The file or directory to be published does not exist: D:\wamp\www\blog/vendor\npm/bootstrap-markdown

    1 条回复
    评论于 2015-04-25 17:06 回复

    我bootstrap-markdown是通过composer下载的,你的bootstrap-markdown下载失败?composer update更新一下试试

  • 评论于 2015-05-24 16:51 举报

    同样错误唉 我本地apache是好的 线上是lnmp环境就报这个404

    1 条回复
    评论于 2015-05-25 11:25 回复

    配置一下nginx就可以了,因为我的代码里只用.htaccess 配置的apache rewrite nginx要自己配置 看这里nginx的配置 http://apidoc.yii2.cn/guide-start-installation.html

  • 评论于 2015-07-09 10:41 举报

    gii无法使用

    6 条回复
    评论于 2015-07-10 20:38 回复

    配置一下ip

    评论于 2015-07-11 08:57 回复

    index.php 配置

    defined('YII_DEBUG') or define('YII_DEBUG', true);
    
    defined('YII_ENV') or define('YII_ENV', 'dev');
    

    main-local.php 配置

    if (YII_ENV_DEV) {
    	$config['bootstrap'][] = 'debug';
    	$config['modules']['debug'] = [
    	'class'=>'yii\debug\Module',
    	'allowedIPs'=>['127.0.0.1','192.168.0.*'],
    	];
    
    	$config['bootstrap'][] = 'gii';
    	$config['modules']['gii'] = [
    	'class'=>'yii\gii\Module',
    	'allowedIPs'=>['127.0.0.1','192.168.0.*'],
    	];
    }
    

    浏览器访问
    http://localhost/master/web/index.php?r=gii
    还是在首页,没有跳到gii页面
    就是不行啊,我下载原版的配置就可以用,为什么呢?

    评论于 2015-07-12 10:52 回复

    我配置了url 路由, http://localhost/master/web/gii 这样访问呢?

    评论于 2015-07-13 10:00 回复

    囧,这样可以了,谢谢!如果改这个路由规则在什么地方修改呢,我想前台和后台是分开的

    评论于 2015-07-13 20:45 回复

    路由规则在配置文件里修改啊,如果想前后台分开 那就把web目录的,index.php admin.php 分开到不同目录,然后修改文件里面的引用路径就可以了

    评论于 2015-07-14 09:11 回复

    好的,多谢啦!

  • 评论于 2015-07-10 20:38 举报

    配置一下ip

  • 评论于 2015-07-17 15:20 举报

    在使用日期控件或编辑器控件时会报错
    Class 'yii\jui\DatePicker' not found
    这个控件实在web\vendor 下面的,是不是要更改什么设置才可以?

    1 条回复
    评论于 2015-07-17 22:29 回复

    我没用jui的日期控件,我用的自己其他控件

  • 评论于 2015-07-27 17:54 举报

    发布文章时,分类的文章数BUG。

    我先发布了一个文章,选择了默认分类,状态公开,发布后默认分类文章数加1,这是正常的,

    但,当在修改这篇文章时,我同时选择了两个分类,状态还是公开,发布后,另一个分类的文章数是没有变化的

    if(isset($changedAttributes['status'])){
        $beforeCount=$changedAttributes['status']==static::STATUS_PUBLISH;
        $afterCount=$this->status==static::STATUS_PUBLISH;
    }
    

    上面这段代码引起的,楼主只判断了,当文章的发布状态改变时,才给分类加上和减去文章数

    2 条回复
    评论于 2015-07-28 22:16 回复

    数量统计确实有些bug

    评论于 2015-07-28 22:24 回复

    我把他改成这样就好了

    public function afterSave($insert, $changedAttributes)
        {
            parent::afterSave($insert, $changedAttributes);
    
            if ($this->do == 'save') {
    
                $this->saveCategory(false, false);
                $this->saveTags(false, false);
                
            } elseif ($this->do == 'publish') {
                /* 是否是从草稿状态发布 */
                $isDraftToPublish = ($this->getOldAttribute('type') == self::TYPE_DRAFT);
    
                /* 以前是否是发布的 */
                $isBeforePublish = ($this->getOldAttribute('status') == self::STATUS_PUBLISH);
    
                /* 现在是否是发布的 */
                $isAfterPublish = ($this->status == self::STATUS_PUBLISH);
    
                // 保存文章对应分类
                $this->saveCategory(!$isDraftToPublish && $isBeforePublish, $isAfterPublish);
    
                // 保存标签
                $this->saveTags(!$isDraftToPublish && $isBeforePublish, $isAfterPublish);
            }
            
        }
    
  • 评论于 2015-11-27 15:41 举报

    我是新手,按照步骤来的,访问http://localhost/moblog/web/index.php报错:Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

    More information about this error may be available in the server error log.

    Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80

    1 条回复
    评论于 2015-12-04 11:06 回复

    这是500错误吧,看日志

  • 评论于 2016-01-11 18:05 举报

    楼主能发个coding演示的教程嘛, 看了coding 上的文档不太懂怎么弄?

    2 条回复
    评论于 2016-01-20 10:20 回复

    coding演示平台部署教程?

    评论于 2016-01-20 21:02 回复

    是啊,就是在coding上部署演示,我想把我用yii2写的博客部署到上面去,搞了下没有成功啊

  • 评论于 2016-01-20 12:56 举报

    好像撰写文章出错了。。。

    2 条回复
    评论于 2016-01-25 16:02 回复

    看日志。。。

    评论于 2016-01-30 14:43 回复

    The file or directory to be published does not exist: /home/w/web/moblog/vendor/npm/bootstrap-markdown
    这个错误解决方法:
    vim vendor/yiisoft/yii2/base/Application.php:458行左右:
    将此行注释:

        //Yii::setAlias('@npm', $this->_vendorPath . DIRECTORY_SEPARATOR . 'npm');
    

    修改为:

        Yii::setAlias('@npm', $this->_vendorPath . DIRECTORY_SEPARATOR . 'npm'. DIRECTORY_SEPARATOR . 'npm-asset');
    

    就是加了个npm-asset子目录。

  • 评论于 2016-01-30 14:43 举报

    The file or directory to be published does not exist: /home/w/web/moblog/vendor/npm/bootstrap-markdown
    这个错误解决方法:
    vim vendor/yiisoft/yii2/base/Application.php:458行左右:
    将此行注释:

        //Yii::setAlias('@npm', $this->_vendorPath . DIRECTORY_SEPARATOR . 'npm');
    

    修改为:

        Yii::setAlias('@npm', $this->_vendorPath . DIRECTORY_SEPARATOR . 'npm'. DIRECTORY_SEPARATOR . 'npm-asset');
    

    就是加了个npm-asset子目录。

  • 评论于 2016-01-30 14:47 举报

    bower报错了,用类似的方法:
    The file or directory to be published does not exist: /home/w/web/moblog/vendor/bower
    这个错误解决方法:
    vim vendor/yiisoft/yii2/base/Application.php:456行左右:
    将此行注释:

        //Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower');
    

    修改为:

       Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower' . DIRECTORY_SEPARATOR . 'bower-asset');
    

    就是加了个bower-asset子目录。
    如果这样改还不生效,要自己手动检查下composer安装markdown等后创建的目录。

  • 评论于 2016-04-22 15:47 举报
    [root moblog]# composer update
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - The requested package npm-asset/bootstrap-markdown could not be found in any version, there may be a typo in the package name.
      Problem 2
        - The requested package npm-asset/markdown could not be found in any version, there may be a typo in the package name.
      Problem 3
        - yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
        - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
        - yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
        - yiisoft/yii2 2.0.4 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
        - yiisoft/yii2 2.0.3 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
        - yiisoft/yii2 2.0.2 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
        - yiisoft/yii2 2.0.1 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
        - yiisoft/yii2 2.0.0 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
        - Installation request for yiisoft/yii2 * -> satisfiable by yiisoft/yii2[2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7].
    
    Potential causes:
     - A typo in the package name
     - The package is not available in a stable-enough version according to your minimum-stability setting
       see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
    
    Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
    

    这个包是不是该更新了还是我的环境有问题啊

    2 条回复
    评论于 2016-04-26 14:32 回复

    包应该没问题,你用composer install试试

    评论于 2016-12-09 23:14 回复

    由于无法使用composer完成依赖安装,所以我解决了依赖后新建了一个版本库,供大家使用。https://github.com/kunx-edu/moblog

    另附上解决依赖的步骤:

    拷贝yii2离线安装包中的vendor到moblog的根目录
    修改moblog/web/admin.php中的调试模式为true
    根据提示中的内容去github上搜索所需要的包,markdown的包是在npm网站找到的github地址。

  • 评论于 2016-08-27 12:28 举报
    F:\xxx\www\yii_blog>composer install
    You are running composer with xdebug enabled. This has a major impact on runtime
     performance. See https://getcomposer.org/xdebug
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Warning: The lock file is not up to date with the latest changes in composer.jso
    n. You may be getting outdated dependencies. Run update to update them.
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Installation request for fxp/composer-asset-plugin v1.0.0-beta4 -> satisfi
    able by fxp/composer-asset-plugin[v1.0.0-beta4].
        - fxp/composer-asset-plugin v1.0.0-beta4 requires composer-plugin-api 1.0.0
    -> no matching package found.
      Problem 2
        - Installation request for yiisoft/yii2-composer 2.0.3 -> satisfiable by yii
    soft/yii2-composer[2.0.3].
        - yiisoft/yii2-composer 2.0.3 requires composer-plugin-api 1.0.0 -> no match
    ing package found.
      Problem 3
        - yiisoft/yii2-composer 2.0.3 requires composer-plugin-api 1.0.0 -> no match
    ing package found.
        - yiisoft/yii2 2.0.3 requires yiisoft/yii2-composer * -> satisfiable by yiis
    oft/yii2-composer[2.0.3].
        - Installation request for yiisoft/yii2 2.0.3 -> satisfiable by yiisoft/yii2
    [2.0.3].
    
    Potential causes:
     - A typo in the package name
     - The package is not available in a stable-enough version according to your min
    imum-stability setting
       see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more det
    ails.
    
    Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further commo
    n problems.
    

    我表示身体被掏空,最顶上的同志,you are not alone.

    5 条回复
    评论于 2016-08-27 12:29 回复

    求博主答疑

    评论于 2016-08-27 13:23 回复

    @scofield 解决了·····

    评论于 2016-09-08 18:10 回复

    请问是如何解决的?

    评论于 2016-12-09 22:19 回复

    像你这种既然解决,就提供解决方案,你这样对大家有什么实质性帮助么?是炫耀吧

    评论于 2016-12-09 23:15 回复

    由于无法使用composer完成依赖安装,所以我解决了依赖后新建了一个版本库,供大家使用。https://github.com/kunx-edu/moblog

    另附上解决依赖的步骤:

    拷贝yii2离线安装包中的vendor到moblog的根目录
    修改moblog/web/admin.php中的调试模式为true
    根据提示中的内容去github上搜索所需要的包,markdown的包是在npm网站找到的github地址。

您需要登录后才可以评论。登录 | 立即注册