My Custom Block Isn't working
Permalink
So this is the first time I'm using Concrete5.7, I used an older verison on other websites.
This is a fresh install in Concerete5.7.
I've tried creating my own Custom Block called CorporateEmployee (the folder in applications/blocks/ is called corporate_employee. The block installed correctly, but any time I try to drag the block onto an area it simply sits there idle, with the loading cursor icon going. It never actually adds the block to the area.
Here's all my block code.
add.php
controller.php
db.xml
edit.php
view.php
This is a fresh install in Concerete5.7.
I've tried creating my own Custom Block called CorporateEmployee (the folder in applications/blocks/ is called corporate_employee. The block installed correctly, but any time I try to drag the block onto an area it simply sits there idle, with the loading cursor icon going. It never actually adds the block to the area.
Here's all my block code.
add.php
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $al = Loader::helper('concrete/asset_library'); ?> <div class="ccm-ui"> <div class="alert-message block-message info"> <?php echo t("This form is used to add corporate level employees.") ?> </div> <?php echo $form->label('name', t('Name')); echo $form->text('name'); echo $form->label('title', t('Title')); echo $form->text('title'); echo $form->label('biography', t('Biography'); echo $form->text('biography');
Viewing 15 lines of 19 lines. View entire code block.
controller.php
<?php namespace Application\Block\CorporateEmployee; use Concrete\Core\Block\BlockController; class Controller extends BlockController { protected $btTable = "btCorporateEmployees"; protected $btInterfaceWidth = "350"; protected $btInterfaceHeight = "300"; public function getBlockTypeName() { return t('Corporate Employees'); } public function getBlockTypeDescription() { return t('This block is used to manage existing & new corporate employees.'); } }
db.xml
<?xml version="1.0"?> <schema version="0.3"> <table name="btCorporateEmployees"> <field name="bID" type="I"> <key /> <unsigned /> </field> <field name="name" type="X2"> <default value="" /> </field> <field name="title" type="X2"> <default value="" /> </field> <field name="biography" type="X2"> <default value="" />
Viewing 15 lines of 20 lines. View entire code block.
edit.php
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $al = Loader::helper('concrete/asset_library'); ?> <div class="ccm-ui"> <div class="alert-message block-message info"> <?php echo t("This form is used to edit corporate level employees.") ?> </div> <?php echo $form->label('name', t('Name')); echo $form->text('name', $name); echo $form->label('title', t('Title')); echo $form->text('title', $title); echo $form->label('biography', t('Biography'); echo $form->text('biography', $biography);
Viewing 15 lines of 19 lines. View entire code block.
view.php
<?php defined('C5_EXECUTE') or die(_("Access Denied.")) ?> <div class="row full-width"> <div class="row"> <?php echo($fID); ?> <div class="col-lg-7 col-lg-offset-1"> <h3><span class="name"><?php echo($name); ?></span><span class="title"><?php echo($title); ?></span></h3> <hr class="little-orange"> <p><?php echo($biography); ?></p> </div> </div> </div>
Wow... It's the little things that get you.
Problem solved, thanks.
Problem solved, thanks.
However... testing your code gives me an error that the harder to find..
when adding a new employee, the form appears and on the last field I get
The identifier fID is missing for a query of Concrete\Core\File\File
Are you experiencing that?
I do not see where/why this would be happenning in your code.
when adding a new employee, the form appears and on the last field I get
The identifier fID is missing for a query of Concrete\Core\File\File
Are you experiencing that?
I do not see where/why this would be happenning in your code.
Not getting it on my end. I just added a brand new block and everything was working fine with it.
I have posted my related question here ->http://www.concrete5.org/community/forums/customizing_c5/the-identi...
But I also want ot ask, Where is $fID coming from? The problem is, in my code (same as yours) it is null. But I assume yours is not.
But I also want ot ask, Where is $fID coming from? The problem is, in my code (same as yours) it is null. But I assume yours is not.
echo $form->label('biography', t('Biography');
need to be
echo $form->label('biography', t('Biography'));
in add.php and edit.php