By megg on
i've searched for a solution in a php snippet or module, and so far i can't find anything, but i'm sure someone has needed this feature before.
i want my users to be able to create an unordered list of items without having to enter any html tags. i have created a cck field where they can input the items. i was thinking they could put each new list item on a new line, or perhaps separate with a special character to be replaced (by some clever php) to create the list.
does anything like this exist already?
any help would be most appreciated. i'm using drupal 5 and i have both the cck and contemplate modules installed.
Comments
this works
i still didn't find any module or snippet that does this, so this is how i solved my problem:
i added the $last1 and $last2 replacements to account for two scenarios:
1. the user puts a linebreak after the final list item, so it has to be removed before we close the list;
2. the user doesn't press enter after the final list item, so it doesn't have to be removed and we just have to close the list.
i added this code in my contemplate for this particular content type. this is what it looks like in contemplate:
now, this all works for me, but if anyone has any comments regarding this, be my guest. is the contemplate area the best place for this code, or perhaps it could also go in the node.whatever.tpl.php file?
also, it does seem like a pretty big lump of code, so if any kind-hearted php-er out there can offer any advice on how this could be improved (by using a clever regular expression, perhaps?) let me know.
Is there not a CCK module
Is there not a CCK module that would built unordered lists with field entry?
Danny
Just completed a thorough
Just completed a thorough search for a module to do this and nothing. I'll keep my fingers crossed that someone may inform us of such a module.
I found a solution! 1. Go to
I found a solution!
1. Go to your Content Type.
2. Add feild to your content type.
3. Under Text select Check boxes/radio buttons.
4. Click Create feild
5. Check Multiple values
6. Enter all your list items in Allowed values list seperating each one with a new line.
7. Create a style for this feild-item with the following CSS. display:list-item;
That's it! Works great for me. Let me know if you have any questions.
www.ss-interactive.com
Danny
(this is an old thread, but
(this is an old thread, but I just did this exact thing so I thought I'd share for future-searchers)
I made a text-box entry field that contains a list of zip-codes, one per line (important for me -- because that is about the level of sophistication my clients can handle). Then in my template for that content type, I break out the list into an array:
$zip_code_list = explode("\r\n", $node->field_valid_zips[0][view]);I used the array for comparison (an in_array kinda thing) but one could just as easily foreach your way through it to make a list if you wanted to display them.
I found a post that has a pretty nifty solution.
I tried what this post recommended: http://drupal.org/node/475654
and it worked well.
Pay attention to where your div's end