Concrete5 - 自定义块不可编辑,或使用编辑工具识别?

时间:2015-04-01 07:52:55

标签: php concrete5

我正在建立一个conrete5的网站。这是我可能添加的第一个。我做了几个自定义块。被命名为新闻,队友和参考。

现在新闻和队友不再可编辑了。我将粘贴News -blocks源代码。



----------- FORM.php ---------------------
<?php   defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<?php
    $al = Loader::helper('concrete/asset_library');
    echo $al->file('optional', 'fID', t('Valitse kuva'), $bf, $args);
?> 

<div class="form-group">
    <?php  echo $form->label('otsikko', t('Otsikko'));?>
    <?php  echo $form->text('otsikko', $otsikko);?>
</div>
<div class="form-group">
    <?php  echo $form->label('teksti', t('Teksti'));?>
    <?php  echo $form->text('teksti', $teksti); ?>
</div>
<div class="form-group">
    <?php  echo $form->label('korkeus', t('Korkeus'));?>
    <?php  echo $form->select('korkeus', array("108px"=>t("Pieni"),"299px"=>t("Iso")), $korkeus); ?>
</div>
<div class="form-group">
    <?php  echo $form->label('koko', t('Leveys'));?>
    <?php  echo $form->select('koko', array("col-md-3"=>t("Pieni"),"col-md-6"=>t("Iso")), $koko); ?>
</div>
<div class="form-group">
    <?php  echo $form->label('link', t('Linkki'));?>
    <?php  echo $form->text('link', $link); ?>
</div>
<div class="form-group">
    <?php $psh  = Loader::helper('form/page_selector');
     echo $psh->selectPage('targetCID', $targetCID); ?>
</div>
----------- view.php ---------------------


<?php 
    defined('C5_EXECUTE') or die(_("Access Denied.")); 
	
    $c = Page::getCurrentPage();
    if($size=="col-md-3"){
		$class='col-md-3';
        $tag  = $class;
	}else{
		$class="col-md-6";	
        $tag= $class;
	}
	if ($c->isEditMode()){
		$class="editmode";
		$editingStyle="padding: 15px; background: #ccc; color: #444; border: 1px solid #999;";
	}
	else {  
		$editingStyle = "";
	}
    $random = rand();
    if($korkeus == "299px"){
        $padding = '4px';
    }else {
        $padding = '5px';
    }
    
$p = Page::getByID($targetCID);
      $a = new GlobalArea('Header Navigation');
      $blocks = $a->getAreaBlocksArray($c);
      foreach ($blocks as $block){
         if ($block->getBlockTypeHandle()=="autonav"){
            $block->setCustomTemplate('cdrop.php'); // it's templates/cdrop.php -check the select option values when you set custom template manually at edit mode. I think you will need just "my_template" 
            $bv = new BlockView($block);
            $bv->render('view');
         }
      }
?>
<?php $p = Page::getByID($targetCID); ?>

<a href="index.php">
    <div class="pull-left <?= $koko;?>" style="padding:<?= $padding ?>;<?php echo $editingStyle;?>">
        <div class="col-lg-12 alapalkki box" style="z-index:2;position:relative;">
            <div class="image-big" style="background-color:transparent;text-align:center;position:relative;z-index:1;"> 
            <!-- FiGuRe this shit out......... !-->
                <?php    
            if($fID != 0){
            $file = File::getByID($fID);
            $filePath = $file->getVersion()->getRelativePath();
            }
            ?>
            <?php echo '<img src="' . $filePath . '" style="max-height:' .  $korkeus . ';width:100%;"/>'; ?>
        
            </div>
            <div class="col-lg-12 " style="position:relative;z-index:255;padding:2px 0 0 15px;">
                <div class="htitle">
                    <h4 style="color:white;"><b><?php echo $otsikko; ?></b></h4>
                    <p style="color:white;"><?php echo $teksti; ?></p>
                </div>
            </div>
        </div>
    </div>
</a>
&#13;
&#13;
&#13;

为什么这不是一个可编辑的块?为什么具体的5甚至不知道它在页面上的存在?它只是在该地区说它是空的。

1 个答案:

答案 0 :(得分:0)

$p = Page::getByID($targetCID);
      $a = new GlobalArea('Header Navigation');
      $blocks = $a->getAreaBlocksArray($c);
      foreach ($blocks as $block){
         if ($block->getBlockTypeHandle()=="autonav"){
            $block->setCustomTemplate('cdrop.php'); // it's templates/cdrop.php -check the select option values when you set custom template manually at edit mode. I think you will need just "my_template" 
            $bv = new BlockView($block);
            $bv->render('view');
         }
      }
?>

存在问题。不知道那里做了什么......去掉了它。工作就像一个魅力。

-Kevin