Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > web part that accepts author-generated HTML View modes: 
User avatar
Member
Member
dcollins-marketwired - 1/23/2014 2:01:35 PM
   
web part that accepts author-generated HTML
I want to put a part on my template that will allow the author to add HTML. Essentially it's gonig to be a little list of links, but they're different sizes and some are images, etc. Sometimes there won't be any at all. The author will have to write up their own little HTML snippet and insert it whole.

I guess what I'm looking for is a generic holder that will accept author-created HTML.

I thought that the webpart static HTML sounded right but it does not do what I need. The web part properties has a Content panel with a Text field, but this field takes text and renders it literally (i.e. not as HTML).

User avatar
Member
Member
dcollins-marketwired - 1/23/2014 3:25:53 PM
   
RE:web part that accepts author-generated HTML
BTW, by author, I mean 's/he who creates website content for publishing'. Not the end-user.

Essentially I need a generic web part that allows then to add their own HTML snippets, depending on what new content is needed, at authoring time.

User avatar
Certified Developer 10
Certified Developer 10
josha-bpstudios - 1/23/2014 3:30:24 PM
   
RE:web part that accepts author-generated HTML
Could you just create a new doctype with a couple of fields for the user to enter info into, then use a repeater to display the results(fields could be long text- HTML Area, file upload). Also, may an image field could be added this way as well. This way multiple links or "documents" can be added and you don't have to manage anything in custom code, just a transformation.

User avatar
Member
Member
dcollins-marketwired - 1/23/2014 3:39:45 PM
   
RE:web part that accepts author-generated HTML
So, my doctype would be called freeformHTML, and would have one field?

User avatar
Member
Member
dcollins-marketwired - 1/23/2014 3:49:59 PM
   
RE:web part that accepts author-generated HTML
What 'data source name' would I give the repeater? It's a required field.

User avatar
Certified Developer 10
Certified Developer 10
josha-bpstudios - 1/23/2014 3:54:08 PM
   
RE:web part that accepts author-generated HTML
Your doc type could have as many fields as you want. For your purposes it seems that a field for a link and a field for an image would work. You won't need a datasource, all you would need is to select your doc type and create a transformation. Your transformation will be what each documents contents will follow...

Could be this:
Link would be the url field that you have

Eval("Link")

User avatar
Member
Member
dcollins-marketwired - 1/23/2014 4:13:26 PM
   
RE:web part that accepts author-generated HTML
josha-bpstudios wrote: Your doc type could have as many fields as you want. For your purposes it seems that a field for a link and a field for an image would work.

Well, it's going to be HTML area, because I don't know how the author will create these links. Some might be text, some might have icons, some might look like buttons. So it'll be up to the author to provide the little HTML snippets for each.

josha-bpstudios wrote: You won't need a datasource,

It is a required field. I cannot even create a repeater without supplying some value there.
josha-bpstudios wrote:
all you would need is to select your doc type and create a transformation. Your transformation will be what each documents contents will follow...

Could be this:
Link would be the url field that you have

Eval("Link")

It should just output the HTML snippet without modification.

So, this month, the author's little list might look like this:

<p><a href="/home.html">Go to our homepage</a></p>
<p><a href="/map.html"><img src="map.aspx"/></a></p>
<p><a href="/contact us.html"><img src="phone-icon.png"/>Contact Us</a></p>

User avatar
Member
Member
dcollins-marketwired - 1/23/2014 4:20:32 PM
   
RE:web part that accepts author-generated HTML
It is a required field. I cannot even create a repeater without supplying some value there.

Oh OK. The basic repeater requires a data source; the repeater optionally has a path to content.

I guess I just stick the HTML in a little text file. I'll try that. Wow, that's gonna be horribly unmaintainable... a little txt file floating around in some random folder - utterly separate from Kentico...

User avatar
Member
Member
dcollins-marketwired - 1/23/2014 4:33:07 PM
   
RE:web part that accepts author-generated HTML
Nope. Stumped.

No way to point the repeater at a file.

User avatar
Member
Member
dcollins-marketwired - 1/23/2014 4:46:35 PM
   
RE:web part that accepts author-generated HTML
OK, I see where the docs are supposed to be found. They're supposed to be in the Content Management Tree, under the page that needs them, i.e. they should be children of my Events page.

I can right-click the events leaf in the content management tree to create a new document, and select its document type, of which there are many, inclduing some custom types. If my freeformHTML document were in that list, I would be able to choose it, but it's not there. There must be some sort of "registration" step I missed when creating my freeformHTML doctype.

User avatar
Member
Member
dcollins-marketwired - 1/23/2014 5:10:19 PM
   
RE:web part that accepts author-generated HTML
Nope, tried everything. : throws hands in air :

User avatar
Member
Member
Jerreck - 1/24/2014 7:13:35 AM
   
RE:web part that accepts author-generated HTML
Editable Text webparts allow you to enter HTML. Just click "source" in the top left hand of the toolbar when you are in the WYSIWYG editor.

User avatar
Member
Member
dcollins-marketwired - 1/24/2014 8:25:52 AM
   
RE:web part that accepts author-generated HTML
Jerreck wrote: Editable Text webparts allow you to enter HTML. Just click "source" in the top left hand of the toolbar when you are in the WYSIWYG editor.

ARGH! Yes! I just found that!

I feel a bit silly. I was staring right at it and rejected it. I was 95% there, but did not notice the SOURCE option, so was trying to type HTML in as rich text. (I blame the location of the shared toolbar, which is physically removed from the field being edited.)

All the rest of it - the doctype, the repeater - all of it, is unnecessary.

Thanks Josha for sticking with me, and thanks Jerreck for seeing past my confusion to my goal.