daniel-not-dan Posted March 12, 2013 Share Posted March 12, 2013 Hi there - this is more out of curiosity than necessity, but here's my question. (I'm more of a designer than a developer, so sorry in advance if the answer is super-obvious.) I want to create a field in a template where my client can enter a list of items to display in one section the site. For reference, I'm working on this: http://houchinswitt.com/new-site/#finplan. Right now, the first list is being populated with a Repeater field (using a single text line), but I feel like that's surplus to requirement. What I ultimately want is a simpler, fool-proof way of creating a list without my client having to use the TinyMCE list tool. What I'd MOST like is something like what happens when you create a Select field in the PW admin, and on the Details tab it gives you a text box where you just put in one item, hit enter, put in another item, hit enter, etc. If it's possible to do that (which I assume it is!) - can someone give an example of how I would break those values out of the database for presentation on the page? I know this is probably over-complicating the issue, but, like I said, I'm curious... and I'm always looking for ways to keep things fool-proof for my clients. The Repeater field works, it's just overly fussy for a job this small. Link to comment Share on other sites More sharing options...
Wanze Posted March 12, 2013 Share Posted March 12, 2013 Hi daniel (right?) I think you may want to check out ryans "Newlines to Unordered list" textoformatter module. This module converts newlines entered in a textarea to a list in your frontend. It ships with the core but is not installed by default. Go to Modules > Textformatter > click Install Now on your textarea field, go to the Details tab and choose this textformatter. Link to comment Share on other sites More sharing options...
daniel-not-dan Posted March 12, 2013 Author Share Posted March 12, 2013 Thanks, @Wanze! Follow-up question: I have a class ("half") assigned to the list - how would I assign that class to the unordered list created by the textformatter module? I was able to easily output the entire <ul> and all the <li>'s just by using: <?=$page->finplan_assistance_list_items ?>, but if I want to "break in" and use that class on the <ul>, does anyone have ideas for that? Link to comment Share on other sites More sharing options...
Wanze Posted March 12, 2013 Share Posted March 12, 2013 Simplest solution may be this: <?php $ul = str_replace('<ul>', '<ul class="half">', $page->finplan_assistance_list_items); echo $ul; ?> You could also set the class with javascript. Or copy the Textformatter module from /wire/modules/ in /site/modules/ - give it a new name, modify the code to your needs, install and use it. 4 Link to comment Share on other sites More sharing options...
daniel-not-dan Posted March 12, 2013 Author Share Posted March 12, 2013 Worked - thanks so much! 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now