Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
In order to try and keep the generated tweets below the 140 char limit I have made some modifications to the prepareMessage function.
The general gist of the code is:
(this code assumes directory URL's - a small modification is required if not used.)
if (template.Replace("#title#", title).Replace("#url#", url).Length < 140) { template = template.Replace("#title#", title).Replace("#url#", url); } else if (template.Replace("#url#", url).Length < 120) { //allow full URL & truncated title - less than 120 to leave enough space for meaningful title template = template.Replace("#url#", url).Replace("#title#", title.Substring(0, 135 - template.Replace("#url#", url).Length) + "..."); } else { // otherwise url will be http:example.com/1234 (assumes directory URL's) Uri u = HttpContext.Current.Request.Url; String baseUrl = u.Scheme + "://" + u.Host + "/"; template = template.Replace("#url#", baseUrl + d.Id.ToString()).Replace("#title#", title.Substring(0, 135 - template.Replace("#url#", url).Length) + "..."); }
Hi Paul,
Thanks for this.
I can give you write access to SVN if you'd like to commit these changes?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Keeping tweets short
In order to try and keep the generated tweets below the 140 char limit I have made some modifications to the prepareMessage function.
The general gist of the code is:
(this code assumes directory URL's - a small modification is required if not used.)
Hi Paul,
Thanks for this.
I can give you write access to SVN if you'd like to commit these changes?
is working on a reply...