2015-04-01 54 views
0

我正在制作一个conrete5网站。这是我可能添加的第一个。我已经让自己定制了几块。命名新闻,队友和参考。混凝土5 - 自定义块不可编辑,或用编辑工具识别?

现在新闻和队友不再可编辑了。我将粘贴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.")); 
 
\t 
 
    $c = Page::getCurrentPage(); 
 
    if($size=="col-md-3"){ 
 
\t \t $class='col-md-3'; 
 
     $tag = $class; 
 
\t }else{ 
 
\t \t $class="col-md-6"; \t 
 
     $tag= $class; 
 
\t } 
 
\t if ($c->isEditMode()){ 
 
\t \t $class="editmode"; 
 
\t \t $editingStyle="padding: 15px; background: #ccc; color: #444; border: 1px solid #999;"; 
 
\t } 
 
\t else { 
 
\t \t $editingStyle = ""; 
 
\t } 
 
    $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>

为什么这不是一个可编辑的块?为什么混凝土5在页面上时还没有意识到它的存在?它只是在该地区说它是空的。

回答

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