ARTICLE LIST

Heroku に push するとエラー “fatal: ‘heroku’ does not appear to be a git repository”

久しぶりに Heroku で運用しているサービスを修正しようとしたらプッシュするときにエラーが発生したのでメモ。

まずは clone。

$ git clone git@heroku.com:{repos-name}.git

もろもろ修正したあと、push。

$ git push heroku master
fatal: 'heroku' does not appear to be a git repository 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

怒られる。

.git/config を確認してみる。

Read More

Smarty: テンプレート読み込みで template_dir のルートから相対指定する方法

FuelPHP で Smarty を使っていたら以下のエラーが発生したのでメモ。

SmartyException [ Error ]: Unable to read template file '../******.tpl

単純にテンプレートディレクトリーの階層を切り過ぎて、相対パスがあわなくなって、テンプレートファイルが読み込めないために起きているのだが、何かいい方法はないのか。

問題が起きた構造は以下のような感じ。

views/
 + common/
 |  |
 |  +- base.tpl
 |  |
 |  +- footer.tpl
 |  |
 |  +- header.tpl
 |
 + welcome/
    |
    +- index.tpl
    |
    +- hoge/
        |
        +- fuga.tpl

こういった構造のときに以下のように読み込んでエラーがでました。

// views/common/base.tpl
{include="./header.tpl"}
...
{include="./footer.tpl"}

// views/welcome/index.tpl
{include="../common/base.tpl"}
-> ok

// views/welcome/my/fuga.tpl
{include="../../common/base.tpl"}
-> ng (SmartyException [ Error ]: Unable to read template file '../******.tpl)

これを解消するには file: を使います。

Read More

Movable Type: TinyMCE で MT タグを使用する

Movable Type の TinyMCE 内で MT タグを使いたい場合ありますよね。

以下の 2 点を追加・修正すれば使えるようになります。

1. MT タグを消さないように TinyMCE を拡張する

mt/mt-static/plugins/TinyMCE/lib/config.js を作成し、以下を記述します。

;(function($) {
    jQuery.extend(MT.Editor.TinyMCE.config, {
        verify_html: false,
        setup: function(ed) {
            ed.onBeforeSetContent.add(function(ed, o) {
                var i = 0;
                if (!window.tinyMCE._MTTags) {
                    window.tinyMCE._MTTags = [];
                }
                o.content = o.content.replace(/<mt:entries([^>]+)>([\s\S]*?)<\/mt:entries>/g, function(match) {
                    i++;
                    window.tinyMCE._MTTags[i] = match;
                    return '<div data-id="mt-tag-' + i + '" style="display:none;">\n※このタグはMTタグです。\n</div>';
                });
            });

            ed.onPostProcess.add(function(ed, o) {
                var i = 0;
                o.content = o.content.replace(/<div([^>]+)data\-id="mt\-tag\-[0-9]{1,}"([^>]*)>([\s\S]*?)<\/div>/g, function(match) {
                    i++;
                    return window.tinyMCE._MTTags[i];
                });
            });
        }
    });
})(jQuery);

一先ず的な対応ですが、mt:entries 以外に使いたいタグがあれば、それを正規表現に追記すれば使えます。

mt:* 以外にも Facebook の fb:likefb:commentsfb:like-box、Google+ の g:plusone などにも対応できます。

Read More

Page 1 of 48
NEXT >>

Categories