In response to this thread over here I wanted to see if I could figure out a way to do it so I went ahead and tried. After around 2 hours of banging my head against the wall trying so many different variants I got it to work!!
Anyway plugin is attached to this post and usage is shown below and in the plugin documentation found in the admin area of EE.
Hope it’s of use to someone somewhere. Please do let me know if you use it on any projects as it’s always nice to hear / see what people are doing with these things!!
Best wishes,
Mark
Usage
{exp:mb_style_words class="first-word" start="1" words="2"} This is some text and I want the first word to be in capitals {/exp:mb_style_words}
Variables class=“my-class” class you want applied to the span tag start=“1” which word in the string you would like to start from words=“2” how many words after the word you start from you would like to apply the class to
Okay a quick update to all of this and a new version.
Thanks to inparo in this thread the plugin is now much leaner.
Having said that I have gone ahead and updated the plugin to add in two more parameters (words=“1” and start=“2”).
They can be used as shown below :
{exp:first_word class="first-word" start="1" words="2"} This is some text and I want the first word to be in capitals {exp:first_word}
Variables class=“my-class” class you want applied to the span tag start=“1” which word in the string you would like to start from words=“2” how many words after the word you start from you would like to apply the class to
This means that now you could start from any place in the string and then carry on for however many words you wish to.
Plugin has now had a cosmetic name change and so the plugin tag is slightly different. For anyone new reading this thread then nothing will seem as though it has changed and you can just go ahead and download the version from the top post. Anyone who has already downloaded and downloads the new version you just need to change the name of the plugin tag to the one shown in the documentation above.
FYI: you have a hidden “__MACOSX” folder in your plugin zip file
Don’t you just hate it when that happens?
Does it cause problems with PCs then?
I will look into adding in the first-half feature that you want but can’t promise how quickly I will do that as really busy at the moment with my works web-site.
Doesn’t cause any problems on Linux it just is visible. (It’s just a pet peeve of mine thumbs.db and __MACOSX files)
I’m not worried about the speed of the feature I could write it myself and post it here for you, but I shouldn’t need it till the end of the week.
To make the plugin more versatile for others, you should allow a percentage variable which will accept a percentage of words to place in a span(might be handy for your character style plugin as well). It also *might* be a good idea to place the remainder of string into a second span (I’ve not thought this through yet).
Hmm you may have to start adding these in yourself at this rate
I will try and get something done on a couple of these in a few days but if you need them before then please feel free to add them in and post here what you have done
No worries, I’m busy today and tomorrow with graphic design and site structure. But I’ll for sure add these features when I get the chance. You have setup a good base so it will be easy for me to post my updates here.
I’m just discovering your modern line of plugin appliances that will create leisure time for homemakers everywhere!
This one’s another great example.
But I’m wondering—Would there be any way you could create a version that’s based on the number of period+space- or period-delimited sentences? Or even
-delimited paragraphs?
Those of us who do print design—and some who do web as well—often set the first sentence or paragraph in a different style. Sometimes the type will be larger, which invites easy reading, drawing the reader into the story. Sometimes the first paragraph will be an introduction in, say, italics.
From a design standpoint, sentence- or ‘graph-based styling could be the most useful.
Regardless, the character- and word-based versions are very cool!
BTW—I’m also doing a site right now that can definitely benefit from Maximum Posts Reached.
I’m just discovering your modern line of plugin appliances that will create leisure time for homemakers everywhere!
This one’s another great example.
But I’m wondering—Would there be any way you could create a version that’s based on the number of period+space- or period-delimited sentences? Or even
-delimited paragraphs?
Those of us who do print design—and some who do web as well—often set the first sentence or paragraph in a different style. Sometimes the type will be larger, which invites easy reading, drawing the reader into the story. Sometimes the first paragraph will be an introduction in, say, italics.
From a design standpoint, sentence- or ‘graph-based styling could be the most useful.
Regardless, the character- and word-based versions are very cool!
BTW—I’m also doing a site right now that can definitely benefit from Maximum Posts Reached.
Many thanks for your unrelenting awesomeness!
Hi Bob,
Hmm, will have to have a think about that one. As there are loads of ways that a sentence could be defined and my PHP skills aren’t that brilliant, I only just know enough to get by I will have to give that a bit more thought I suspect.
Will have a think over it though and thanks for the great idea. Nice to hear how other people use or need to use these types of things.
Also glad to hear that the other plugin will be of some use to you
Will let you know if I come up with anything for the sentence type application of a plugin.
Yeah, sentences can be a little tricky. If there’s a domain—like thoughtnozzle.com—in there, the period by itself wouldn’t be enough. So I guess period-space, period-
or period- might be better. Which brings up how EE stores the formatting, too…
I think I’m assuming the plugin would be most effectively used in a weblog where the authors are aware of the formatting needs, rather than a public-poster kind of site.