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
Printable View
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
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
It will work like before, but EXTERNAL will no longer be a sub-palette, since I've broken out the fields to be permanent.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;
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.
Code:<?php if ($this->url): ?>
<p class="more">
target) ? ' onclick="window.open(this.href); return false;" ' : ''; ?> title="Read more on <?php echo $this->url; ?>">More
</p>
<?php endif; ?>
You can see it in action here:
http://www.thyon.com/portfolio-detail/i ... ndlin.html
Thanks
I saw your post but I did not think could be useful to me.
I read it immediately
OK, i have read full the post.Quote:
Originally Posted by thyon
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 :)