Help with blocks

Permalink
Can I get some help explaining the process to implement this block

I want a block with this as the view

<div class="box">
  <h2> <a href="#" id="toggle-blockquote">Testimonials</a> </h2>
  <div class="block" id="blockquote">
    <? $a = new Area('TestimonialsArea'); $a->display($c); ?>
  </div>
</div>


So I want to build a basic block that simply holds some html and a editable html region. how would I create it, and how would I write the db file to have default content

 
Tony replied on at Permalink Reply
Tony
you can put blocks inside of areas, but you can't make a block with an area inside of it. To do what you're talking about, try making a "custom template" for a block. You probably want to do this with the HTML or the Content block. To do this with the HTML block, to add a template just add a file here:

c5WebsiteRoot/blocks/html/templates/box_view.php

to get started, just copy the view from: c5WebsiteRoot/concrete/blocks/html/view.php
...and make any changes you need.

To actually select that template, after the html block has been added to the page, click on it, then click the "custom template" option, and select your template.
aaron replied on at Permalink Reply
Thanks, that makes sense.

What would I need to do to duplicate the HTML block, say I didn't want to use a template for some particular reason. What would need to be modified and how would I pre-populate it.

So all I want to do is copy block, icon, name, description and view.

<?php  defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<div class="box">
  <h2> <a href="#" id="toggle-blockquote">Testimonials</a> </h2>
  <div class="block" id="blockquote">
    <div id="HTMLBlock<?php echo intval($bID)?>" class="HTMLBlock">
<?php echo $content; ?>
</div>
  </div>
</div>


and use same dd as html block.
Tony replied on at Permalink Reply
Tony
yes, you could create a whole new block for this too. Just copy the HTML or Content block from the /concrete/blocks/ directory into the /blocks/ directory, rename the folder to /blocks/block_name/, rename the controller to BlockNameController. You can then either use the same table name as the original block (in that case delete the db.xml file), or you can change the table name in the controller.php and the db.xml file. That should do it (maybe).
aaron replied on at Permalink Reply
I tried that but for some reason it would not show up as available to install. any ideas? ill try again.
aaron replied on at Permalink Reply
Any idea it would say block type installed but the block remains on the "new" side and not the currently installed

this is all I did

class TestimonialsHtmlBlockController extends BlockController {
   var $pobj;
   protected $btTable = 'btContentLocal';
   protected $btInterfaceWidth = "640";
   protected $btInterfaceHeight = "200";
   public $content = "";   
   public function getBlockTypeDescription() {
      return t("Add testimonials to your site.");
   }
   public function getBlockTypeName() {
      return t("Testimonials");
   }