使行可点击以将您带到 link
Making a row clickable to take you to a link
我已经对其进行了一些 CSS 修改,现在我需要进行一项编程修改。我是一个 C# 人,所以这个 PHP 给我一个小曲线球。
这里是我要修改的部分:
<li class="row">
<!-- EVENT forumlist_body_forum_row_prepend -->
<dl class="icon {forumrow.FORUM_IMG_STYLE}">
<dt title="{forumrow.FORUM_FOLDER_IMG_ALT}">
<!-- IF forumrow.FORUM_IMAGE --><div class="forum-image">{forumrow.FORUM_IMAGE}</div><!-- ENDIF -->
<a href="{forumrow.U_VIEWFORUM}" class="icon-link"></a>
<!-- IF .forumrow.subforum and forumrow.S_LIST_SUBFORUMS -->
<div class="dropdown-container dropdown-button-control">
<span title="{forumrow.L_SUBFORUM_STR}" class="dropdown-trigger"></span>
<div class="dropdown hidden">
<div class="dropdown-contents">
<!-- EVENT forumlist_body_subforums_before -->
<strong>{forumrow.L_SUBFORUM_STR}{L_COLON}</strong>
<!-- BEGIN subforum -->
<a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{forumrow.subforum.SUBFORUM_NAME}</a>
<!-- END subforum -->
<!-- EVENT forumlist_body_subforums_after -->
</div>
</div>
</div>
<!-- ENDIF -->
<div class="list-inner">
<a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a>
<span class="forum-description">{forumrow.FORUM_DESC}</span>
<!-- IF forumrow.MODERATORS -->
<!--<br /><span class="forum-moderators"><strong>{forumrow.L_MODERATOR_STR}{L_COLON}</strong> {forumrow.MODERATORS}</span>-->
<!-- ENDIF -->
</div>
</dt>
<!-- IF forumrow.CLICKS -->
<dd class="redirect"><span>{L_REDIRECTS}{L_COLON} {forumrow.CLICKS}</span></dd>
<!-- ELSEIF not forumrow.S_IS_LINK -->
<dd class="forum-stats<!-- IF forumrow.S_UNREAD_FORUM --> unread<!-- ENDIF -->"><span>
<!-- IF forumrow.LAST_POST_TIME -->(<dfn>{L_TOPICS}{L_COLON}</dfn> {forumrow.TOPICS} | <dfn>{L_POSTS}{L_COLON}</dfn>{forumrow.POSTS})
<!-- IF not S_IS_BOT --><a href="{forumrow.U_LAST_POST}" title="<!-- IF forumrow.S_UNREAD_FORUM -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{LAST_POST_IMG}</a><!-- ENDIF --><!-- ELSE -->{L_NO_POSTS}<!-- ENDIF -->
<!-- EVENT forumlist_body_last_post_title_prepend -->
</span></dd>
<dd class="mcp-status"><span>
<!-- IF forumrow.U_UNAPPROVED_TOPICS -->
<a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a>
<!-- ELSEIF forumrow.U_UNAPPROVED_POSTS -->
<a href="{forumrow.U_UNAPPROVED_POSTS}">{UNAPPROVED_POST_IMG}</a>
<!-- ENDIF -->
</span>
</dd>
<!-- ENDIF -->
</dl>
<!-- EVENT forumlist_body_forum_row_append -->
</li>
我希望点击 "row"
可以将您带到论坛。现在只有点击 title/header 才会将您带到论坛。
我认为是这一行:
<a href="{forumrow.U_VIEWFORUM}" class="icon-link"></a>
这是默认模板如何工作的演示:
https://www.phpbb.com/customise/db/style/pbtech/demo/3.1
我从演示中获得的唯一不同是那些 forum "blocks"
现在更改为占据 100% width
而不是 33.3%
。我想要它,所以如果你点击论坛上的任何地方 "block/row" 它会带你到论坛。
这无法通过 PHP 实现。它可以通过前端的 JavaScript 小片段来实现。
<script type="text/javascript">
$(document).ready( function(){
$("li.row").click( function(){
var anchor = $(this).find("a:first");
anchor.trigger("click"); // OR
window.location = anchor.attr("href");
});
});
</script>
这样做是将事件处理程序附加到 li.row
上的任何点击。它在其中找到 link 并触发点击它,或使用其 href
属性 更改浏览器 window 位置 URL.
这需要一个名为 jQuery 的 JavaScript 库,该库似乎已在您的演示模板中使用。上面的代码块需要包含在 jQuery.
的 <script>
包含标记下方
我已经对其进行了一些 CSS 修改,现在我需要进行一项编程修改。我是一个 C# 人,所以这个 PHP 给我一个小曲线球。
这里是我要修改的部分:
<li class="row">
<!-- EVENT forumlist_body_forum_row_prepend -->
<dl class="icon {forumrow.FORUM_IMG_STYLE}">
<dt title="{forumrow.FORUM_FOLDER_IMG_ALT}">
<!-- IF forumrow.FORUM_IMAGE --><div class="forum-image">{forumrow.FORUM_IMAGE}</div><!-- ENDIF -->
<a href="{forumrow.U_VIEWFORUM}" class="icon-link"></a>
<!-- IF .forumrow.subforum and forumrow.S_LIST_SUBFORUMS -->
<div class="dropdown-container dropdown-button-control">
<span title="{forumrow.L_SUBFORUM_STR}" class="dropdown-trigger"></span>
<div class="dropdown hidden">
<div class="dropdown-contents">
<!-- EVENT forumlist_body_subforums_before -->
<strong>{forumrow.L_SUBFORUM_STR}{L_COLON}</strong>
<!-- BEGIN subforum -->
<a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{forumrow.subforum.SUBFORUM_NAME}</a>
<!-- END subforum -->
<!-- EVENT forumlist_body_subforums_after -->
</div>
</div>
</div>
<!-- ENDIF -->
<div class="list-inner">
<a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a>
<span class="forum-description">{forumrow.FORUM_DESC}</span>
<!-- IF forumrow.MODERATORS -->
<!--<br /><span class="forum-moderators"><strong>{forumrow.L_MODERATOR_STR}{L_COLON}</strong> {forumrow.MODERATORS}</span>-->
<!-- ENDIF -->
</div>
</dt>
<!-- IF forumrow.CLICKS -->
<dd class="redirect"><span>{L_REDIRECTS}{L_COLON} {forumrow.CLICKS}</span></dd>
<!-- ELSEIF not forumrow.S_IS_LINK -->
<dd class="forum-stats<!-- IF forumrow.S_UNREAD_FORUM --> unread<!-- ENDIF -->"><span>
<!-- IF forumrow.LAST_POST_TIME -->(<dfn>{L_TOPICS}{L_COLON}</dfn> {forumrow.TOPICS} | <dfn>{L_POSTS}{L_COLON}</dfn>{forumrow.POSTS})
<!-- IF not S_IS_BOT --><a href="{forumrow.U_LAST_POST}" title="<!-- IF forumrow.S_UNREAD_FORUM -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{LAST_POST_IMG}</a><!-- ENDIF --><!-- ELSE -->{L_NO_POSTS}<!-- ENDIF -->
<!-- EVENT forumlist_body_last_post_title_prepend -->
</span></dd>
<dd class="mcp-status"><span>
<!-- IF forumrow.U_UNAPPROVED_TOPICS -->
<a href="{forumrow.U_UNAPPROVED_TOPICS}">{UNAPPROVED_IMG}</a>
<!-- ELSEIF forumrow.U_UNAPPROVED_POSTS -->
<a href="{forumrow.U_UNAPPROVED_POSTS}">{UNAPPROVED_POST_IMG}</a>
<!-- ENDIF -->
</span>
</dd>
<!-- ENDIF -->
</dl>
<!-- EVENT forumlist_body_forum_row_append -->
</li>
我希望点击 "row"
可以将您带到论坛。现在只有点击 title/header 才会将您带到论坛。
我认为是这一行:
<a href="{forumrow.U_VIEWFORUM}" class="icon-link"></a>
这是默认模板如何工作的演示:
https://www.phpbb.com/customise/db/style/pbtech/demo/3.1
我从演示中获得的唯一不同是那些 forum "blocks"
现在更改为占据 100% width
而不是 33.3%
。我想要它,所以如果你点击论坛上的任何地方 "block/row" 它会带你到论坛。
这无法通过 PHP 实现。它可以通过前端的 JavaScript 小片段来实现。
<script type="text/javascript">
$(document).ready( function(){
$("li.row").click( function(){
var anchor = $(this).find("a:first");
anchor.trigger("click"); // OR
window.location = anchor.attr("href");
});
});
</script>
这样做是将事件处理程序附加到 li.row
上的任何点击。它在其中找到 link 并触发点击它,或使用其 href
属性 更改浏览器 window 位置 URL.
这需要一个名为 jQuery 的 JavaScript 库,该库似乎已在您的演示模板中使用。上面的代码块需要包含在 jQuery.
的<script>
包含标记下方