php - Adding subview blade sections dynamically to a view -


i plan add "extras" many pages, assume extras infinite amount.

it's bit hard explain using words best explaining through file structure have in mind

-views  -products   -prodcut.blade.php  -extras   -extra1    - extra_pricing.blade.php    - extra_tab.blade.php   -extra2    - extra_tab.blade.php   ..   -extra100 

now want these "extras" in "extra" folder , yield in product page , each in appropriate space ( exmaple: extra_tab in < ul > ), these extras file submitted user , added automatically.

also not done in product.blade.php , other extras should match other pages.

rethink implementation. there should not extras/extra{#}/extra_tab.blade.php "infinite" (unknown?) number, or matter. differences between extras/extra1/extra_tab.blade.php , extras/extra2/extra_tab.blade.php should determined logic/parameter passed view partial.

instead, structure have 1 extra_tab.blade.php file so:

extras/extra_tab.blade.php 

wherein extra_tab.blade.php can receive parameter (such id) so:

product.blade.php

@foreach($extra_tabs $key => $tab)    @include('extras.extra_tab', array('key' => $key, 'tab' => $tab)) @endforeach 

extras/extra_tab.blade.php

<?php  echo "this tab has index: ${key}. here tab: \n";  print_r($tab); ?> 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -