How to Display Blade Content stored in a Db row

FerchoCarcho

How can I Effectively Display Blade code stored in a DB instead of being displayed as a line of code?

here is the image

Inspecting the html I see " {{HTML::ul(array('a', 'b', 'c'))}} " If I can get rid of the quotes the blade content will be displayed

Alex Kyriakidis

You can compile blade syntax string, stored in a DB row or a variable by extending Blade Compiler. Solution code taken from here, I have not tested the code myself.

<?php namespace Laravel\Enhanced;

use Illuminate\View\Compilers\BladeCompiler as LaraveBladeCompiler;

class BladeCompiler extends LaraveBladeCompiler {

    /**
     * Compile blade template with passing arguments.
     *
     * @param  [type] $value [description]
     * @param  array  $args  [description]
     * @return [type]        [description]
     */
    public function compileWiths($value, array $args = array())
    {
        $generated = parent::compileString($value);

        ob_start() and extract($args, EXTR_SKIP);

        // We'll include the view contents for parsing within a catcher
        // so we can avoid any WSOD errors. If an exception occurs we
        // will throw it out to the exception handler.
        try
        {
            eval('?>'.$generated);
        }

        // If we caught an exception, we'll silently flush the output
        // buffer so that no partially rendered views get thrown out
        // to the client and confuse the user with junk.
        catch (\Exception $e)
        {
            ob_get_clean(); throw $e;
        }

        $content = ob_get_clean();

        return $content;
    }

}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to Display Blade Content stored in a Db row

From Dev

Laravel 5 how to display blade content on guest/authenticated user?

From Dev

how to get URI of stored images from db and display in image view

From Dev

In Rails, how can I display ip addresses from a db stored as int8, and not inet?

From Dev

How to display a paragraph with images and rich text in android text view. Content can be stored in xml

From Dev

How to display a paragraph with images and rich text in android text view. Content can be stored in xml

From Dev

How to display connected table data in blade view

From Dev

How to display meta key value in blade Laravel

From Dev

Linq to Sql: How to Fetch specific row using stored procedure and display columns data into textboxes

From Dev

how to display the content in front-end in div area from DB using ajax?

From Dev

How to split the row from mysql db passed through json_encode to display in separate textboxes

From Dev

how to display the content from MySQL table as the row count equals to multiple of 3

From Dev

Kendo grid How can I display row content on mouse over for each column as my data is huge?

From Dev

Adding two row counts in stored procedure in DB2 with parameters

From Dev

Is it possible to display html content stored in backend properly in Meteor?

From Dev

how to insert html content into DB

From Dev

how to create separate blade for menu , content , sidebar and footer

From Dev

How to grab content from section within blade template

From Dev

how to create separate blade for menu , content , sidebar and footer

From Dev

if several blade file extend the same content, how does blade know which to choose?

From Dev

How to view map content stored in HazelcastLocalCacheRegionFactory

From Dev

how to display xml content with php

From Dev

How to display json content with php?

From Dev

How to display content based on the URL

From Dev

How to display imenu content in speedbar

From Dev

How to display local repository content?

From Dev

How to display content $scope in HighCharts?

From Dev

how to add a row in the table programmatically in the laravel blade using javascript

From Dev

How to display controller's data in Laravel - Blade template engine

Related Related

  1. 1

    How to Display Blade Content stored in a Db row

  2. 2

    Laravel 5 how to display blade content on guest/authenticated user?

  3. 3

    how to get URI of stored images from db and display in image view

  4. 4

    In Rails, how can I display ip addresses from a db stored as int8, and not inet?

  5. 5

    How to display a paragraph with images and rich text in android text view. Content can be stored in xml

  6. 6

    How to display a paragraph with images and rich text in android text view. Content can be stored in xml

  7. 7

    How to display connected table data in blade view

  8. 8

    How to display meta key value in blade Laravel

  9. 9

    Linq to Sql: How to Fetch specific row using stored procedure and display columns data into textboxes

  10. 10

    how to display the content in front-end in div area from DB using ajax?

  11. 11

    How to split the row from mysql db passed through json_encode to display in separate textboxes

  12. 12

    how to display the content from MySQL table as the row count equals to multiple of 3

  13. 13

    Kendo grid How can I display row content on mouse over for each column as my data is huge?

  14. 14

    Adding two row counts in stored procedure in DB2 with parameters

  15. 15

    Is it possible to display html content stored in backend properly in Meteor?

  16. 16

    how to insert html content into DB

  17. 17

    how to create separate blade for menu , content , sidebar and footer

  18. 18

    How to grab content from section within blade template

  19. 19

    how to create separate blade for menu , content , sidebar and footer

  20. 20

    if several blade file extend the same content, how does blade know which to choose?

  21. 21

    How to view map content stored in HazelcastLocalCacheRegionFactory

  22. 22

    how to display xml content with php

  23. 23

    How to display json content with php?

  24. 24

    How to display content based on the URL

  25. 25

    How to display imenu content in speedbar

  26. 26

    How to display local repository content?

  27. 27

    How to display content $scope in HighCharts?

  28. 28

    how to add a row in the table programmatically in the laravel blade using javascript

  29. 29

    How to display controller's data in Laravel - Blade template engine

HotTag

Archive