I’d like to announce the String Plugin… the first publicly-released add-on from eMarketSouth.
I wrote this plugin so that it would be easier to have good dynamic page titles, meta descriptions, breadcrumbs, and canonical link URLs and not have to give up the convenience of having a embedded template for the site’s <head> section. Basically gives you the ability to store/append/prepend text in variables while parsing a template and then print the text out where you need it, even (especially) in embedded templates.
I’ve used it now on the last two sites we’ve developed and it has really made my life a lot easier, so I figured why not release it so everyone can have an easy life too! I wrote up some documentation and examples that hopefully explain what you can do with this plugin more thoroughly than what I wrote here, just follow the link at the top of this post.
Hope you all enjoy, feedback would be most appreciated 😊
I’d like to also thank Mark Bowen and Werner Gusset for sorta being my guinea pigs. Cheers guys.
feedback would be most appreciated 😊
My feedback would be two-fold :
1 - Thanks for letting me see the plugin ahead of everyone else and 2 - Thanks for such a fantastic plugin! 😊
I used it on a site for Meta information and page titles and it’s really really really simple to set up and get going.
Fantastic work!! 😊
Best wishes,
Mark
sorry for the late response, the forums didn’t notify me when you posted this. the string plugin doesn’t output anything to the browser directly, so there must’ve been some error in the code you were trying to output. if you could post your template code perhaps someone could identify the cause of the problem. I’ve used this plugin for a half dozen or so sites now and haven’t seen any related IE8 problems.
Hi,
This is working great. One question: I need to pass a category heading in to my <title> tag.
The following does not work, returns ‘Learning Communities: ’ followed by a string of gibberish:
{exp:string:set name="meta-title"}
Learning Communities: {exp:channel:category_heading channel="learning-communities"}: {category_name}{/exp:channel:category_heading}
{/exp:string:set}Is there a way to get the category heading in to the meta title?
Thanks,
Ben
try adding parse=”inward” to the string:set tag.
otherwise try building the string in stages:
{exp:string:set name="meta-title"}Learning Communities:{/exp:string:set}
{exp:channel:category_heading channel="learning-communities"}
{exp:string:append name="meta-title"}{category_name}{exp:string:append}
{/exp:channel:category_heading}I’ll use the code I use to do the breadcrumbs on emarketsouth.com as an example:
includes/breadcrumb template:
<div class="breadcrumbs">
{exp:string:prepend name="breadcrumbs" separator="/"}<a href="/">home</a>{/exp:string:prepend}
{exp:string:output name="breadcrumbs"}
</div>Basically this will be embedded wherever breadcrumbs need to be output. It prepends the “home” link to the front of the breadcrumbs, using “/” as the separator between breadcrumb items.
The rest of the breadcrumbs are handled by building a string within the page’s base template. Using the template for our blog detail page as an example (http://www.emarketsouth.com/blog/details/how-to-create-standalone-edit-forms-in-expressionengine-2.0/):
template file: blog/details
Since we know that the template is part of the blog template group I initially set the breadcrumbs variable to link to the base blog page. Then down in the weblog:entries tag I append the weblog entry title as an unlinked breadcrumb since that’s the last step in the chain. Obviously this is a simple example but I hope it illustrates the concept well enough. If you had a template that served as a details page for multiple different weblogs you could use the {weblog} tag in the weblog:entries loop to set this dynamically.
The main advantage here is that you don’t need to worry about opening your weblog:entries tag up where you want to print the breadcrumbs. You can just compile the string as you go and print it out in the embedded template when you’re all done.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.