Antlers form within Blade template #6534
-
I know there are a couple places in the docs where it talks about using Antlers in Blade, but I've tried a couple variations on this and can't quite get it working. I'm sure I'm doing something wrong, but I'm unsure exactly what. Basically I'm trying to put a user login form, and I know that the antlers for this is fairly simple (copied directly from the docs): {{ user:login_form }}
{{ if errors }}
<div class="bg-red-300 text-white p-2">
{{ errors }}
{{ value }}<br>
{{ /errors }}
</div>
{{ /if }}
{{ if success }}
<div class="bg-green-300 text-white p-2">
{{ success }}<br>
</div>
{{ /if }}
<label>Email</label>
<input type="email" name="email" value="{{ old:email }}" />
<label>Password</label>
<input type="password" name="password" value="{{ old:password }}" />
<button type="submit">Log in</button>
{{ /user:login_form }} However the Blade syntax for Antlers doesn't seem to mesh well with this, and every variation I've attempted has resulted in a 500 Server Error. I know it'll have some variation of I tried @php (Statamic::tag('user:loginForm')) and @foreach (Statamic::tag('user:loginForm')) and even @php (Statamic::tag('user:loginForm')->fetch()) but no luck yet. What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Try again... if you check out this PR, you'll see a code example of how it works: Did you try |
Beta Was this translation helpful? Give feedback.
-
You can also mix the two, if you're not opposed to that. In your Blade view, include an Antlers partial. @include('form') // form.antlers.html
{{ user:login_form }} ... {{ /user:login_form }} |
Beta Was this translation helpful? Give feedback.
You can also mix the two, if you're not opposed to that.
In your Blade view, include an Antlers partial.