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 return a variable then is it on the view? #50

Open
ellemaker opened this issue Oct 25, 2019 · 10 comments
Open

Is it possible to return a variable then is it on the view? #50

ellemaker opened this issue Oct 25, 2019 · 10 comments

Comments

@ellemaker
Copy link

ellemaker commented Oct 25, 2019

propose
return "<?php $test = {$value}; ?>";

@webwizo
Copy link
Owner

webwizo commented Oct 25, 2019

I don't understand your question.

@ellemaker
Copy link
Author

Screenshot_63
Screenshot_64
Screenshot_65
Screenshot_62

see screenshot

@webwizo
Copy link
Owner

webwizo commented Oct 25, 2019

Let me see, what I can do.

@ellemaker
Copy link
Author

so I want to use $variable in the view like {{ $variable }}

@webwizo
Copy link
Owner

webwizo commented Oct 25, 2019

So why need Shortcode? You can use create Blade Extended.

https://laravel.com/docs/6.x/blade#extending-blade

@ellemaker
Copy link
Author

ellemaker commented Oct 25, 2019

this is what I'm trying to achieve

[webapp id='123123' collection='listofteams']
	@foreach ($listofteams as $item)
		<li>name</li>
	@endforeach

@webwizo
Copy link
Owner

webwizo commented Oct 25, 2019

Nice idea, dude. This feature can be added, but I don't think I can do it earlier :(

But you can create a shortcode and pass the collection, and shortcode will output the FOREACH as a result. :)

@ellemaker
Copy link
Author

yes, I already made those things. but I want to change the layout in every collections. that's why we want it to foreach in the view.

@webwizo
Copy link
Owner

webwizo commented Oct 25, 2019

But you can add one more attribute like [webapp wrap="li" parent="ul"] this way you can create multiple layouts. So it could be DIV or LI or anything.

Also, you can pass a partial view name like [webapp view="orders.grid"] and class function would be like:

$view = view($viewname)->render();
return $view

I think it would work.

@ellemaker
Copy link
Author

Thank you for helping me on this but I think it would be much easier if the we can use the variable that was return in shortcode or return a php tag(like what is in my screenshot).

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

2 participants