String Plugin
Posted: 04 March 2010 10:48 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1847
Joined  12-18-2008

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 smile

I’d like to also thank Mark Bowen and Werner Gusset for sorta being my guinea pigs.  Cheers guys.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 04 March 2010 12:04 PM   [ Ignore ]   [ # 1 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  13725
Joined  04-15-2006
ender - 04 March 2010 03:48 PM

feedback would be most appreciated smile

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! grin

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!! grin

Best wishes,

Mark

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors

Profile
 
 
Posted: 04 March 2010 12:12 PM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1847
Joined  12-18-2008

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.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 04 March 2010 12:37 PM   [ Ignore ]   [ # 3 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  13725
Joined  04-15-2006
ender - 04 March 2010 05:12 PM

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 wink Will check it out later. Thanks again for such a great plugin.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors

Profile
 
 
Posted: 13 April 2010 03:45 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  177
Joined  02-20-2010

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?

 Signature 

www.alternativa-za-vas.com

Profile
 
 
Posted: 24 May 2010 11:59 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1847
Joined  12-18-2008

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.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 20 June 2010 01:45 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  748
Joined  11-29-2005

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

 Signature 

Versa Studio: a consultative approach to web site design and development.
Free 28-page web site planning guide | Member, EE Pro Network

Profile
 
 
Posted: 20 June 2010 07:19 PM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1847
Joined  12-18-2008

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

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile
 
 
Posted: 21 June 2010 11:55 PM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  748
Joined  11-29-2005

Thanks, adding parse=“inward” worked.

 Signature 

Versa Studio: a consultative approach to web site design and development.
Free 28-page web site planning guide | Member, EE Pro Network

Profile
 
 
Posted: 07 July 2010 05:49 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  118
Joined  04-01-2009

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

 Signature 

Daniel Veiga | CEO & Lead Developer
Texas Web Design | @anjstudio | Like Us On Facebook

Profile
 
 
Posted: 07 July 2010 07:51 PM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1847
Joined  12-18-2008

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

<div style="clear:left;" class="grid_12">
    
{exp:string:append name="breadcrumbs" separator="/"}
        
<a href="/blog/">blog</a>
    
{/exp:string:append}
    {embed
="includes/breadcrumbs"}
</div>
<
div style="clear:left;" class="grid_8">
    
{exp:weblog:entries weblog="blog" sort="desc" require_entry="yes"}
        {exp
:string:append name="breadcrumbs" separator="/" text="{title}"}
        {exp
:string:append name="title" separator="|" text="{title}"}
        {exp
:string:append name="title" separator="|" text="{weblog}"}
        
<div class="grid_1 alpha omega">
            <
div class="postDate">
                <
div class="month m-{entry_date format="%m"}">{entry_date format="%F"}</div>
                <
div class="day d-{entry_date format="%d"}">{entry_date format="%d"}</div>
                <
div class="year y-{entry_date format="%Y"}">{entry_date format="%Y"}</div>
            </
div>
        </
div>
        <
div class="blogEntry">
            <
div class="blogInfo">
                <
h1>{title}</h1>
            </
div>
            <
h2>{blog_summary}</h2>
            
{blog_body}
            
<hr />
        </
div>
        
{if no_results}
            {redirect
="404"}
        {
/if}
    {
/exp:weblog:entries}
    
    
... 

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.

 Signature 

EE Pro Network
eMarketSouth - full service web design, development, and SEO
ExpressionEngine consulting services - SQL queries, .htaccess rewrites, template optimization, jQuery/AJAX, and more!
our add-ons - please “favorite” and rate our products on devot:ee if you like our work. smile

Profile