Joomler!.net - Decided on Joomla!

デル株式会社

Jboard is Multiple Board!

Home » Blog » Joomla!1.5 with greybox : Hack
Jan
26
2008

Joomla!1.5 with greybox : Hack

EMailPrintPDF
0 votes
Written by:Joomler! 4094 hits

少し改造してみた。

http://demo.joomler.net/

各記事上のPDFアイコンとE-Mailアイコンをクリックしてみてください。

GreyBoxを使って表示するようにしてみました。

変更は以下

Root/libraries/joomla/html/html.php

Line:110

return '<a href="'.$url.'" '.$attribs.'>'.$text.'</a>';

$base = substr(JURI::base(), 0, strlen(JURI::base()) - 1);
  $regex = '/<img[^>]*alt="pdf"[^>]*\/>/i';
  if(preg_match($regex, $text)){
   $attribs = ' rel="gb_page_fs[]"';
   $url = $base. $url;
  }
  $regex = '/<img[^>]*alt="E-mail"[^>]*\/>/i';
  if(preg_match($regex, $text)){
   $attribs = $attribs. ' rel="gb_page_center[480, 320]"';
   $url = $base. $url;
  }
  return '<a href="'.$url.'" '.$attribs.'>'.$text.'</a>';

へ変更した。

これだけでは、常時GreyBoxのJavascriptは読み込まれない(プラグインには関係ない)のでテンプレートのheadセクションに以下を追加

<script type="text/javascript">var GB_ROOT_DIR = "<?brush:php; echo $this->baseurl ?>/plugins/content/greybox/"</script>
<script type="text/javascript" src="/<?brush:php; echo $this->baseurl ?>/plugins/content/greybox/AJS.js"></script>
<script type="text/javascript" src="/<?brush:php; echo $this->baseurl ?>/plugins/content/greybox/AJS_fx.js"></script>
<script type="text/javascript" src="/<?brush:php; echo $this->baseurl ?>/plugins/content/greybox/gb_scripts.js"></script>
<link href="/<?brush:php; echo $this->baseurl ?>/plugins/content/greybox/gb_styles.css" rel="stylesheet" type="text/css" />

これは、デフォルトのrhuk_milkywayテンプレートの場合です。

これによって常時GreyBoxのJavascriptがロードされるのでGreyBoxプラグインをインストールしている場合は、Output GreyBox.jsをNoに変更してください。

output_no_greybox

参考にGreyBoxを使ってみましたが、同様にLightBox、ThickBox、LightWindowなど他の画像表示のJavascriptにも応用できるでしょう。

HTMLが表示できるJavascriptライブラリでないと無理でしたね。

 

ADD A COMMENT

Subject*
:
Color Swatch




Email Link Page Code Text Align Center Text Align Justify Text Align Left Text Align Right Text Bold Text Quote Text Italic Text List Bullets Text List Numbers Text Strikethrough Text Underline World Link
Sun Unhappy Smile Evilgrin Wink Tongue Lightning Surprised Grin Rain Clouds Cloudy Snow Waii
Name*
:
EMail*
:
Website
:

JContentPlus for Joomla!1.5 powered by Joomler!.net

Related Items

joomler.net is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla!(R) name is used under a limited license from Open Source Matters in the United States and other countries.
joomler.net is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.