Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to load dynamic content in the generated page? #80

Open
secretwebmaster opened this issue Sep 18, 2023 · 2 comments
Open

Comments

@secretwebmaster
Copy link

For example I implemented laravel-grapesjs in my Page model. While building the page, I would like to add a block of "Latest posts".
In the latest posts, just simply load the latest posts dynamically even after the page is saved.

First, I tried to add a custom template/block with foreach loop

@foreach($posts as $post)
{{$post->title}}
@endforeach

It did load the latest posts in the editor but then save as static content.

=======================
Then I created an api to get posts and try to load the post with ajax.

<div class"posts"></div>
<script>//my ajax script</script>

But still fail because when adding the block to editor, the script part got removed.

==========================

Doese any one know how we can add dynamic content?
Thank you for the great package!

@secretwebmaster secretwebmaster changed the title Is it possible to load dynamic content in the page Is it possible to load dynamic content in the page? Sep 18, 2023
@secretwebmaster secretwebmaster changed the title Is it possible to load dynamic content in the page? Is it possible to load dynamic content in the generated page? Sep 18, 2023
@webakademia
Copy link

Adding the ajax script is a good solution but dont add it through the grapeJS editor. Add it as an extra field somewhere in edit page, save it as a different attribute of your model and show it that way.

@chags
Copy link

chags commented Aug 25, 2024

I need help, a tutorial to be able to run dynamic data. Could I create a dados.js, where it loops and loads the id="dados" that I will place inside the iele wheel block?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants