跳到主要內容

修復tadgallery相片捲軸區塊開啟燈箱效果點選詳細內容sn為空值問題-教學撰寫:徐嘉裕Neil hsu

tadgallery是一套多功能的相簿模組,為tad老師所開發,也是目前Xoops使用率最高的相簿模組,不過目前發現一個問題,就是開啟相片捲軸區塊啟用燈箱效果時下方的詳細內容按鈕連結失效問題,為了先確認是否為系統環境造成的,我吧以下套件都改成tad的來做測試。



模組:
tadtools => 3.19最新版
tad_themes => 4.9最新版
tadgallery => 3.79最新版

佈景: => school2015最新版

都更換好配置後在測試燈箱效果,結果詳細內容還是一樣sn為空值


點了詳細內容因為sn沒值所以開啟的是空值頁面,沒內容的,初步排除是系統兼容問題。




沒辦法了阿,這樣是無法跟客戶交差的,只好動手來處理了,發現問題是出在blocks/colorbox.tpl這支檔的<{$block.sn}>為空值,相片捲軸既然是跑回圈的,那sn因該也是迴圈產生,所以修改了一下程式即可,

先找到tadgallery_block_carousel.tpl樣板檔,用筆記本打開
(在tadgallery/templates/blocks/tadgallery_block_carousel.tpl)


原本的code


<{if $block.pics}>

<style type="text/css" media="all">

.list_carousel {

position: relative;

}

.list_carousel ul {

margin: 0;

padding: 0;

list-style: none;

display: block;

}

.list_carousel li {

padding: 0;

margin: 0px;

display: block;

float: left;

}

.list_carousel.responsive {

width: auto;

margin-left: 0;

}

.clearfix {

float: none;

clear: both;

}

a.tadgallery_carousel_prev, a.tadgallery_carousel_next {

background: url('<{$xoops_url}>/modules/tadgallery/images/miscellaneous_sprite.png') no-repeat transparent;

width: 45px;

height: 50px;

display: block;

position: absolute;

top: 45px;

}

a.tadgallery_carousel_prev { left: -22px;

background-position: 0 0; }

a.tadgallery_carousel_prev:hover { background-position: 0 -50px; }

a.tadgallery_carousel_prev.disabled { background-position: 0 -100px !important; }

a.tadgallery_carousel_next { right: -22px;

background-position: -50px 0; }

a.tadgallery_carousel_next:hover { background-position: -50px -50px; }

a.tadgallery_carousel_next.disabled { background-position: -50px -100px !important; }

a.tadgallery_carousel_prev.disabled, a.tadgallery_carousel_next.disabled {

cursor: default;

}




a.tadgallery_carousel_prev span, a.tadgallery_carousel_next span {

display: none;

}

</style>

<script type="text/javascript">

$(function() {

$('#carousel<{$block.view_csn}>').carouFredSel({

<{$block.vertical}>

width: '100%',

height: <{$block.vertical_height}>,

<{$block.scroll}>

prev : {

button : "#foo2_tadgallery_carousel_prev<{$block.view_csn}>",

key : "left"

},

next : {

button : "#foo2_tadgallery_carousel_next<{$block.view_csn}>",

key : "right"

},

<{if $block.staytime}>

auto: <{$block.staytime}>,

<{/if}>

mouseWheel: true

});

});




</script>

<div class="list_carousel">

<ul id="carousel<{$block.view_csn}>">

<{foreach from=$block.pics item=p}>

<li>

<a href="<{$p.link}>" data-photo="<{$p.pic_url}>" <{$p.fancy_class}>>

<img src="<{$p.pic_url}>" alt="<{$p.photo_title}>" title="<{$p.photo_title}>" style="<{if $p.direction=="1"}>width:<{$p.width}>px;<{else}>height:<{$p.height}>px;<{/if}>margin:0px 2px;"></a>

</li>

<{/foreach}>

</ul>

<div class="clearfix"></div>

<a class="tadgallery_carousel_prev" id="foo2_tadgallery_carousel_prev<{$block.view_csn}>" href="#"><span>prev</span></a>

<a class="tadgallery_carousel_next" id="foo2_tadgallery_carousel_next<{$block.view_csn}>" href="#"><span>next</span></a>

</div>

<{includeq file="$xoops_rootpath/modules/tadgallery/templates/blocks/colorbox.tpl"}>

<{/if}>

替換為以下的code(複製貼上即可)

<{if $block.pics}>
<style type="text/css" media="all">
.list_carousel {
position: relative;
}
.list_carousel ul {
margin: 0;
padding: 0;
list-style: none;
display: block;
}
.list_carousel li {
padding: 0;
margin: 0px;
display: block;
float: left;
}
.list_carousel.responsive {
width: auto;
margin-left: 0;
}
.clearfix {
float: none;
clear: both;
}
a.tadgallery_carousel_prev, a.tadgallery_carousel_next {
background: url('<{$xoops_url}>/modules/tadgallery/images/miscellaneous_sprite.png') no-repeat transparent;
width: 45px;
height: 50px;
display: block;
position: absolute;
top: 45px;
}
a.tadgallery_carousel_prev { left: -22px;
background-position: 0 0; }
a.tadgallery_carousel_prev:hover { background-position: 0 -50px; }
a.tadgallery_carousel_prev.disabled { background-position: 0 -100px !important; }
a.tadgallery_carousel_next { right: -22px;
background-position: -50px 0; }
a.tadgallery_carousel_next:hover { background-position: -50px -50px; }
a.tadgallery_carousel_next.disabled { background-position: -50px -100px !important; }
a.tadgallery_carousel_prev.disabled, a.tadgallery_carousel_next.disabled {
cursor: default;
}


a.tadgallery_carousel_prev span, a.tadgallery_carousel_next span {
display: none;
}
</style>
<script type="text/javascript">
$(function() {
$('#carousel<{$block.view_csn}>').carouFredSel({
<{$block.vertical}>
width: '100%',
height: <{$block.vertical_height}>,
<{$block.scroll}>
prev : {
button : "#foo2_tadgallery_carousel_prev<{$block.view_csn}>",
key : "left"
},
next : {
button : "#foo2_tadgallery_carousel_next<{$block.view_csn}>",
key : "right"
},
<{if $block.staytime}>
auto: <{$block.staytime}>,
<{/if}>
mouseWheel: true
});
});


</script>
<div class="list_carousel">
<ul id="carousel<{$block.view_csn}>">
<{foreach from=$block.pics item=p}>
<li>
<a href="<{$p.link}>" data-photo="<{$p.pic_url}>" class="tad_gallery_colorbox_<{$p.photo_sn}>">
<img src="<{$p.pic_url}>" alt="<{$p.photo_title}>" title="<{$p.photo_title}>" style="<{if $p.direction=="1"}>width:<{$p.width}>px;<{else}>height:<{$p.height}>px;<{/if}>margin:0px 2px;"></a>
</li>


<{/foreach}>
</ul>
<div class="clearfix"></div>
<a class="tadgallery_carousel_prev" id="foo2_tadgallery_carousel_prev<{$block.view_csn}>" href="#"><span>prev</span></a>
<a class="tadgallery_carousel_next" id="foo2_tadgallery_carousel_next<{$block.view_csn}>" href="#"><span>next</span></a>
</div>


<{/if}>
<{foreach from=$block.pics item=p}>


<script>
$(function(){
$('.tad_gallery_colorbox_<{$p.photo_sn}>').colorbox({rel:'group', photo:true, maxWidth:'100%', maxHeight:'100%', title: function(){
// var sn = $(this).attr('title');
return '<a href="<{$xoops_url}>/modules/tadgallery/view.php?sn=<{$p.photo_sn}>#photo<{$p.photo_sn}>" target="_blank"><{$smarty.const._MB_TADGAL_VIEW_PHOTO}></a>';
}});
});
</script>
<{/foreach}>
在測試看看,點選燈箱效果,看看sn是否有值


確認紅框的sn是有數值的,然後點看看進到內容頁是否正確顯示圖片!




確認每張圖片都能進到對應的內容頁面中,圖片也能正常顯示,燈箱也能正常運作,搞定可以跟客戶交差了,真感動,有需要的朋友參考看看喔


教學撰寫:徐嘉裕 Neil hsu

留言

這個網誌中的熱門文章

好用的windows備份檔案dos指令XCOPY-教學撰寫:徐嘉裕Neil hsu

要快速的備份某個硬碟全部資料到備份硬碟中,雖然是可以用windows內建的備份與還原,但如果重灌windows可會有key不同而無法還原的問題,還要改一堆設定煩死了,直接用dos指令XCOPY來做檔案的複製就很快了,資料也不會丟失,好朋友可以參考看看!! 首先開啟windows所有程式->附屬應用程式->開啟命令提示字元! 然後輸入以下指令 XCOPY C:\xxx   F:\xxx /s 藍字的 C:\xxx  為複製檔案來源位置例如要複製整個C槽就輸入 C:\ 綠色的   F:\xxx 為複製目的位置,例如要放到F槽的備份資料夾,就輸入  F:\ 備份 紅字的 S 為複製類型參數,可以自行修改為以下的參數設定: ================================================================= /A    只複製設定成保存屬性的檔案,不要改變屬性的設定。 /M    只複製設定成保存屬性的檔案,並清除保存屬性。 /D:m-d-y  複製指定日期當天或之後變更的檔案。如果沒給日期,只複製那些來源檔案日期比目的檔案日期為新的檔案。 /EXCLUDE:file1[+file2][+file3]...         指定檔案清單字串。每個字串應在不同行。如果有字串對應到要進行複製的檔案絕         對路徑的任何部分,這個檔案會被排除複製。例如,指定字串         \obj\ 或 .obj 的話,會排除所有在 obj 目錄下副檔名是.obj 的檔案複製。 /P    在建立每個目的檔案時顯示提示。 /S    複製每個目錄及其包含的子目錄,不複製空目錄。 /E    複製每個目錄及其包含的子目錄,也複製空目錄。/S 與 /E相同,能夠用來修改 /T。 /V    驗證每個新檔案。 /W    在複製之前提示您按鍵繼續。 /C    如果錯誤發生時也繼續複製。 /I    如果目的不存在且複製一個以上的檔案的話,就假設指定的目的一定是目錄。 /Q    在複製時不要顯示檔名。 /F    在複製時顯示來源及

jQuery取得下拉選單selected中數值與內容的方法

假設選單狀態為: <select id='selectname '> <option value='v1' data-id="d1">選單A</option> <option value='v2' data-id="d2">選單B</option> <option value='v3' data-id="d3">選單C</option> </select> 以jQuery取得選單數值與內容方法如下: 1、取得下拉選單 value 數值的方法 $selectname=$('#selectname').val(); alert($selectname); //顯示選單中 selected 狀態的value數值v1 or  v2  or  v3。 2、取得下拉選單中 data-id 數值的方法 $data-id= $(this).find(':selected').attr('data-id'); alert($data-id); //顯示選單中 selected 狀態的data-id數值d1 or  d2 or  d3。 3、取得下拉選單中 文字 的方法 $selecttext=$(this).find(':selected').text(); alert($selecttext); //顯示選單中 selected 狀態的文字內容,如選單A or  選單B or 選單C。 教學撰寫:徐嘉裕 Neil hsu

CentOS7啟用ssh的設定方法-教學撰寫:徐嘉裕Neil hsu

安裝好CentOS7後可以在圖形化介面中點選右鍵->開啟服務器修改設定後啟用SSH設定,方法如下: 1、先安裝openssh套件 sudo yum install openssh* 2、用 gedit 開啟sshd_config編輯 (不要用vi很難編輯的) sudo gedit /etc/ssh/sshd_config 3、增加可連線SSH帳號 AllowUsers admin (此欄位需要自行新增) 4、修改PORT吧 # 註解拿掉 (可以改成8022PORT或其他PORT都可以) Port 22 搜尋PermitRootLogin吧 # 註解拿掉 PermitRootLogin no 再來把這兩行的 # 註解拿掉 PermitEmptyPasswords no PasswordAuthentication yes 搜尋Protocol設定使用SSHv2連線 Protocol 2 sudo systemctl restart sshd.service    重新啟動service sudo systemctl enable sshd.service    設定開機啟動SSH sudo semanage port -a -t ssh_port_t -p tcp 22      防火牆允許22 PORT 或 sudo firewall-cmd --permanent --zone=public --add-port=22/tcp 重新載入防火牆設定 sudo firewall-cmd --reload sudo  netstat -ant | grep :22 查看 22PORT 查詢現在SELinux設定清單中的SSH服務有哪些Port sudo semanage port -l | grep ssh ssh_port_t tcp 8022, 22 怎麼測試? 格式:登入帳號@IP或主機名稱 指令:-p SSH服務Port號 sudo ssh -p 22 admin@192.168.1.100 如設定的Port在清單中 ,那就表示SSH設定完成防火牆也開啟列外了,之後再用遠端的PuTTY輸入 IP/Port 連線,然後輸入 帳號/密碼,就能用SSH連線進入主機了, 在透