简体   繁体   English

在tinymce编辑器文本区域中显示blob的最佳方法是哪种?

[英]Which is the best approach to show blob in a tinymce editor textarea?

I'm using Symfony2 and Twig to create a CMS. 我正在使用Symfony2和Twig创建CMS。

In the "Manage Article" section, I use a bundle of tinymce to create rich content. 在“管理文章”部分,我使用捆绑的tinymce来创建丰富的内容。 The rich content is salved in database as a blob. 丰富的内容在数据库中保存为Blob。 This works perfectly. 这很完美。 The problem is when I want to edit an article. 问题是当我想编辑文章时。 I don't know how to show the blob in the tinymce textarea. 我不知道如何在tinymce文本区域中显示斑点。 All I got is Resource id_ #. 我只有资源ID_#。

I thought about creating an extension to twig, but I don't Know if there is any other simpler solution. 我曾考虑过为树枝创建扩展,但是我不知道是否还有其他更简单的解决方案。

Can Someone help me? 有人能帮我吗?

Thanks in advanced. 提前致谢。

Edit: ContentType.php 编辑:ContentType.php

namespace FEB\EmbeddableBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ContentType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('titulo', 'text', array('label' => 'Título :'))
                ->add('post', 'textarea', array(
                        'label' => 'Contenido a publicar :',
                        'attr' => array(
                                'class' => 'tinymce',
                                'data-theme' => 'advanced', // simple, advanced, bbcode
                                'rows' => 20,
                                'cols' =>  80
                                )

                     ))
                ->add('tipo', 'choice', array(
                        'label' => 'Clasificación de contenido :',
                        'empty_value' => 'Selecciona uno',
                        'choices' => array( 'video' => 'Video', 
                                            'imagen' => 'Imagen', 
                                            'hipertexto' => 'Hipertexto', 
                                            'unidad' => 'Artículo')
                        ))
                ->add('tags', 'entity', array(
                                                'label' => 'TAGS :',
                                                'class' =>    'FEBTagsBundle:Tag',
                                                'property' => 'tag',
                                                'empty_value' => 'Selecciona tags',
                                                'multiple' => true));
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'FEB\EmbeddableBundle\Entity\Content'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'feb_embeddablebundle_contenttype';
    }
}

Rich content is only text, right ? 丰富的内容只是文字,对不对? In this case, why do you use a blob instead of the text type ? 在这种情况下,为什么要使用blob而不是文本类型

Can you please show us your form type ? 您能告诉我们您的表格类型吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM