getPostLinkUrlのopiton $base に変化がありません

目的はブログ記事のSNSシェアのためにフルパスのURL(http://〜から始まるURL)を取得しようとしました。

getPostLinkUrl に何かオプションがないかと思い、BlogHelper.phpを調べると $base の指定がありました。
/lib/Baser/Plugin/Blog/View/Helper/BlogHelper.php : 276

/**
 * ブログ記事のURLを取得する
 *
 * @param array $post ブログ記事データ
 * @param bool $base ベースとなるURLを付与するかどうか
 * @return string ブログ記事のURL
 */
	public function getPostLinkUrl($post, $base = true) {
		$this->setContent($post['BlogPost']['blog_content_id']);
		if(empty($this->content['url'])) {
			return false;
		}
		$site = BcSite::findByUrl($this->content['url']);
		$contentUrl = $this->BcBaser->getContentsUrl($this->content['url'], !$this->isSameSiteBlogContent($post['BlogPost']['blog_content_id']), !empty($site->useSubDomain), false);
		$url = $contentUrl . 'archives/' . $post['BlogPost']['no'];
		if($base) {
			return $this->url($url);
		}  else {
			return $url;
		}
	}

実際に試してみると、上手く動いていないようでした。
$this->BcBaser->url() を使ってようやく欲しい出力が得られました

<?php
echo $this->Blog->getPostLinkUrl($post, false);
echo $this->Blog->getPostLinkUrl($post, true);
echo $this->BcBaser->url($this->Blog->getPostLinkUrl($post));
echo $this->BcBaser->url($this->Blog->getPostLinkUrl($post), true);
?>
↓
//出力結果

/news/archives/78
/news/archives/78
/news/archives/78
http://localhost/news/archives/78

質問ですが、getPostLinkUrl($post, $base) の $baseオプションは何の意味があるんでしょうか?
他に記事や固定ページのURLを httpから始まるフルパスのURLを取得する方法はありますか?

  • データベース: MySQL
  • baserCMSバージョン: 4.2.5
  • CakePHPバージョン: 2.10.16
  • サーバー: 全て
  • PHP習熟度:テーマを書ける程度

こんにちは
私の環境だと違いが発生したので、サブフォルダにbaserをインストールしている場合にメリットがありそうです。

フルパスのURLでしたら、やはり私も <?php echo $this->BcBaser->url('/service', true) ?> を使いますね。

なるほど、サブフォルダをインストールしてる場合ですね!(納得)

フルパスのURLでしたら、やはり私も <?php echo $this->BcBaser->url('/service', true) ?> を使いますね。

やはり皆さんそうですか…もう少し簡単にフルパスURLが取得できるといいのですが。。。

Wordpressだと get_page_link( $id )、get_permalink( $id )みたいな関数が出ること願ってます