Converting data tag not within HTML tag; escaping quotes

Remember that if it's not inside the HTML tag, you can just
use the data tag as is? Here's an illustration, for Haloscan trackback code:

<a
href="javascript:HaloScanTB('<$BlogItemNumber$>');" target="_self"><script
type="text/javascript">postCountTB('<$BlogItemNumber$>'); </script></a>

now becomes

<a expr:href='"javascript:HaloScanTB("
+ "\""
+ data:post.id
+ "\"" + ");"' target='_self'><script type="text/javascript">postCountTB('<
data:post.id/>');
</script></a>



If you want to work through that further example to try it
out, using the steps explained above, you should end up with the same thing too
- with a couple of twists I'll now explain.

I'm not providing converted versions of code for displaying
links to your posts e.g. on BlogPulse - I'll leave it to you to try that, and
other code you might want to try to convert.Finally, note also that when you separate out the blocks
that aren't template tags and surround them in double quotes, that really does
mean you should separate out literally everything, even little snippets. Like
the close bracket and semicolon in ");" above (and, of course, the green single
quotes that got converted to double quotes and then escaped).Here's a further twist. I included that example to point
out something else you may need to do. It's bad enough fiddling with single and
double quotes, but what if the code you are converting, which was originally
inside the double quotes (i.e. inside the "stuff" bit of href="stuff"), itself
contains quotes? Like the single quote ' in the Haloscan example above, which is
bold green in the old Blogger version. Well, remember you have to first change
that to double quotes ". Then, you have to do what programmers call "escape" it.
Which in simple terms means that you separate that double quote " from the other
stuff using spaces (like when we were splitting out the old template tags), then
you change it to "\"" - note the backslash and extra double quotes around it -
and again you have to insert + symbols as necessary to separate those quotes
from the other blocks inside the overall single quotes. I'm running out of
colours so the whole of that lot is bold green again in the final version.You will note that there's a <data:post.id/> with angle
brackets around it (in the context of postCountTB('<data:post.id/>');). That's
because it's inside a Javascript script as required by the Haloscan code, but
that script is not actually inside an HTML tag within the value of an attribute
(i.e. between the <> angle brackets of the a tag), so that's fine - and in fact,
in a new Blogger template, if you use a data tag outside of an HTML tag,
generally you will have to use the angle brackets or it won't work.

Category

10 Resources for Designers and Developers 11 Big Tech Trends You'll See in 2013 12/12/12 56 Mashable Stories 60 second Video how to keep laptop work well 70th Golden Globes ads adsense Adsense Tips Advertising AdWords Amazon Android AngryBird Apple Apple's 2012 Year in Review Apps Apps to Spice Up Your Sex Life article Barack Obama Benefits of a Job Search Community Bill Clinton Bing Bitcoins Blackberry blogging blogging secret blogging tools book Book Review; Content Marketing for Dummies Building an Email List Business News Business tips Campaign Websites Celebrities Charlie the Unicorn Chrome Content Spoiler With Simple Animation Creative Ways to Use Your Favorite Running App CSS Design Competition for Kids Digital Media Resources dnt do not track download drive traffic Dropbox Tools e-commerce ebay Effects Social Networks email enterprenour blog Entertainment Expired Domain Business Facebook facebook hacker File Management Film Firefox for Andoid Friends Sex App Gadget Games Geeks george bush george w. bush gmail golden globes Google Google + (plus) Google API Google Capture Google Trends Google Wallet Google XPhone Guest Blog Post Guest Posting Guide to Super Bowl 2013 Betting Guide To: WordPress Development With Microsoft WebMatrix gyroscopes for optical image stabilization history Hopper DVR Horde Hot Advertising Trends of 2012 How to Backup Your Skype Chat & Audio Conversations Online With Simkl html Html 5 HTML Tool hulu Hurricane Sandy instagram's new policy internet Internet Marketing Internet users iOs 6 iPad iPhone Kim Dotcom Laptop LES link building Linkedin Malware Marketing predictions 2013 marketing tips Microsoft Microsoft Surface Pro Mobile App Websites Mobile phone Mobile web Mobile web design monetizing blog money online Motorola Music NBA Negative Target Fixation New year's resolution News nostalgia Notebook Obama Online Education Online Payment Online Stores Palestinian Statehood parental apps PC Jobs Photoshop for Retina Displays Pics Pinterest Plugin porn in vine President Obama's Speech at Vigil for Newtown Victims Promoting Yourself Via Print Publisher Radio Station Review Romsey RoundCube. mail. cpanel Russian Plane Crash Video Search engine security seff identity security SEO SEO 2013 Shop For Geeky Gifts Smartphone-Enabled Website social media Social Networks Social Sites for Families Softaculous software Spam SquirrelMail superbowl 2013 Tablet Teaching Tool Tech Technology Television The Most Reputable Company in U.S. Things I Learned About Tech in 2012 tips Tools twitter latest U.S. UN Vote Universe Unlocked iPhone 5 in the U.S. upgrade script US election US president vote us presidents video Video Conferencing App for Mac Video Marketing Videos Watercooler Ways to Stay Creative While Working From Home Waze web Web design trend 2013 web traffic webtools Wedding What Is Pinterest? White House Why You Should Say No To Multitasking Wi-Fi Smart Scale windows 7 Windows 8 Windows 8 Review Windows RT Review Wirelessly Monitors Your Driving with Dash WomenWeb Wordpress Wordpress Plugin Working From Home writing web Xbox Yahoo YouTube Favorite YouTube Updates