2

I'm looking for a way to let the client flag any given paragraph within a single text area field with a class so that it will appear with different styling. So say I have:

{exp:channel:entries channel="news" limit="1"}
  {myTextAreaField}
{/exp:channel:entries}

I would be hoping to get the output:

<p>First paragraph of content</p>
<p class="flagged">Second paragraph of content</p>
<p>Third paragraph of content</p>

I can think of numerous ways to do it using various plugins (Matrix, Hop Inject) but they all break the simple usability of just letting the client type their entry as a series of paragraphs in single text area field and flagging one of them. I'd prefer a less convoluted, native solution if I can find one, and I'd prefer to avoid using the the RTE if I can possibly avoid it.

Am I missing something really obvious? Or is the plugin route the only realistic solution?

1

You can do this using wygwam using a Custom Style Set. Doing this will allow your users to use the "style" drop down to add a class to a paragraph in the wygwam field.

| improve this answer | |
  • Thanks Sean. I was actually looking into that aspect of Wygwam when you posted your answer, but I'll be darned if I can get it to work. I have my .js file created, I have the path set in the 'Add advanced settings' part of the configuration editor, I've checked that the name of the style set inside the js file matches the name of the file and the name referenced in the Advanced settings dialogue... but I'm not seeing anything inside the Styles dropdown, which is empty. So I'm at a bit of dead end with this. Any suggestions? – RickL Mar 28 '13 at 11:22
  • Oh, now I've got it working. Perhaps it was something to do with the path, because I moved the .js file right back to webroot, pointed Wygwam at that, and all was good. I've been moving it back down toward it's ideal location, one level at a time, updating the path each time and it's still being recognised. Hurrah! HOWEVER... as an experiment I moved it to a different location, didn’t update the path, and my wygwam field in my test channel entry is still showing those styles in the Styles menu. Shouldn't they be unreachable if the .js file is out of location? [cont...] – RickL Mar 28 '13 at 12:12
  • [...] The fact that Wygwam seems to remember previous locations a) makes me wonder if this was the cause of my earlier problems, and b) whether Wygwam will suddenly ‘forget’ where the .js file is when I move to (for example) the production server. It's a bit of a worry. – RickL Mar 28 '13 at 12:12
0

Given that it sounds like you need the client to have the ability to flag any chunk they want, short of the client entering html, I'm not sure you can avoid the need to have a rows-based flagged/unflagged kind of setup for the client - Matrix being the obvious example. The usability of that solution is better than the alternative of having the client have to enter such flagging themselves in HTML. On the upside, they only need to create a new row for the instance of flagging. So a group of twelve paragraphs, only one of which requires flagging, would only require three rows in Matrix. The client ought to be able to understand that pretty easily, I would think.

| improve this answer | |
  • Thanks Jean. Yes, I am starting to reach the same conclusion, I just wanted to make sure I wasn't missing an obvious, native solution before embarking on a plugin remedy. Matrix is the likely solution for me, but I'm also looking at Wygwam, where I could create pre-made buttons for applying a specific class. – RickL Mar 27 '13 at 12:16
  • If you don't plan to take advantage of all the other things an RTE can offer, you can certainly stick with your plan of using a simple textarea with some basic formatting buttons in place, while using matrix to give the client the ability to pick and choose what gets flagged. – Jean St-Amand Mar 27 '13 at 12:20
  • Not that you couldn't do it within a textarea with some kind of short code approach, but I would see that being a less ideal user experience too. – Jean St-Amand Mar 27 '13 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.