Comments (16)
Hello, no problem, we start at the beginning with Laravel.
I'll tackle the printing data in Blade now. The other issues will need to wait until I'm back in the office.
When you prefix something in Blade with @
it literally prints that string. This is useful when using JavaScript in views.
See: https://laravel.com/docs/8.x/blade#blade-and-javascript-frameworks
So instead of @{{ $someVar }}
you need to use {{ $someVar }}
- this tells Blade to parse the expression and print the variable.
See: https://laravel.com/docs/8.x/blade#displaying-data
from laravel-storyblok.
Thanks for the speedy reply Richard, particularly when out of the office!
Ah, using the @
symbol was one of the few things that I understood already, and I'd tried it without, but nothing was rendered.
To make sure it wasn't something dumb I'd done with the component structure, I tried using both {{ $story->slug }}
and {{ $story->name }}
given they're at the top level of the API response, but still no dice.
Anyway, I appreciate you're not around at the moment, so enjoy your non-office time :)
from laravel-storyblok.
When printing you content you’ve not drilled deep enough into the data yet. You need the following:
{{ $story->body[0]->title }}
Typically I’d do something like this:
@foreach($story->body as $block)
{{ $block->render() }}
@endforeach
The render()
method on each block will use a view matching the block’s component name and pass the data into it. This way you can make the pages very module. This is how a typical project looks for me, but you can of course still just loop over and print all the content within the one Blade file. See: https://ls.sirric.co.uk/docs/2.7/views#the-render-method (I just noticed my docs have too many @
which probably confused you! I’ll look at fixing them.)
Your problem with the page 404ing is trickier to work out. The catch-all route:
Route::get('/{slug?}', '\Riclep\Storyblok\Http\Controllers\StoryblokController@show')->where('slug', '(.*)');
should be the last one in your routes file. By default it should load any pages matching the slug / url in Storyblok:
So my URL should be ‘/news/4-holdings-in-company’. Check your configuration files to make sure your are allow draft content if it’s not published yet. You might need to clear the Laravel cache too: php artisan cache:clear
- it shouldn’t cache a 404 but worth a try. The package does cache the JSON responses from Storyblok to stop it hitting their API too much.
Hope this helps!
There is the Storyblok Discord too, where you can chat with dev: https://www.storyblok.com/trust-center/service-support
Edit:
If you’ve set up your OAUTH etc. for Storyblok (https://ls.sirric.co.uk/docs/2.7/installation#configuration) you can use the artisan ls:stub-views
command to get you started: https://ls.sirric.co.uk/docs/2.7/views
It tries to write your basic views for every component and render all the content for you!
from laravel-storyblok.
Hi Richard, thanks for the detailed response!
I suspected I needed to traverse the array, but wasn't able to get that working, or even $story->name
, which I thought should return the Story's name?
That stub-views command is very cool, pulled down my components nicely, thanks.
Even so, I'm not getting past the errors. After adding the stub views, and the foreach command on /resources/storyblok/pages/page.blade.php, I'm getting this:
ErrorException
foreach() argument must be of type array|object, null given (View: /path-to-project/Laravel/utrr-site/resources/views/storyblok/pages/page.blade.php)
Which is pretty odd, because using dd($story)
definitely makes it look like it should be hitting an array:
Given all that, I suspect I might have a little more fundamental going wrong with my setup rather than it being a laravel-storyblok issue.
from laravel-storyblok.
Hello,
In Storyblok’s JSON the content fields start right at the root level in content
property and the package allows direct access to them without always needing to go through content first, because of this the ‘page’ properties need to be placed elsewhere. The Page
is something I create, to access details from it you need to use the meta
method: https://ls.sirric.co.uk/docs/2.7/pages#page-meta
Can you tell me:
- Laravel version
- Storyblok package version
- PHP version
Can you also paste your full draft (API V1) JSON please. Then I can test it myself.
from laravel-storyblok.
Thanks Richard,
Understood about the page-meta, thank you.
Laravel version: 8.72.0
Storyblok package version (I'm assuming the reclep/laravel-storyblok version?): 2.7
PHP version: 8.0.12
Here's the JSON:
{
"story": {
"name": "Stocks and Beers: Ep 16",
"created_at": "2021-11-05T04:21:41.904Z",
"published_at": "2021-11-09T09:48:33.124Z",
"alternates": [
],
"id": 83116867,
"uuid": "8d3630ae-89cc-40f2-acb0-53ba76738724",
"content": {
"_uid": "a09c2cc3-137a-498c-884a-390c8ad650d4",
"image": "",
"intro": "Watch Episode 16 of Stocks & Beers with Rich now! Stocks of the Week include, Orocobre (ASX:ORE), De Grey Mining (ASX:DEG), Elevate Uranium (ASX:EL8)",
"title": "Stocks and Beers: Ep 16",
"author": {
"id": "c7120d8a-2e52-4714-a01b-3dbfbd45dda1",
"url": "",
"linktype": "story",
"fieldtype": "multilink",
"cached_url": "authors/richard-hemming"
},
"videoID": "pSnPpzXmJ8w",
"category": "market-news",
"component": "Post",
"long_text": {
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Welcome to Stocks and Beers with Rich, Today, we talk about mining, and how to look past the market hype to find real hidden gems. That’s right, we have some mining Small Caps that might just be the next ",
"type": "text"
},
{
"text": "Pilbara Minerals (ASX:PLS).",
"type": "text",
"marks": [
{
"type": "bold"
}
]
}
]
},
{
"type": "bullet_list",
"content": [
{
"type": "list_item",
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Forget the trillion dollar Telsa! Rich looks at why the mining sector is looking bullish, with issues such as high demand looking to increase, and companies rushing to fill the gaps, speculating which new commodity will spike next.",
"type": "text"
}
]
}
]
},
{
"type": "list_item",
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Lithium stocks are running hot! Find out what Radar thinks about ",
"type": "text"
},
{
"text": "Orocobre (ASX:ORE).",
"type": "text",
"marks": [
{
"type": "bold"
}
]
}
]
}
]
},
{
"type": "list_item",
"content": [
{
"type": "paragraph",
"content": [
{
"text": "He sips a beer while discussing some of UTRR’s Peter Chilton’s favourite emerging producers.",
"type": "text"
}
]
}
]
},
{
"type": "list_item",
"content": [
{
"type": "paragraph",
"content": [
{
"text": "The power of exploration! ",
"type": "text"
},
{
"text": "De Grey Mining (ASX:DEG)",
"type": "text",
"marks": [
{
"type": "bold"
}
]
},
{
"text": " could be the next ",
"type": "text"
},
{
"text": "Northern Star Resources (NST)",
"type": "text",
"marks": [
{
"type": "bold"
}
]
},
{
"text": " – a ten bagger for early Under the Radar Report subscribers. De Grey has turned Kangaroo pasture into gold with 9 million ounces worth in the Pilbara.",
"type": "text"
}
]
}
]
},
{
"type": "list_item",
"content": [
{
"type": "paragraph",
"content": [
{
"text": "Look forward to hearing about the explosive ",
"type": "text"
},
{
"text": "Elevate Uranium (ASX:EL8)",
"type": "text",
"marks": [
{
"type": "bold"
}
]
},
{
"text": " which has found a significant deposit of Uranium in Namibia.",
"type": "text"
}
]
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"text": "Stocks of the Week:",
"type": "text",
"marks": [
{
"type": "bold"
}
]
},
{
"type": "hard_break",
"marks": [
{
"type": "bold"
}
]
},
{
"text": "- Orocobre (ASX:ORE)",
"type": "text",
"marks": [
{
"type": "bold"
}
]
},
{
"type": "hard_break",
"marks": [
{
"type": "bold"
}
]
},
{
"text": "- De Grey Mining (ASX:DEG)",
"type": "text",
"marks": [
{
"type": "bold"
}
]
},
{
"type": "hard_break",
"marks": [
{
"type": "bold"
}
]
},
{
"text": "- Elevate Uranium (ASX:EL8)",
"type": "text",
"marks": [
{
"type": "bold"
}
]
}
]
},
{
"type": "paragraph",
"content": [
{
"text": "This week’s beer is straight from Northern NSW: New England Brewing Co.’s “Hop Cannon IPA”. Watch the video to see what Rich thinks. If you have any beer or stock recommendations, leave them in the comments and we'll try it out!",
"type": "text"
}
]
},
{
"type": "heading",
"attrs": {
"level": 2
},
"content": [
{
"text": "Want to See Last Week's Stock News?",
"type": "text"
}
]
},
{
"type": "heading",
"attrs": {
"level": 2
},
"content": [
{
"text": "Watch Episode 15 Now!",
"type": "text",
"marks": [
{
"type": "link",
"attrs": {
"href": "/blog/october-2021/stocks-and-beers-ep-15",
"uuid": null,
"anchor": null,
"target": null,
"linktype": "url"
}
}
]
}
]
},
{
"type": "paragraph"
}
]
},
"_editable": "<!--#storyblok#{\"name\": \"Post\", \"space\": \"127485\", \"uid\": \"a09c2cc3-137a-498c-884a-390c8ad650d4\", \"id\": \"83116867\"}-->"
},
"slug": "stocks-and-beers-ep-16",
"full_slug": "blog/stocks-and-beers-ep-16",
"default_full_slug": null,
"sort_by_date": null,
"position": 0,
"tag_list": [
"Market News"
],
"is_startpage": false,
"parent_id": 81788464,
"meta_data": null,
"group_id": "3ca4b616-bae3-437a-bca4-e2d0f6449a76",
"first_published_at": "2021-10-29T12:38:17.000Z",
"release_id": null,
"lang": "default",
"path": null,
"translated_slugs": [
]
}
}
from laravel-storyblok.
I’ve just tested your JSON and can print everything out okay. As you’re not nesting any blocks / components (all the fields are at the root of the component) you won’t need a loop in your page.blade.php, you can access them all directly. This worked for me.
// page.blade.php
@extends('layouts._default')
@section('content')
@if ($story->image)
<img src="{{ $story->image }}" alt="{{ $story->title }}">
@endif
<h1>{{ $story->title }}</h1>
<p>{{ $story->intro }}</p>
<p>{{ $story->videoID }}</p>
<p>{{ $story->category }}</p>
<p>{!! $story->long_text !!}</p>
@stop
If you do nest blocks / components on other pages like this:
You can do the follow in Blade
// page.blade.php - or a file matching a content-type name
@extends('layouts._default')
@section('content')
@foreach ($story->blocks as $block)
{{ $block->render() }}
@endforeach
@stop
from laravel-storyblok.
I’ve had problems with this in local development as I think it Curls the remote websites but it might be useful for you.
You have a YouTube video in the videoID
field. If you update this to contain a full YouTube URL such as: https://www.youtube.com/watch?v=pSnPpzXmJ8w
Then make a class like the below all videoID
fields will be converted to it automatically (the field class matches the field name).
<?php
namespace App\Storyblok\Fields;
use Riclep\Storyblok\Traits\EmbedsMedia;
class VideoID extends \Riclep\Storyblok\Field
{
use EmbedsMedia;
}
The field will now implement the following package (version 3): https://github.com/oscarotero/Embed/tree/v3.x
This package can do all sorts of cool things to help you embed media! See: https://ls.sirric.co.uk/docs/2.7/embedding-media
If you don’t want to use the automatic field conversion above you can still use the Embed package, following their example in their readme, in your Blade view.
from laravel-storyblok.
Thanks Richard, some very useful info in there - I usually build my own YouTube embedder, but that looks like a very clean solution.
I went back to the beginning today, and re-installed Laravel using the MacOS docker method, rather than the composer method I'd tried before. I then went through the laravel-storyblok install process carefully, as well as following your recommendations here using vendor:publish, generating the stub files, and the web router.
I can now access the parts of the storyblok response that are in the 'content' element of the $story - so that's a positive.
Additionally, the routing problems seem to be solved - I can now get to the blog post I added the JSON for above.
Here's where I'm still having issues:
This loop is generating an error:
@section('content')
@foreach ($story->blocks as $block)
{{ $block->render() }}
@endforeach
@stop
The error is:
ErrorException
foreach() argument must be of type array|object, null given (View: /var/www/html/resources/views/storyblok/pages/page.blade.php)
Which is odd, because the blocks were auto-generated with the stub command:
If I remove that foreach loop from page.blade.php, everything that is manually added via $story-> appears.
Amy clues would be appreciated!
Regards,
Kelsey
from laravel-storyblok.
Hello,
Great, looks like you’re making good progress.
The reason the below loop doesn’t work for you is because you don’t a field called blocks
in your JSON.
@section('content')
@foreach ($story->blocks as $block)
// $block a field called ‘block’ that contains many child blocks
{{ $block->render() }}
@endforeach
@stop
The loop will work on a structure like this with a field called blocks
that takes many child blocks
Looking at your JSON the structure is flatter - there are no child blocks so there is nothing to loop over - you access the fields directly.
Take this example - the first three fields are directly accessed, but features
has child blocks so is looped over.
@section('content')
{{ $story->title }}
{{ $story->subtitle }}
{{ $story->intro}}
@foreach ($story->features as $block)
{{ $block->render() }}
@endforeach
@stop
Regarding the YouTube embedding - there’s no right and wrong way. Implementing your own will give you more flexibility but the package has options.
from laravel-storyblok.
Apologies Richard, I should've also provided a response that had blocks in it!
{
"story":{
"name":"Home",
"created_at":"2021-09-21T01:37:41.874Z",
"published_at":"2021-11-22T21:28:41.989Z",
"alternates":[
],
"id":72548592,
"uuid":"7a2e356b-b937-43c5-ae23-9633f5b26f7f",
"content":{
"_uid":"6018726a-73d8-45d7-9a47-447266239de5",
"body":[
{
"_uid":"73ede090-25eb-4778-89a1-b0a6cc5c949d",
"headline":"Hello world!",
"component":"teaser",
"_editable":"<!--#storyblok#{\"name\": \"teaser\", \"space\": \"127485\", \"uid\": \"73ede090-25eb-4778-89a1-b0a6cc5c949d\", \"id\": \"72548592\"}-->"
},
{
"_uid":"03e79c30-9f1c-48f4-a6f0-fb7865a48efd",
"columns":[
{
"_uid":"209a8b4d-d305-45f8-80f2-d482be9380eb",
"name":"Feature 1",
"component":"feature",
"_editable":"<!--#storyblok#{\"name\": \"feature\", \"space\": \"127485\", \"uid\": \"209a8b4d-d305-45f8-80f2-d482be9380eb\", \"id\": \"72548592\"}-->"
},
{
"_uid":"4803f11a-42f3-4801-98da-2b21e8a89251",
"name":"Feature 2",
"component":"feature",
"_editable":"<!--#storyblok#{\"name\": \"feature\", \"space\": \"127485\", \"uid\": \"4803f11a-42f3-4801-98da-2b21e8a89251\", \"id\": \"72548592\"}-->"
},
{
"_uid":"548c0506-d2c9-40ce-9888-d450fb42f5cb",
"name":"Feature 3",
"component":"feature",
"_editable":"<!--#storyblok#{\"name\": \"feature\", \"space\": \"127485\", \"uid\": \"548c0506-d2c9-40ce-9888-d450fb42f5cb\", \"id\": \"72548592\"}-->"
}
],
"component":"grid",
"_editable":"<!--#storyblok#{\"name\": \"grid\", \"space\": \"127485\", \"uid\": \"03e79c30-9f1c-48f4-a6f0-fb7865a48efd\", \"id\": \"72548592\"}-->"
}
],
"text":{
"type":"doc",
"content":[
{
"type":"paragraph",
"content":[
{
"text":"lorem ipsum dolor sit",
"type":"text"
}
]
}
]
},
"title":"home title",
"blocks":[
{
"_uid":"9019a140-50e0-4fbb-ab0c-e9d3f1f1cd29",
"headline":"Massive headline block",
"component":"teaser",
"_editable":"<!--#storyblok#{\"name\": \"teaser\", \"space\": \"127485\", \"uid\": \"9019a140-50e0-4fbb-ab0c-e9d3f1f1cd29\", \"id\": \"72548592\"}-->"
},
{
"_uid":"a20e97ee-6f01-43fc-93b7-55e4a5a79d0c",
"name":"What a cool feature",
"component":"feature",
"_editable":"<!--#storyblok#{\"name\": \"feature\", \"space\": \"127485\", \"uid\": \"a20e97ee-6f01-43fc-93b7-55e4a5a79d0c\", \"id\": \"72548592\"}-->"
},
{
"_uid":"36abdbe8-a924-4778-a388-c097967eab96",
"columns":[
{
"_uid":"b7c09620-2430-44fa-a0fe-5918fffb089b",
"title":"Column me baby!",
"component":"text",
"_editable":"<!--#storyblok#{\"name\": \"text\", \"space\": \"127485\", \"uid\": \"b7c09620-2430-44fa-a0fe-5918fffb089b\", \"id\": \"72548592\"}-->"
}
],
"component":"grid",
"_editable":"<!--#storyblok#{\"name\": \"grid\", \"space\": \"127485\", \"uid\": \"36abdbe8-a924-4778-a388-c097967eab96\", \"id\": \"72548592\"}-->"
}
],
"component":"page",
"_editable":"<!--#storyblok#{\"name\": \"page\", \"space\": \"127485\", \"uid\": \"6018726a-73d8-45d7-9a47-447266239de5\", \"id\": \"72548592\"}-->"
},
"slug":"home",
"full_slug":"home",
"default_full_slug":null,
"sort_by_date":null,
"position":0,
"tag_list":[
],
"is_startpage":false,
"parent_id":0,
"meta_data":null,
"group_id":"edb6202c-ddc9-433d-8a28-e296a5a3d4a9",
"first_published_at":"2021-11-17T10:55:54.000Z",
"release_id":null,
"lang":"default",
"path":null,
"translated_slugs":[
]
}
}
If I have a very basic /resources/views/storyblok/pages/page.blade.php I get a result, but it's unrendered:
page.blade.php
<h1>{{ $story->title }}</h1>
{{ $story->intro }}
{{ $story->text }}
View-Source
<h1>home title</h1>
<p>lorem ipsum dolor sit</p>
If I use @extends
to embed it in the layout, and use @yield to embed the content area, like so:
@extends('layouts.default')
@section('content')
<h1>{{ $story->title }}</h1>
{{ $story->intro }}
{{ $story->text }}
{{ $story->long_text }}
@foreach ($story->blocks as $block)
{{ $block->render() }}
@endforeach
@stop
I get no data back.
A static-routed, static page both renders the HTML and the various @include elements of the default layout in the correct places. For example this layout:
<!doctype html>
<html>
<head>
@include('includes.head')
</head>
<body>
<div class="container">
<header class="row">
@include('includes.header')
</header>
<div id="main" class="row">
@yield('content')
</div>
<footer class="row">
@include('includes.footer')
</footer>
</div>
</body>
</html>
Correctly renders this static page content:
@extends('layouts.default')
@section('content')
<h1>Local Template</h1>
<h2>This section is in the main content area and should be rendered.</h2>
@stop
But won't render anything when used with the example from /resources/views/storyblok/pages/page.blade.php above - none of the additional head/header/footer elements or layout elements are rendered, and neither static content within @section('content')
or {{ $story->[attribute] }} data.
This is once again, almost certainly the result of a misunderstanding on my behalf!
--- EDITED TO ADD ---
I'm also not sure how to do a query where the slug isn't part of the path?
The blog, for example. An individual blog post query looks like this, with the full slug in the path:
https://api.storyblok.com/v1/cdn/stories/blog/stocks-and-beers-ep-16?version=draft&token=XXX&cv=1637637087
But the query for the blog collection looks like this:
https://api.storyblok.com/v1/cdn/stories/?starts_with=blog/&version=draft&token=XXX&cv=1637637087
from laravel-storyblok.
Hello,
I’m struggling to replicate this. Using your latest JSON I can make a template like below and print everything. I am dumping the $blocks
because I haven’t made views for each.
<?php
// dd($story); ///////// uncommenting this should dump your entire page.
?>
@extends('layouts._default')
@section('content')
<h1>{{ $story->title }}</h1>
{{ $story->intro }}
{{ $story->text }}
@foreach ($story->body as $block)
<?php dump($block); ?>
@endforeach
<hr>
@foreach ($story->blocks as $block)
<?php dump($block); ?>
@endforeach
@stop
On your example:
<h1>{{ $story->title }}</h1>
{{ $story->intro }} <-- you have no intro field so this won’t print
{{ $story->text }} <-- this is rich-text field so gets converted to `Riclep\Storyblok\Fields\RichText`
{!! $story->text !!} <-- prints HTML
See: RichText
See: Printing HTML
The bottom of the page is cut off in my screenshot
--
https://api.storyblok.com/v1/cdn/stories/blog/stocks-and-beers-ep-16?version=draft&token=XXX&cv=1637637087
This should hit the catch-all route. If your schemas is varying on each page type in Storyblok then you might need to use different templates for each:
The names should match the content type - this might be the issue you’re having? Trying to do too much in one template?
You should be able to visit yourwebsite.com/blog/stocks-and-beers-ep-16
and load the above page.
--
https://api.storyblok.com/v1/cdn/stories/?starts_with=blog/&version=draft&token=XXX&cv=1637637087
This looks like you’re trying to load several stories at once, not a single story. This is how I implemented a blog controller to get the list of all stories. The actual blog article page uses the catch-all route and a storyblok/pages/blog.blade.php
file.
<?php
// route to hit this: Route::get('/blog', '\App\Http\Controllers\BlogController@index');
namespace App\Http\Controllers;
use App\Storyblok\Folders\Blogs;
use Riclep\Storyblok\StoryblokFacade as StoryBlok;
class BlogController extends Controller
{
public function index() {
$folder = new Blogs();
return view('storyblok.pages.blog.index', [
'blogs' => $folder->read(),
]);
}
}
// if you wanted to use a custom route and controller
// route: Route::get('/blog/{slug}', '\App\Http\Controllers\BlogController@show');
public function show($slug)
{
return Storyblok::read($slug)->render();
}
<?php
// Storyblok/Folders/Blog.php - the folder that loads the list of all blogs
namespace App\Storyblok\Folders;
class Blogs extends \App\Storyblok\Folder
{
protected $perPage = 20;
protected $slug = 'blog';
}
See: folders - the folder functionality is pretty basic in the package.
<?php
// dd($news[0]);
// storyblok.pages.blog.index
?>
@extends('layouts._default')
@section('content')
<main class="u-mb-80">
<h1 class="t-1 fgc-white bgc-navy u-pv-65 u-mb-70 t-centred">News</h1>
<div class="u-w-ml u-w--centred">
@foreach($news as $blog)
<article class="bgc-off-white blog-item">
<header class="u-mb-30">
<div class="blog-item__meta">
<h3 class="t-4 fgc-black u-mb-10 blog-item__service">{{ $blog->service }}</h3>
<p class="t-7 fgc-body-text"><time>{{ $blog->formatted_date }}</time></p>
</div>
<h2 class="t-2 u-mb-25 fgc-dark-blue">{{ $blog->title }}</h2>
</header>
<a href="/{{ $blog->meta('slug') }}" class="button button--border button--dark-blue-border">
Read Story
</a>
</article>
@endforeach
</div>
</main>
@endsection
from laravel-storyblok.
My apologies Richard, I don't think I explained very well.
If I have a static route to a static page, and that page contains
@extends('layouts.default')
@section('content')
[MY STATIC CONTENT HERE]
@stop
Then it's rendered in the default layout.
If I have a Storyblok page, and that page contains:
@extends('layouts.default')
@section('content')
<h1>{{ $story->[valid-field] }}</h1>
@stop
Then nothing is rendered - not even the default layout.
If I have a Storyblok page, and that page contains:
@extends('layouts.default')
<h1>{{ $story->[valid-field] }}</h1>
That field is properly rendered, along with the default layout, just in the incorrect place due to the lack of @yield.
Thanks for the info on folders, I'll try to get that working!
from laravel-storyblok.
If you add anything else into your Storyblok template does it render? I mean if you add static content to it like so? If you view the page source is it totally blank or just missing the content from Storyblok?
@extends('layouts.default')
@section('content')
Some static content.
<h1>{{ $story->[valid-field] }}</h1>
@stop
That should show up - if not then is seems more of an issue with your templates / Laravel config than the Storyblok stuff. Invalid fields will silently be ignored if you try printing them.
It’s very odd that the field is rendered outside the section but not inside it - it show’s you’re hitting the route -> controller -> view. It seems like your section is somehow being overridden.
I’ve just made a repo public of a site I use Storyblok for - this is quiet a messy project as it’s a personal site for a podcast and I use it to try and break things / experiment but it might help you. It was built using an earlier version of the package (but works with the current one) so the templates are more ‘hard coded’ than how I’d work now (using render()
etc). https://github.com/RicLeP/the-curiosity-of-a-child
from laravel-storyblok.
Found it!
As it turns out, having <?= dd($story); ?>
in the blade.php file prevent it from rendering the layout. It wasn't in the @section
, but removing it entirely fixed that issue. Sorry if that's something I should've known already.
Thanks for sharing the site! I love working from messy examples - I'll have a play and see if I can break my own project even further :)
Thanks again Richard, you've been extremely helpful!
from laravel-storyblok.
I’m pleased you managed to find the solution! It’s actually helpful for me too, to understand where I can improve the docs or code as being so close to the project it helps to get external perspectives.
dd()
is dump die so ends execution, Laravel, in the most recent versions, also has ddd()
dump die debug which can be very handy.
from laravel-storyblok.
Related Issues (16)
- Scaffolding Empty Components Errors
- File Permission Issue with Console Commands HOT 1
- Call to undefined method App\Storyblok\Block::flatten() HOT 3
- Resolve global reference HOT 3
- Artisan command to create block template uses folder …/components while Block.php searches in …/blocks HOT 2
- Dealing with pagination HOT 3
- Question about serializing blocks HOT 4
- Detecting broken images to prevent calling transform() HOT 2
- Cache ignores $page in paginated fetching HOT 3
- [Bug] Multi-option Parsing HOT 2
- Enable (rendering of) inline components within the RichText field HOT 8
- Dependency Dashboard
- Documentation about Folder HOT 1
- Fine tuning default configuration (public api key) HOT 1
- Undefined Variable after Generating Block HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-storyblok.