Saw the new plugin. Neat.
I’m trying to get it to work on my comments page
{exp:weblog:entries yadda yadda}
{exp:dropcaps}
{body}
{/exp:dropcaps}
{/exp:weblog:entries}
But it isn’t doing a thing. I was happy using the defaults so figured I’d just do the bare bones. I’m not getting anything - no broken images or anything. Just seems to be ignoring it. No error messages either (debugging is always set to superadmin)
Thanks for any help. =)
I’m not getting a good result, either. I have the text formatted in EE’s Edit panel as XHTML. I have placed the dropcap tag before the body field with the “key” number of 2, since it’s the only number that gives any result. However, all that happens is that the drop caps are applied to the tags, so I get big Ps with start and end tags before the first word of the entry.
More info from the plugin maker on how to determine the key number and proper placement of the tags would be appreciated.
Remember that string indexes start at 0, so if you want to step over the use key=’3’ because you want the fourth slot to drop cap. If no key parameter is given it should default to an index of 3.
It is also helpful to know that only letters will be affected. Anything except a-z will be ignored including numbers and punctuation. A space after you tag may be confusing things.
Actually this isn’t working for me at all. I have the followed the instructions and this is my code in the index page where it calls for the body of my code:
key is 0 because I have no P tags
<div class="body">
{summary}
{exp:weblog:entries entry_id="41"}
{exp:dropcaps color="black" key="0"}
{body}
{/exp:dropcaps}
{/exp:weblog:entries}
{extended}
</div>
And wouldn’t you know it, it completely borks my page. So, given that I’m positive I have messed up somewhere.
I just wrote a plugin that might do what you are looking for, and more. It’s called String Functions.
Essentially it’s just wrappers for some basic string manipulation functions from php.
I’ve attached to this post since it sounded related, and I don’t really know where else to put it 😊
Ahh, well after actually “reading” and “following” that link, yes it looks like you are right, and that the other is even more robust.
Such is life. If nothing else I learned how to write a plugin, and will likely be throwing more together soon.
Thanks for the heads up on that, and why has nobody heard of that plugin. I actually looked for one before I started this one last night.
Okay so I put the original posted pi.phpstringfun.php into my plugins directory.
I’m assuming next that I put this code into the body of my posts and it’ll just work?
{exp:weblog:entries entry_id="41"}
{exp:dropcaps color="black" key="0"}
{body}
{/exp:dropcaps}
{/exp:weblog:entries}
Ok, here’s the dilly on dropcaps thing. It WILL replace the character you ask it to with the image as advertised, however there are an awful lot of issue not so much accounted for in this. Likely if you had a field with no XHTML, it would have worked right out of the box. That however is not the standard case as we all know.
The example given on his website:
{exp:weblog:entries entry_id="41"}
{exp:dropcaps color="black" key="3"}
{body}
{/exp:dropcaps}
{/exp:weblog:entries}
This assumes you have a < P > tag at the beginning of your entry and that is why he suggests you start at 3. So basically the plugin is not doing any calculations for you, you need to know exactly where the character should live, numerically.
As a proof of concept, try this piece of code:
{exp:dropcaps color="red" key="3"}
asdf asdf asdlkjxcvjasdlkj laksjdfo iasdlkj asdlk kjh sdjhf haqelwk
{/exp:dropcaps}
That will likely work just fine, because there are no html chars in there that would get marked up.
I’ll see if I can make a few quick changes to make it work closer to how it is expected to.
cheers -J
Well it didn’t work but let me show you what I have for code on my main page.
{exp:dropcaps color="black" key="3"}
{body}
{/exp:dropcaps}
of course there’s a title and summary above and below this code ect…
When I didn’t have the Paragraph tags in there it was doing the same thing… nothing.
http://www.jennyandjeramiah.com
Okay I must be makig you angry by now… Here’s what I have:
Index template:
<div class="body">
{summary}
{body}
{extended}
</div>
When I got to post a new blog entry I write it like this:
{exp:dropcaps color="black" key="3"} asdf asdf asdf asdf {/exp:dropcaps}
…and that’s exactly what prints out on the blog post… code and all. Now if I use this for my index template in place of the { body }:
{exp:dropcaps color="black" key="3"}
asdf asdf asdf asdf
{/exp:dropcaps}
Then of course it prints out only: asd asddf asf asdf asdf.
I guess my question would be where exactly do I stick that code because I have literally tried it all LOL.
I have decided to post my html for my index page…
div id="middle_threecolumn"><!--Begin Middle Content -->
<a href="http://{permalink=site/tellafriend}name=content></a><a">Tell-a-Friend (Testing in progress)</a>
<div class="text"><!--Begin Text Resizer -->
/images/theme_images/blogtitle.gif
{exp:weblog:category_heading weblog="{my_weblog}"}
<h1>{category_name}</h1>
{if category_description}
{category_description}
{/if}
{/exp:weblog:category_heading}
{exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="5"}
<div class="holderblog">
{date_heading}
<div class="date">
<div class="dateicon">
{entry_date format=' %l, %F %d, %Y '}
</div>
</div>
{/date_heading}
<div class="title">
{title}
</div>
<div class="body">
{summary}
{exp:dropcaps color="red" key="0"}
{body}
{/exp:dropcaps}
{extended}
</div>
<div class="posted">Posted by {author} on {entry_date format='%m/%d'} at {entry_date format='%h:%i %A'}
{categories}
<a href="http://{path=site_index}">{category_name}</a> •
{/categories}
{if allow_comments}
({comment_total}) <a href="http://{url_title_path=">/images/theme_images/help.gifComments</a> •
{/if}
{if allow_trackbacks}
({trackback_total}) <a href="http://{trackback_path=">Trackbacks</a> •
{/if}
<a href="http://{title_permalink={my_template_group}/comments}">Permalink</a>
</div><!--End Posted -->
</div><!--End Holderblog -->
{paginate}
<div class="paginate">
<span class="pagecount">Page {current_page} of {total_pages} pages</span> {pagination_links}
</div><!--End Paginate -->
{/paginate}
{/exp:weblog:entries}
</div><!--End Text Resizer -->
</div><!--End Middle Content -->
For anyone else that might have been reading this and looking for a quick answer, and the fact is, I don’t think there is a quick answer. I’m 99% positive that the reason this plugin is/was ‘failing’ – read as not delivering expected results – is because most content management systems store HTML tags in the DB. so, if your ‘actual’ entry in the db looks like:
<h2>some verbiage here</h2>
and you tell that plugin to capitalize the first character, you will get a capital “<”. In other words, cruft. The plugin however did not fail. Like I said earlier, there is not quick fix. The right way to fix it would be to get into the plugin itself, and have it strip off all HTML from the beginning, but store it in memory. Then you can easily capitalize the first character of the rest of the post (your actual content), and then catenate the beginning HTML tags back on to the beginning of the post, and voula! It will work.
I’ll leave that task for someone who really needs it to pound out into useable code. Right now I simply do not have the time.
Sorry Jeremiah, good luck.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.