Results 1 to 4 of 4

Thread: Add url field in the news

  1. #1
    User PaoloB's Avatar
    Join Date
    06-19-09.
    Location
    Italy
    Posts
    238

    Default Add url field in the news

    Hi,
    what is the way to add a new url field in the news?

    I would like to extend the news module, but how do I?

    thanks
    Paolo B.
    Contao ambassador
    ContaoCms.it - Sito di riferimento per la comunità italiana

  2. #2
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Add url field in the news

    There is already a URL field. It's just hidden in the SOURCE selector. For my own website, I broke it out by adding a few simple lines into the DCA. You'll have to add some template magic to display the URL, which is not normally displayed by the default template when you have a DEFAULT story.

    system/config/dcaconfig.php
    Code:
    // URL => break out, so it can be used in story modes too
    $GLOBALS['TL_DCA']['tl_news']['palettes']['default'] = str_replace(',source', ',source,url,target', $GLOBALS['TL_DCA']['tl_news']['palettes']['default']);
    unset($GLOBALS['TL_DCA']['tl_news']['subpalettes']['source_external']);
    
    // Url
    $GLOBALS['TL_DCA']['tl_news']['fields']['url']['eval']['mandatory'] = false;
    It will work like before, but EXTERNAL will no longer be a sub-palette, since I've broken out the fields to be permanent.

    Then all you have to do it to add the URL export to your template. The segment below was intended for the READER template, since the url is already overridden if its an external item in a list view.

    You can see it in action here:
    http://www.thyon.com/portfolio-detail/i ... ndlin.html

  3. #3
    User PaoloB's Avatar
    Join Date
    06-19-09.
    Location
    Italy
    Posts
    238

    Default Re: Add url field in the news

    Thanks
    I saw your post but I did not think could be useful to me.

    I read it immediately
    Paolo B.
    Contao ambassador
    ContaoCms.it - Sito di riferimento per la comunità italiana

  4. #4
    User PaoloB's Avatar
    Join Date
    06-19-09.
    Location
    Italy
    Posts
    238

    Default Re: Add url field in the news

    Quote Originally Posted by thyon
    There is already a URL field. It's just hidden in the SOURCE selector. For my own website, I broke it out by adding a few simple lines into the DCA. You'll have to add some template magic to display the URL, which is not normally displayed by the default template when you have a DEFAULT story.
    OK, i have read full the post.

    I would like to add a new field in general and the url field in particular.

    That way if I add another field know how to do
    Paolo B.
    Contao ambassador
    ContaoCms.it - Sito di riferimento per la comunità italiana

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
  •