简体   繁体   English

聪明的PHP锚链接不工作

[英]smarty php anchor link not working

Hi I was wondering if you could help me with an issue where with my smarty php code won't work. 您好,我想知道您是否可以解决我的Smarty php代码无法正常工作的问题。 The problem is the anchor tag containing all of the code in this section won't actually surround it when it is outputted to the web page. 问题在于,包含在本节中所有代码的锚标签在输出到网页时实际上并不会围绕它。

<a href="mylink"> //the link that does not actually work/surround the code below when outputed
    <div class="row" {if $smarty.section.pm_loop.last}style="border:none;"{/if}>
        <div class="f-right" style="padding-right: 35px">
            <a href='UserMessagesNew.php?pm_id={$pms[pm_loop].pm_id}'>{$Application659}</a><br/>
            <a href='UserMessagesView.php?pm_id={$pms[pm_loop].pm_id}&task=delete'>{$Application660}</a><br/>
            <input type='checkbox' name='message_{$pms[pm_loop].pm_id}' value='1' style="margin:0; height:15px; width:15px;"/>
        </div>
        <a class="f-left" href="UserMessagesView.php?pm_id={$pms[pm_loop].pm_id}"><img src="{$pms[pm_loop].pm_user->user_photo('./images/nophoto.gif')}" class='img' width="92px" alt="{$pms[pm_loop].pm_user->user_info.user_username} {$Application500}"></a>
        <a href="#" class="msg-info-c">
            <div class="msg-user-re"><b><a href="UserMessagesView.php?pm_id={$pms[pm_loop].pm_id}">{$pms[pm_loop].pm_user->user_info.user_username}</a></b></div>
            <a href="UserMessagesView.php?pm_id={$pms[pm_loop].pm_id}"><div class="msg-datet">{$datetime->cdate("`$setting.setting_timeformat` `$setting.setting_dateformat`", $datetime->timezone($pms[pm_loop].pm_date, $global_timezone))}</div></a>
            <a href="UserMessagesView.php?pm_id={$pms[pm_loop].pm_id}"><div class="user-msg-c">{$pms[pm_loop].pm_body|truncate:100|choptext:75:"<br>"}</div></a>
        </a>
    </div>
</a>

The output looks like this: 输出看起来像这样:

<a href="mylink"></a>
<div class="row">

     rest of content inside here

</div>

While you can place block elements in a in HTML5, you can not nest a elements. 虽然你可以把块元素a在HTML5中,你不能 嵌套 a元素。

You can only either use JavaScript to react on a click on the area outside of the inner links, or place a link behind the content using CSS positioning. 您只能使用JavaScript对内部链接外部区域上的单击做出反应,或者使用CSS定位将链接放置在内容后面

(But this is not good UX in general – the user does most likely not expect that certain parts of a piece of content are links to special targets, and clicking just slightly next to those links will take them someplace else …) (但这通常不是好的UX –用户很可能不希望内容的某些部分是指向特殊目标的链接,而在这些链接旁边稍稍单击将把它们带到其他地方……)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM