Results 1 to 4 of 4

Thread: Creating simple ContentElement [solved]

  1. #1
    New user
    Join Date
    01-15-11.
    Posts
    1

    Default Creating simple ContentElement [solved]

    Hi.

    I'm trying to create one very simple ContentElement. I've been looking around the web for all kind of tutorials for the past few days but it still doesn't work... When I select the element in the backend, there are no fields being displayed where I could enter the data. All the ContentElement should do is to take one string, namely some latex-code. Client-side it will be rendered by JavaScript. I suppose that I have forgotten something but I really don't know what...

    So, here the file structure of my module:

    /config/config.php
    /dca/tl_content.php
    /templates/ce_renderer.tpl
    /ContentLatexRenderer.php


    And here are the contents of the files:

    /config/config.php
    Code:
    <?php
    array_insert( $GLOBALS['TL_CTE']['texts'], 0, array( 'LatexCode' => 'ContentLatexRenderer' ) );
    ?>
    /dca/tl_content.php
    Code:
    <?php
    $GLOBALS['TL_DCA']['tl_content']['palettes']['LatexCode']='{title_legend}code;{expert_legend:hide},space,cssID';
    ?>
    /templates/ce_renderer.tpl
    Code:
    <?php echo $this->code; ?>
    /ContentLatexRenderer.php
    Code:
    <?php
    class ContentLatexRenderer extends ContentElement
    {
    	protected $strTemplate = 'ce_renderer';
    	protected $code;
    
    	protected function compile()
    	{
    		$this->Template->code = 'hello world';	
    	}
    }
    ?>
    Why don't I see any fields in the backend? And: How do I make the entered data be accessible by the variable $code?

    Thanks in advance!




    EDIT: dunno what it took so long for this topic to approve but meanwhile I already solved it on my own

  2. #2
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: Creating simple ContentElement [solved]

    Can you post the answer please?

  3. #3
    User
    Join Date
    07-26-09.
    Posts
    175

    Default Re: Creating simple ContentElement [solved]

    Probably the missing comma after title's legend was the cause.

  4. #4
    User
    Join Date
    10-15-10.
    Posts
    279

    Default Re: Creating simple ContentElement [solved]

    Quote Originally Posted by Tru
    Probably the missing comma after title's legend was the cause.
    missing , = LAWL :mrgreen:

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •