Library not saving? (Block question)
Permalink
I made a block with a few fields, but for some reason the image field (which draws from the library) isn't saving, so when I go to edit, the image I'd originally chosen doesn't show up. Any idea how to fix this? Here are the files, not sure if posting everything is necessary in this case but I didn't want to leave anything out:
add.php:
controller.php:
db.xml:
edit.php, where the problem surely is:
view.php, editor_config.php, and editor_init.php probably aren't necessary to post, but if I'm wrong let me know and I'll post them asap.
Am I doing something horribly wrong (new to PHP, quite possible) or is this a simple fix? Thanks for any help.
add.php:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); //$replaceOnUnload = 1; ?> <?php $al = Loader::helper('concrete/asset_library'); echo $al->file('ccm-b-file', 'tID', t('Choose File'), $bf) ?> <?php $bf = File::getByID($tID);?> <?php $includeAssetLibrary = true; $assetLibraryPassThru = array( 'type' => 'image' ); $al = Loader::helper('concrete/asset_library');
Viewing 15 lines of 20 lines. View entire code block.
controller.php:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); class RelLinkBlockController extends BlockController { var $pobj; protected $btTable = 'btRelLinkLocal'; protected $btInterfaceWidth = "600"; protected $btInterfaceHeight = "465"; public function getBlockTypeDescription() { return t("Image and Text."); } public function getBlockTypeName() { return t("RelLink"); } function getRelLink() { $content = $this->translateFrom($this->content);
Viewing 15 lines of 183 lines. View entire code block.
db.xml:
<?xml version="1.0"?> <schema version="0.3"> <table name="btRelLinkLocal"> <field name="bID" type="I"> <key /> <unsigned /> </field> <field name="tID" type="I"> <unsigned /> <default value="0" /> </field> <field name="fID" type="I"> <unsigned /> <default value="0" /> </field>
Viewing 15 lines of 21 lines. View entire code block.
edit.php, where the problem surely is:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); //$replaceOnUnload = 1; ?> <?php $al = Loader::helper('concrete/asset_library'); echo $al->file('ccm-b-file', 'tID', t('Choose File'), $bf); ?> <?php $file = File::getByID($tID); $filePath = $file->getVersion()->getRelativePath();?> <?php $includeAssetLibrary = true; $assetLibraryPassThru = array( 'type' => 'image' );
Viewing 15 lines of 23 lines. View entire code block.
view.php, editor_config.php, and editor_init.php probably aren't necessary to post, but if I'm wrong let me know and I'll post them asap.
Am I doing something horribly wrong (new to PHP, quite possible) or is this a simple fix? Thanks for any help.
Thank you, Remo!
I've installed the block and am using it as a reference. Funny, I've been to codeblog.ch many times (your site, right?), but didn't see this block, or maybe I skimmed over it... Anyway, hope I can put the pieces together. From a novice programmer, thank you sincerely for offering your help!
I've installed the block and am using it as a reference. Funny, I've been to codeblog.ch many times (your site, right?), but didn't see this block, or maybe I skimmed over it... Anyway, hope I can put the pieces together. From a novice programmer, thank you sincerely for offering your help!
You might want to check this block, it's a bit simpler but should give you enough hints about files in a block
http://www.codeblog.ch/2009/06/concrete5-staff-table/...