how to use Blocks created by Admin?

edited November 2012 in Modules
there is a block named showcase in Admin->site->blocks :
{$project = fuel_model('projects', array('find' = 'one', 'where' = array('featured' = 'yes'), 'order' = 'RAND()'))}

{if ($project) }

{$project->name}

imageimage_path}" />

{/if}
how can i use this block for example in a view file?
trying to use :

<?=fuel_block("showcase")?>

but "Nothing Happens"
please help me.

Comments

  • edited 11:29AM
    That is the correct syntax. Blocks will first look in the CMS for a corresponding block if the fuel_mode is set to "AUTO" (which means that you are using the CMS to create pages). If no block in the CMS is found, it will look in the views/_blocks folder for a view with that name.

    Does it work if you create a view file in views/_blocks/showcase.php?
  • edited 11:29AM
    yes both of them works
    but when trying to load a dynamic block it doesn't work.
    <?=fuel_block("showcase")?> if there is static contents shows but when i trying to load content from database by fuel_model there is nothing displayed.
    i have tested codes individually and its correct when loading on a standalone view file then copy and paste it to a block and there is nothing displayed no error ..

    //----------works fine on view
    $domains= fuel_model('domains', array('find' => 'all'));
    foreach ($domains as $list){?>

    <?=$list->name?>


    <?php } ?>

    //---------------------------------------------SOLVED ...
    {$domains= fuel_model('domains', array('find' = 'all'))}
    {foreach $domains as list :}

    {$list->name}


    {/foreach}

    i had syntax issues
    FUEL is a nice CMS but poor in documentation and examples.
    // thank you very much
Sign In or Register to comment.