Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to reuse template asset in non template controller
  • Hi,

    I've created a small system for personal use using fuelphp 1.6.1 + bootstrap 2.3.3 and I have a problem with my bootstrap Modal.

    Basically I created a new controller to pass the view to the "modal" which extends controller class and not controller_template class.

    eg.
    -----
    class Controller_Modals extends Controller
    {
           
            public function action_type()
        {          
                
            return Response::forge(View::forge('modals/type'));
        }
           
    ----
    View::type
       <table class="table bootstrap-datatable datatable">
            <thead>
                <tr>
                    <th></th>
                    <th>Daerah</th>
                    <th>Mukim/Bandar</th>
                    <th>Kawasan</th>
                    <th>Alamat</th>
                    <th>Luas Lot</th>
                    <th>Balasan</th>
                    <th>Tarikh Penilian</th>
                </tr>
            </thead>
            <tbody>
                <?php if ($meta_jpph): ?>
                    <?php foreach ($meta_jpph as $meta): ?>
                        <tr>
                            <td><?php echo $meta->id; ?></td>
                            <td><?php echo $meta->Daerah; ?></td>
                            <td><?php echo $meta->Mukim_Bandar; ?></td>
                            <td><?php echo $meta->Kawasan; ?></td>
                            <td><?php echo $meta->Alamat; ?></td>
                            <td><?php echo $meta->LuasLot; ?></td>
                            <td><?php echo $meta->Balasan; ?></td>
                            <td><?php echo $meta->TarikhPenilaian; ?></td>
                        </tr>
                    <?php endforeach; ?>
                <?php endif; ?>
            </tbody>
        </table>
    --------

    my problem now is to use the css & js that I have declared in the template. I can view the content but since i'm using DataTables inside the modal, it doesn't properly format it as it should.
    Anyone has any idea/experience doing this?



  • HarroHarro
    Accepted Answer
    Where and how do you call this controller method? Using an ajax call?
  • Hi Harro,

    using bootstrap modal. I believe its using jquery .load() method which if i'm not mistaken, its ajax.


  • No experience with Bootstrap, but if your parent page has all the css and js loaded, fetching the html for a modal, creating the div and have it popup should not be a problem.
  • yeah. that's what i thought. anyway, I'll look into it later. Thanks for the response Harro. You have been always a great help as usual.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion