We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

NEW Plugin - MB Style Letters…

Development and Programming

Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Seems every time I make a plugin someone wants something different!! 😉

Thanks TheBrad for the idea!!

Should be working fine. Not fully tested but pretty sure it is doing everything it should be doing!

Usage

{exp:mb_style_letters start="2" letters="4" class="my-class"}
This is a test of the style x characters plugin.
{/exp:mb_style_letters}
Returns This is a test of the style x characters plugin.

Please let me know if this is of any use to anyone or I will just stop making these things!!!

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Meant to mention, please be aware that this doesn’t take into account spaces so if you had :

This is a test

and you wanted to apply the class to the first 5 characters then you would get :

This is a test

returned instead of :

This is a test

Sorry but until I understand this stuff a bit more then I will have to leave it like that 😉

Hope it comes in useful though.

Best wishes,

Mark

       
TheBrad's avatar
TheBrad
48 posts
17 years ago
TheBrad's avatar TheBrad

Oh, that works a treat! Thank you!

Note that if it is applied to a field with XHTML formatting, you have to skip at least three characters to get beyond the automagically inserted paragraph tag. For example:

{exp:style_x_characters start="3" letters="1" class="dropcap"}
{body}
{/exp:style_x_characters}
       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Very good point, however I never ever use XHTML as I don’t like what it places in but thanks for the heads up for everyone else.

Also if you are using this just for drop-caps then there is the css pseudo element :first-letter that you could also use to do this.

Admittedly one of the versions of IE doesn’t play nice with this but hey I’m working on a way of completely deleting the entire code-base of IE from Microsloth as I write this 😉

There is also a drop-caps plugin available that will do this sort of thing too but uses graphics to do its magic. May still be of use though?

Best wishes,

Mark

       
TheBrad's avatar
TheBrad
48 posts
17 years ago
TheBrad's avatar TheBrad
I’m working on a way of completely deleting the entire code-base of IE from Microsloth as I write this 😉

Your ideas intrigue me and I wish to subscribe to your newsletter. 😊

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Wow my first subscriber!!!

Hmmm, now if I only had a newsletter!!

Must write a plugin to make me an automated one!! 😉

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Okay, just for anyone following along with this plugin (seems to be just me and Brad 😉 I have uploaded a new version to the top post. Nothing much has changed except for a cosmetic change to the name of the plugin and therefore the plugin tag.

Documentation above changed to reflect this also.

Best wishes,

Mark

       
ropeadope's avatar
ropeadope
98 posts
16 years ago
ropeadope's avatar ropeadope

Hey mark, Great plugin but it doesn’t seem to be working for me… on the link below, I have it set to the paragraph starting with “Owing as much to james brown…”

ropeadope

Heres the code in the template:


                    {exp:mb_style_letters start="1" letters="4" class="dropcap"}
                            {album_description}
                     {/exp:mb_style_letters}
                

The field is a textarea with Auto BRs

       
ropeadope's avatar
ropeadope
98 posts
16 years ago
ropeadope's avatar ropeadope

never mind got it to work but had to set START=5 and letters=4.

that doesnt make much sense to me… thought it was START=1 and letters=1 to do a simple drop cap with the first letter of the first word

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Could it have possibly been because you have some kind of tag being output first or something?

Just surmising though. Glad this is working for you.

Best wishes,

Mark

       
ropeadope's avatar
ropeadope
98 posts
16 years ago
ropeadope's avatar ropeadope

dont think so. no tags, no nothing in the code. just pure text

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Eek!!

I don’t know why this didn’t crop up before. Just tested it out and I think I see what I did wrong. I’m a little tired today but pretty sure that this shouldn’t have even really been working from the get go!

I’ve attached a new version to this post. Could you possibly test it out for me and it should now work with start=”0” and letters=”1”.

If it works okay then I will update the top post of this thread.

Sorry about that.

Best wishes,

Mark

       
ropeadope's avatar
ropeadope
98 posts
16 years ago
ropeadope's avatar ropeadope

nope 0, 1 doesnt work

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hmm, Should be. :down:

Just tested it here and seems to be.

Can you show me your exact template code?

Also perhaps just very quickly try with just this :

{exp:weblog:entries weblog="default_site"}

{exp:mb_style_letters class="my-class" start="0" letters="1"}{title}<br  >{/exp:mb_style_letters}

{/exp:weblog:entries}

See what that does perhaps?

Best wishes,

Mark

       
ropeadope's avatar
ropeadope
98 posts
16 years ago
ropeadope's avatar ropeadope

nope doesnt work.

{exp:mb_style_letters start="0" letters="1" class="dropcap"} {album_description} {/exp:mb_style_letters}

       
1 2

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.