Extending the example FAQ

Permalink Browser Info Environment
Hi,
I'm using the Example FAQ as a base to try and get in and get started developing, I'm attempting to modify it to store additional information (more fields).

I have added some new fields to the form etc but cannot figure out how to save them to the DB and am going round in circles looking for documentation. (I am in the process of working through the developer videos, but in a hurry for this one)
Is it possible to add extra fields to this set up or am I barking up the wrong tree?

Type: Discussion
Status: New
katiam
View Replies:
GregJoyce replied on at Permalink Reply
GregJoyce
Hello,
I have not dug too deeply into the example FAQ, but it appears to be based off of standard pages. So potentially you should be able to simply add Attributes to those pages that are part of your FAQ section and then in the page list block template included in the example FAQ you should be able to do

echo $cobj->getAttribute('desired_attribute_handle');


To display that attribute.
tonidomenech replied on at Permalink Reply
tonidomenech
I created a block to save this items.
This block added the table btDCAltaCursos in DB.

SinglePage/controller.php

private function saveData($p) {
$bt = BlockType::getByHandle('alta_cursos');
      //print_r($_POST);
      //echo print_r('Aixo:'.$bt->btID);
      $data = array(
      'cOneDate' => $this->post('cOneDate'),
      'cTwoDate' => $this->post('cTwoDate'),
      'cThreeDate' => $this->post('cThreeDate'),
      'cFourDate' => $this->post('cFourDate'),
      'cFiveDate' => $this->post('cFiveDate'),      
      'fID' => $this->post('fID'),
      'cFoto' => $this->post('cFoto')
      );
      $p->addBlock($bt, 'Main', $data);
}
tonidomenech replied on at Permalink Reply
tonidomenech
Hola amigos,

Mi problema es el siguiente?.

Siguiendo el ejemplo Example_fac.

He añadido al package un block nuevo.

En este block tengo la siguiente información.

add.php
edit.php
update.php
save.php
view.php
db.xml
controller.php

Controller.php

class AltaCursosBlockController extends BlockController {
   protected $btName = 'alta_cursos';
   protected $bName = 'alta_cursos';
   protected $btDescription = 'alta_cursos';
   protected $btTable = 'btDCAltaCursos';
   protected $btInterfaceWidth = "700";
   protected $btInterfaceHeight = "450";
   protected $btCacheBlockRecord = true;
   protected $btCacheBlockOutput = true;
   protected $btCacheBlockOutputOnPost = true;
   protected $btCacheBlockOutputForRegisteredUsers = false;
   protected $btCacheBlockOutputLifetime = CACHE_LIFETIME;
   public function on_page_view() {
      $html = Loader::helper('html');
      $this->addFooterItem(Loader::helper('html')->css('jquery.ui.css'));
MattWaters replied on at Permalink Reply
MattWaters
Hi,

You might try posting this question in the "Building with concrete5" forum, it gets more traffic from developers:

http://www.concrete5.org/community/forums/customizing_c5/...

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.