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

String Plugin

Development and Programming

ender's avatar
ender
1,644 posts
16 years ago
ender's avatar ender

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.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
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

       
ender's avatar
ender
1,644 posts
16 years ago
ender's avatar ender

BTW Mark: if you haven’t yet, check out the newest version I posted to the site. I changed it somewhat to support conditionals and such between tag pairs.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
BTW Mark: if you haven’t yet, check out the newest version I posted to the site. I changed it somewhat to support conditionals and such between tag pairs.

Already downloaded 😉 Will check it out later. Thanks again for such a great plugin.

Best wishes,

Mark

       
Ramya108's avatar
Ramya108
123 posts
about 16 years ago
Ramya108's avatar Ramya108

Ender, I was using your great plugin to insert the title, meta keywords and meta description, until I realized that it completely ruins my website in IE8. (I am not sure about IE7, because I don’t have it installed on my PC).

Do you think this can be fixed?

       
ender's avatar
ender
1,644 posts
15 years ago
ender's avatar ender

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.

       
Versa Studio's avatar
Versa Studio
572 posts
15 years ago
Versa Studio's avatar Versa Studio

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

       
ender's avatar
ender
1,644 posts
15 years ago
ender's avatar ender

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}
       
Versa Studio's avatar
Versa Studio
572 posts
15 years ago
Versa Studio's avatar Versa Studio

Thanks, adding parse=”inward” worked.

       
Danny Veiga's avatar
Danny Veiga
58 posts
15 years ago
Danny Veiga's avatar Danny Veiga

Do you have an example of how you’d build breadcrumb navigation with String?

       
ender's avatar
ender
1,644 posts
15 years ago
ender's avatar ender

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.

       

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.