Text Area Attribute: Problem with internal links and image paths

I use Composer and three Custom Page Attributes to display news on my site.

A single news entry consists of:
- a news date: Date/Time Attribute
- a news headline: Text Attribute
- news content: Text Area Attribute (Input Format: Rich Text)

My problem is that the Rich Text Field for the news content behaves different than a normal Content Block.

1. If I add an internal link in a normal Content Block, the link looks like this:
<a href="/page-name/">Page Name</a>

If I add an internal link in my custom Rich Text Field, the link looks like this:
<a href="http://my-website.com/index.php?cID=123">Page Name</a>

Pretty URLs don't work, if I click on this link.

2. With images I have a similar problem:

If I add an image in a normal Content Block, the html output looks like this:
<img src="/files/1234/1234/1234/my-image.jpg">

If I add an image in my custom Rich Text Field, the html output looks like this:
<img src="/index.php/download_file/view_inline/5/">

When I move my site from localhost to my server, the image paths are broken.

Anyone an idea how to fix these problems?

View Replies: View Best Answer
leinteractive replied on at Permalink Best Answer Reply
This really isn't the best way to use Composer.

For the Headline, you can just use the page name.

For the News Date, you can just use the Page Public Date.

For the content, you set this up through Page Defaults and Composer Settings.

Go to Dashboard > Themes > Page Types

Click on Defaults for your News page type.

Put the page in Edit Mode and then add a Content Block to the area you want the news content to show up. You can put whatever you want in there. Something like "News content goes here" is fine.

After you add the block to the page, click on the block and then choose "Composer Settings."

There is a checkbox to "Include this block in Composer." Check that. Then give it a name, like "News Content."

This way, when you use composer, you'll actually be adding content to a block on the page, which can later be easily edited by any user.
karlertl replied on at Permalink Reply 1 Attachment
Hi Travis,

I agree with you in all points and your suggestion definitely solved my problem! Thanks a lot!

One point, though:
If you use Custom Attributes for date and title, you get a very clean interface with each field immediately below the other: News Date, News Title, News Content. Moreover, each field has the appropriate label. This might be a bit easier to use for clients.

See attached screenshot.

Thanks again,
leinteractive replied on at Permalink Reply
Yes, it is a little easier to look at, but I've never had any problems with a client not understanding how to use Composer.

The other issue with having a separate News Date attribute is that the Page List uses the Page Public Date to diplay items in order of recency.

If the News Date and the Page Public Date are not the same, your news feed will not display items in the correct order.

For example, if your client makes a draft and then goes back a few days later to finish and they set the News Date for today but the Page Public Date is three days ago, the new item will appear in the list as if it was published three days ago.
karlertl replied on at Permalink Reply
You're absolutely right.

I used my solution on a site and had to override the Page List Controller and the Page List Form to make the news sortable by the News Date Attribute. Not a big problem, but your solution is surely quicker to implement.

Apart from that, I still wonder why the Custom Attribute RTE doesn't behave like the Content Block RTE. Both editors have the same toolbar (Add Image, Add File, Insert Link to Page, ...) but they produce completely different HTML output. That doesn't make sense to me.