1 of 2
1
NEW Plugin - MB Style Words…
Posted: 18 April 2008 07:34 PM   [ Ignore ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006

Hiya,

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

File Attachments
pi.mb_style_words.php.zip  (File Size: 2KB - Downloads: 327)
 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 18 April 2008 07:37 PM   [ Ignore ]   [ # 1 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006

EDIT: No more problems with the plugin, at least I don’t think so! wink

Okay just found something out!

If you do this :

{exp:style_first_word}This is some text to process{/exp:style_first_word}

it outputs as you would expect!

Why would doing that and putting everything on one line stop the line-break?

Thanks again for any help on this.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 19 April 2008 05:18 PM   [ Ignore ]   [ # 2 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006

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.

Slightly more power then! wink

Updated file in top post!! wink

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 19 April 2008 06:23 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  08-27-2005

Nice. Right now, I’d love to have something similar that is character-based, i.e. to style the first x characters of a span.

Profile
 
 
Posted: 19 April 2008 07:39 PM   [ Ignore ]   [ # 4 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006
TheBrad - 19 April 2008 06:23 PM

Nice. Right now, I’d love to have something similar that is character-based, i.e. to style the first x characters of a span.

Okay, give this one a try then!! wink

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 19 April 2008 07:48 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  08-27-2005

Wow, thanks! Who’s awesome? You are!

Profile
 
 
Posted: 19 April 2008 07:53 PM   [ Ignore ]   [ # 6 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006

Don’t forget to link in the other post if you have somewhere you can show this in action as it is always nice to see it in working! wink

Also let me know if you have any problems with it.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 20 April 2008 07:37 AM   [ Ignore ]   [ # 7 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006

Quick update for anyone reading this thread.

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.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 21 April 2008 10:50 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
RankRank
Total Posts:  129
Joined  04-02-2008

Well it’s Monday morning and I thought I would have to build this plug-in myself, now I don’t so ‘Mark Bowen’ == Awesome.

Here is something that it’s missing though:

I want to style my title tags (as this script does) but instead of the first word I want the first half of the words example:

{exp:first_word class="first-half" start="1" words=".5"}
One Two Three Four Five Six
{exp
:first_word}

outputs:

<span class="first-half">One Two Three</span> Four Five Six

It’s easy to grab the array length of the words, I’d write it so that the script rounds down when an odd number of words is inserted into the array.

 Signature 

Nick Yeoman at Discovery Software

Profile
 
 
Posted: 21 April 2008 10:57 AM   [ Ignore ]   [ # 9 ]  
Lab Assistant
RankRank
Total Posts:  129
Joined  04-02-2008

FYI: you have a hidden “__MACOSX” folder in your plugin zip file

 Signature 

Nick Yeoman at Discovery Software

Profile
 
 
Posted: 21 April 2008 12:07 PM   [ Ignore ]   [ # 10 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006
nyeoman - 21 April 2008 10:57 AM

FYI: you have a hidden “__MACOSX” folder in your plugin zip file

Don’t you just hate it when that happens? wink

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.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 21 April 2008 12:17 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
RankRank
Total Posts:  129
Joined  04-02-2008

Does it cause problems with PCs then?

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).

 Signature 

Nick Yeoman at Discovery Software

Profile
 
 
Posted: 21 April 2008 01:51 PM   [ Ignore ]   [ # 12 ]  
Lab Assistant
RankRank
Total Posts:  129
Joined  04-02-2008

Okay, I’ve thought of another feature.

If the string only contains one word use your character plugin

for example:

{exp:first_word class=“first-half” start=“1” words=”.5”}
OnlyOneWord
{exp:first_word}

outputs:
<span class=“first-half”>OnlyO</span>neWord

I’ve noticed I have a lot of one word headings and they are only one colour which really takes away from the graphic design of the site.

I’ll probably think of some more features in a few hours.

 Signature 

Nick Yeoman at Discovery Software

Profile
 
 
Posted: 21 April 2008 02:51 PM   [ Ignore ]   [ # 13 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006

Hmm you may have to start adding these in yourself at this rate wink

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 wink

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 21 April 2008 02:54 PM   [ Ignore ]   [ # 14 ]  
Lab Assistant
RankRank
Total Posts:  129
Joined  04-02-2008

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.

 Signature 

Nick Yeoman at Discovery Software

Profile
 
 
Posted: 25 April 2008 05:37 PM   [ Ignore ]   [ # 15 ]  
Lab Assistant
RankRank
Total Posts:  129
Joined  04-02-2008

Okay so I finally installed this and it is not working for me, I’ll see if I can trouble shoot.

 Signature 

Nick Yeoman at Discovery Software

Profile
 
 
Posted: 01 May 2008 01:07 AM   [ Ignore ]   [ # 16 ]  
Grad Student
Avatar
Rank
Total Posts:  40
Joined  09-16-2007

Hey, Mark!

I’m just discovering your modern line of plugin appliances that will create leisure time for homemakers everywhere!  grin

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!

 Signature 

...Bob

Bob West
–––––––––––––––––––––––––––––––––––––––––––––––––––––––
  Thought Nozzle(TM)
  creative consultation:
  graphic design . concepts . identity . web . writing
  http://www.thoughtnozzle.com/
–––––––––––––––––––––––––––––––––––––––––––––––––––––––

Profile
 
 
Posted: 01 May 2008 04:24 AM   [ Ignore ]   [ # 17 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10830
Joined  04-15-2006
Thought Nozzle - 01 May 2008 01:07 AM

Hey, Mark!

I’m just discovering your modern line of plugin appliances that will create leisure time for homemakers everywhere!  grin

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 wink 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 wink

Will let you know if I come up with anything for the sentence type application of a plugin.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 01 May 2008 10:46 AM   [ Ignore ]   [ # 18 ]  
Grad Student
Avatar
Rank
Total Posts:  40
Joined  09-16-2007

Hi, Mark…

Thanks!

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.

Anyway, just a thought.

Thanks again!

 Signature 

...Bob

Bob West
–––––––––––––––––––––––––––––––––––––––––––––––––––––––
  Thought Nozzle(TM)
  creative consultation:
  graphic design . concepts . identity . web . writing
  http://www.thoughtnozzle.com/
–––––––––––––––––––––––––––––––––––––––––––––––––––––––

Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120463 Total Logged-in Users: 69
Total Topics: 126539 Total Anonymous Users: 40
Total Replies: 665367 Total Guests: 347
Total Posts: 791906    
Members ( View Memberlist )