【问题标题】:Laravel 4 email template stylingLaravel 4 电子邮件模板样式
【发布时间】:2013-12-11 02:16:11
【问题描述】:

我正在尝试使用引导程序为我的电子邮件模板赋予一种样式,但每次 laravel 正在做的事情时,它都会解析模板并在有 ' 的地方添加一个 '3D' >=' 在模板中,导致style=3D"table"而不是style="table",这里是邮件源代码的sn-p

<div class=3D"well">
   <table class=3D"table table-bordered table-striped" id=3D'table'>
      <thead>
         <th>Group Name</th>
         <th>Kpi Name</th>
         <th>User Name</th>
      </thead>
      <tbody>
      </tbody>
   </table>
</div>

这是我的模板代码

<html lang="en-US">
    <head>
        <meta charset="utf-8">
        {{ HTML::style('app\\client\\css\\bootstrap.css') }}
        {{ HTML::script('app\\javascripts\\js\\jquery-1.8.3.min.js') }}
        {{ HTML::script('app\\client\\js\\bootstrap.min.js') }}
        <style>
            #table {
                border: 2px solid #ccc;
                border-radius: 5px;
            }
        </style>

    </head>
    <body>
        <div class="well">
            <table class="table table-bordered table-striped" id='table'>
                <thead>
                <th>Group Name</th>
                <th>Kpi Name</th>
                <th>User Name</th>
                </thead>
                <tbody>
                    @foreach ($groups as $group)
                    <tr>
                        <td>{{ $group['name'] }}</td>
                        <td>
                            <ul>
                                @if (array_key_exists('kpis', $group))    
                                @foreach ($group['kpis'] as $kpi)                            
                                <li>{{ Kpi::find($kpi['kpi'])->title }}</li>
                                @endforeach
                                @endif
                            </ul>
                        </td>
                        <td>
                            <ul>
                                @if (array_key_exists('users', $group))
                                @foreach ($group['users'] as $user)
                                <li>{{ User::find($user['user'])->fName.' '.User::find($user['user'])->lName }}</li>
                                @endforeach
                                @endif
                            </ul>
                        </td>
                    </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
        <footer>
            <br>
            <br>
            Regards,<br>
            <strong>Yogesh Joshi</strong><br>
            Group Leader
        </footer>
    </body>
</html>

是否有我遗漏的东西或 laravel 或邮件服务器gmail 或 hotmail)有问题,是的,我已经交叉检查了脚本和样式文件,它们确实存在于公共文件夹中。

请帮助或提供任何替代方法。

【问题讨论】:

    标签: css email laravel-4 blade email-templates


    【解决方案1】:

    对于 =3D 项目,请参阅此帖子:What's a 3D doing in this HTML?

    我发现您正试图在您的电子邮件中加载 javascript,这不是一个好主意。见:Is JavaScript supported in an email message?

    我不确定将样式表加载到 html 电子邮件中,所以我将保持打开状态。

    【讨论】:

      【解决方案2】:

      在电子邮件中使用 Bootstrap 听起来有点矫枉过正,但有一个名为 Bootstrap Template for HTML Email 的旧项目。不确定这是否有帮助。

      此外,这个问题似乎与 SO 问题“Has anyone gotten HTML emails working with Twitter Bootstrap?”部分主题相同

      只需从实际项目中复制迷你样式表,HTML Email Boilerplate 可能更易于使用。

      或者,如果您很懒惰,请使用 Mailchimp 所见即所得 - 编辑器并将其从 MC 中导出。他们有非常好的所见即所得编辑器和响应式模板。我一直在使用它,它节省了一些时间和精力。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-09-21
        • 1970-01-01
        • 2012-12-18
        • 2016-02-25
        • 2015-11-11
        • 2017-08-17
        • 2021-08-31
        • 1970-01-01
        相关资源
        最近更新 更多