1 of 2
1
NEW Plugin - MB Style Letters…
Posted: 19 April 2008 06:39 PM   [ Ignore ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

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

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
T<span class=“my-class”>his </span> 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

File Attachments
pi.mb_style_letters.php.zip  (File Size: 2KB - Downloads: 131)
 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 19 April 2008 06:45 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

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 :

<span class=“my-class”>This </span>is a test

returned instead of :

<span class=“my-class”>This i</span>s a test

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

Hope it comes in useful though.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 19 April 2008 06:59 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  55
Joined  08-26-2005

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}

Profile
 
 
Posted: 19 April 2008 07:08 PM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

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 wink

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 19 April 2008 07:11 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  55
Joined  08-26-2005
Mark Bowen - 19 April 2008 07:08 PM

I’m working on a way of completely deleting the entire code-base of IE from Microsloth as I write this wink

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

Profile
 
 
Posted: 19 April 2008 07:17 PM   [ Ignore ]   [ # 5 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

Wow my first subscriber!!!

Hmmm, now if I only had a newsletter!!

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

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 20 April 2008 06:33 AM   [ Ignore ]   [ # 6 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

Okay, just for anyone following along with this plugin (seems to be just me and Brad wink 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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 September 2008 12:08 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  118
Joined  01-30-2008

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:

<p id="record-description">
                    
{exp:mb_style_letters start="1" letters="4" class="dropcap"}
                            {album_description}
                     {
/exp:mb_style_letters}
                
</p>

The field is a textarea with Auto BRs

Profile
 
 
Posted: 04 September 2008 12:12 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  118
Joined  01-30-2008

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

Profile
 
 
Posted: 04 September 2008 12:16 PM   [ Ignore ]   [ # 9 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 September 2008 01:33 PM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  118
Joined  01-30-2008

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

Profile
 
 
Posted: 04 September 2008 02:06 PM   [ Ignore ]   [ # 11 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

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

File Attachments
pi.mb_style_letters.php.zip  (File Size: 2KB - Downloads: 35)
 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 September 2008 02:24 PM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  118
Joined  01-30-2008

nope 0, 1 doesnt work

Profile
 
 
Posted: 04 September 2008 02:28 PM   [ Ignore ]   [ # 13 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

Hmm, Should be. downer

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

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 September 2008 02:31 PM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  118
Joined  01-30-2008

nope doesnt work.

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

Profile
 
 
Posted: 04 September 2008 02:35 PM   [ Ignore ]   [ # 15 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

Hmm very weird.

Which version of ExpressionEngine are you running and you did download the new version of the plugin and replace the existing one didn’t you? wink

Also what exactly does {album_description} have in it and what is the field type set to. Is it Auto <br /> or perhaps XHTML?


Thanks,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 September 2008 02:37 PM   [ Ignore ]   [ # 16 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  118
Joined  01-30-2008

yep. I think I’m on 1.6.3, new plugin and {album_description) is a textarea w/ Auto BRs

Profile
 
 
Posted: 04 September 2008 02:46 PM   [ Ignore ]   [ # 17 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6563
Joined  04-15-2006

Hmm,

Weird. I’m actually testing this on 1.6.3 Build:  20080319 myself on a localhost install that I mess around with and seems to be fine. Not too sure what’s going on there.

Is the field that you are typing the album description into simply just a text-area and doesn’t use any of those WYSIWYG editors does it?

Also did you try this code (mentioned above) :

{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}

Literally try that code so that you are applying the plugin to the title just to see if that works as that is how I tested it. If it works with that then something else must be up somewhere. If not then I’m a little confused really.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 04 September 2008 03:11 PM   [ Ignore ]   [ # 18 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1643
Joined  05-13-2004
Mark Bowen - 19 April 2008 07:08 PM

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.

What do you use? What about when you hand off the site to clients? How do you explain the need to use p tags?

 Signature 

CreateSean - My journey to pro web designer
currently improving my CSS, XHTML, JQuery & photoshop kung fu skills
I am the poster formally known as The Linguist.

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 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64981 Total Logged-in Users: 26
Total Topics: 82022 Total Anonymous Users: 18
Total Replies: 440842 Total Guests: 175
Total Posts: 522864    
Members ( View Memberlist )
Newest Members:  Chris Bandytony leodennisbaldwinhazlett_davidkpspokeli9htcluizmbentsitjmattdennis3