Custom Block Added Twice
Permalink
My wife has a recipe blog that we are moving from a custom developed CMS to Concrete5. To begin she has created a custom page type that she will use to input the typical blog type information: banter, images, etc.
I've created a custom block that she will place on each recipe page she creates that will store the information needed for open graph, Pinterest, Facebook, etc. Without getting in to the foreign key relationship between the recipe block type and the ingredients I've already come up against an issue where the block seems to be duplicated on the page. It doesn't happen all the time, however, it's happening enough to make me think I've done something wrong.
It seems to consistently add where I have placed it. When I go back in and edit the block it also then appears at the top of the page. Sometimes it duplicates immediately below where I have added the original.
The db.xml is as follows:
The controller is:
Thanks in advance for any help you can offer.
I've created a custom block that she will place on each recipe page she creates that will store the information needed for open graph, Pinterest, Facebook, etc. Without getting in to the foreign key relationship between the recipe block type and the ingredients I've already come up against an issue where the block seems to be duplicated on the page. It doesn't happen all the time, however, it's happening enough to make me think I've done something wrong.
It seems to consistently add where I have placed it. When I go back in and edit the block it also then appears at the top of the page. Sometimes it duplicates immediately below where I have added the original.
The db.xml is as follows:
<?xml version="1.0"?> <schema xmlns="http://www.concrete5.org/doctrine-xml/0.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.concrete5.org/doctrine-xml/0.5 http://concrete5.github.io/doctrine-xml/doctrine-xml-0.5.xsd"... > <table name="btTwistedRecipe"> <field name="bID" type="integer" size="10"> <unsigned/> <key/> <default value="0"/> </field> <field name="title" type="string"/> <field name="description" type="text"/> <field name="instructions" type="text"/>
Viewing 15 lines of 31 lines. View entire code block.
The controller is:
<?php namespace Application\Block\TwistedRecipe; use Concrete\Core\Editor\LinkAbstractor; use Concrete\Core\Block\BlockController; use Core; use Loader; defined('C5_EXECUTE') or die("Access Denied."); class Controller extends BlockController { protected $btTable = 'btTwistedRecipe'; protected $btSupportsInlineAdd = true; protected $btSupportsInlineEdit = false; public function getBlockTypeName() { return t('Twisted Recipe'); } public function getBlockTypeDescription() { return t('Recipe Card Block Type.'); } public function edit() {
Viewing 15 lines of 27 lines. View entire code block.
Thanks in advance for any help you can offer.
Thanks. I've got through and renamed the fields in the custom block in the DB, where referenced in the controller, and the view.
I commented out the second table just in case it was the culprit. Duplication still occurs.
It seems to happen specifically when I publish the changes.
The new db.xml is
I commented out the second table just in case it was the culprit. Duplication still occurs.
It seems to happen specifically when I publish the changes.
The new db.xml is
<?xml version="1.0"?> <schema xmlns="http://www.concrete5.org/doctrine-xml/0.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.concrete5.org/doctrine-xml/0.5 http://concrete5.github.io/doctrine-xml/doctrine-xml-0.5.xsd"... > <table name="btTwistedRecipe"> <field name="bID" type="integer" size="10"> <unsigned/> <key/> <default value="0"/> </field> <field name="rInstructions" type="text"/> <field name="rServingSize" type="float"/> <field name="rPrepTime" type="float"/>
Viewing 15 lines of 29 lines. View entire code block.
Apparently the problem was a stray </div> tag with no opening <div> tag.
Thanks for checking it out!
Thanks for checking it out!
I am not totally sure but it almost sounds like you may have 2 areas on the same page using the same name. You should check that.