11 29

先日、コメント欄にてスイスの方からいくつか質問を頂いた件で、説明するより作っちゃえ的な対処をしてみました。

相変わらず、mb関数を使っているので1バイト圏の環境だと動かない可能性はあるんですが、とりあえずテストバージョンということでアップしてみました。

今回の修正は大きくわけて2点。

1.複数フィードの対応
URLをカンマ(,)で分けて指定することで対応します。
但し、複数フィード指定するとヘッダ部分でフィード用の埋め込み関数が使えません(permalinkとかフィードタイトル用のtitle,フィード画像のimageなど)

2.日付変数に引数を追加して、個別に書式を指定できるようにしました。
[+date(%Y/%m/%D)+]などのように括弧内に日付の書式を指定できるようにしました。
書式の中身はstrftimeと同じです、なお、従来通りに[+date+]と指定した場合には、スニペットのパラメタで指定したdate formatが利用されます。

テスト版ということで、スニペットの部分だけとなります。
また、simplepieは1.1.xおよび1.2の両方とも動きました。(あまり細かいところはチェックしていませんが)

ということで、テスト版はこちらからダウンロードしてください。

投稿者 ZeRo

このエントリに定義されたタグ:

5 コメント

コメント表示形式(一覧 | スレッド)
  1. LuK says:

    Wow man, this is great, working like a charm!! Thank you very much!

    The date-thing is working great, now I can do:

    [+date(%H:%M)+] and [+date(%d.%m.%Y)+] in one template! Cool =)...


    and also the multiple feeds feature works great...used it like this:

    [[pieX? url=`http://www.bernerzeitung.ch/region/rss.html,http://www.bernerzeitung.ch/schweiz/rss.html,http://www.bernerzeitung.ch/ausland/rss.html` &tpl=`piex.scrollerTpl` &error=`piex.errorTpl` &max=10]]

    when I understood you right...the native embed thing doesn't work...luckily I'm not using it like this...I just need the enclosure-link (I use it as a flashvar for an audio-player) so I changed $enclosure->native_embed($this->template_data["embed"]); to $enclosure->get_link(); ... that does exactly what I want it to do =)...just get the audio-link

    I have also seen that there is one line less in the config part of the snippet:

    now its:

    $url = str_replace("|xq|", "?", $url);
    $url = str_replace("|xe|", "=", $url);

    in 0.8 it was

    $url = str_replace("|xq|", "?", $url);
    $url = str_replace("|xe|", "=", $url);
    $url = str_replace("|xa|", "&", $url);

    is there a reason for that?

    Great work m8, keep it up!!

    regards,

    LuK

  2. ZeRo says:

    Hello,Luk san.

    > when I understood you right...the native embed thing doesn't work...luckily I'm not using it like this...I just need the enclosure-link (I use it as a flashvar for an audio-player) so I changed

    What was any problem?
    What do you write a sample embedded call seq. or sample source code?

    >I have also seen that there is one line less in the config part of the snippet:
    > :
    > is there a reason for that?

    This is my mistake.
    I have to do it later and upload again, please fix it manually first.

    Thank you,

  3. LuK says:

    Wasn't really a problem because I don't use the native embed method of simplepie...I just read in your Post "However, the embedding function is not available for the specified feed", so I thought it wouldn't work...but I didn't try because I had to make the change I mentioned above also in the previous versions of pieX...the other thing I changed already =)...works still great!

  4. Hayawo says:

    初めまして。
    pieX0.9をつかわさせていただいております。有難う御座います!
    当方でTwitterSearchAPIと連携させようとしたところ、2点ほどバグらしいのが見つかったので直してみました。
    ・・・と思ったら、1点上記で既に直されてますね(苦笑
    あと一点ですが、URLミスや取得先のダウン時に発生するエラー処理で、配列ではないのにimplodeしてたので、以下のように直してみました。

    line:about 332

    $feedURLstr = implode(",",$feedURL);

    to:

    if (is_array($feedURL)) {
    $feedURLstr = implode(",",$feedURL);
    } else {
    $feedURLstr = $feedURL;
    }

    #当方のサイトでも誘導しておきますー。

    これからも何卒よろしくお願いいたします!

  5. ZeRo says:

    あ,ありがとうございます。
    いずれはマージしてアップし直します(^^;


    いつになるかが微妙ですが(´-`)


    ありがとうございました

コメントの追加


BB コード 書式を許可します。
標準的な感情表現、 :-) や ;-) といったものは画像に変換します。
スマイル
電子メールアドレスは表示せず、電子メールの通知にのみ使用します。

ロボットからの自動的なコメントスパムを防ぐために、画像の下の入力ボックスに適切な文字列を入力してください。文字列が一致する場合のみ、コメントが送信されるでしょう。ブラウザーが Cookie をサポートし、受け入れることを確認してください。さもなければ、コメントを正確に確認することができません。
CAPTCHA