Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Colin Sales 9 posts 92 karma points
    Sep 07, 2015 @ 16:27
    Colin Sales
    1

    Multiple Twitter feeds

    I am new to Umbraco. The front page of our website (www.3cconsultants.co.uk) has a feed of my tweets. We would like the tweets of other members of our team to appear too. Is this possible? I have tied to paste in a second widget link after mine, but I keep getting an error. Can anyone help?

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Sep 07, 2015 @ 17:05
    Steve Morgan
    1

    Hi Colin,

    I suspect this isn't really an Umbraco issue but more of a front end issue. What is the error you're getting - is it a javascript error when you load the webpage or do you mean you're getting an error when you try to add the second widget in Umbraco.

    Can you provide a screenshot of the error. It all depends on how the original developer has implemented your site.

    Steve

  • Colin Sales 9 posts 92 karma points
    Sep 08, 2015 @ 08:51
    Colin Sales
    1

    Thanks for coming back to me Steve, I really appreciate it.

    I have been trying to add the additional persons twitter link at the end of my link in the Twitter Link field (under the Social tab). I have tried various formats, but they keep giving me the below error. Is what I am trying to achieve possible?

    Many thanks Colin


    Received an error from the server An error occurred

    String or binary data would be truncated. The statement has been terminated.

    EXCEPTION DETAILS:

    System.Data.SqlClient.SqlException: String or binary data would be truncated. The statement has been terminated. STACKTRACE:

    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteScalar() at StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteScalar() in c:\Code\github\SamSaffron\MiniProfiler\StackExchange.Profiling\Data\ProfiledDbCommand.cs:line 299 at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>cDisplayClassa.9() at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func1 func) at Umbraco.Core.Persistence.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) at Umbraco.Core.Persistence.Database.Insert(Object poco) at Umbraco.Core.Persistence.Repositories.ContentRepository.PersistUpdatedItem(IContent entity) at Umbraco.Core.Persistence.Repositories.RepositoryBase2.PersistUpdatedItem(IEntity entity) at Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action1 transactionCompleting) at Umbraco.Core.Services.ContentService.SaveAndPublishDo(IContent content, Int32 userId, Boolean raiseEvents) at Umbraco.Web.Editors.ContentController.PostSave(ContentItemSave contentItem) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.<GetExecutor>b__c(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func1 func, CancellationToken cancellationToken)

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Sep 08, 2015 @ 09:04
    Steve Morgan
    1

    Hmmm so this is when you're adding the code in the Umbraco back end?

    Apologies if I'm missing the mark but are you quite new to Umbraco? It sounds like you're referring to a Twitter Link field and social tab that is custom to your website.

    If you are new to Umbraco then think of it as a blank canvas - the fields and back office tabs you see are likely unique to your solution and have been built by the original developer(s) for your website.

    That said what you're trying to do doesn't sound out there! The error you're seeing is the DB moaning that you're trying to put too much text into a field. I'm afraid I suspect it's not going to be easy for this forum to fix it for you. I suspect there is an Umbraco package and/or an old version bug causing an issue but without looking at it I'm only guessing.

    The quick get workaround would be edit your template directly (this is the HTML code that contains various document type (the data fields) references. Think of it as a blueprint where the data is injected in - all you need to do is just add your extra twitter fields below the existing one.

    To do this look under Settings > Templates

    There is probably a template called Master and underneath "Home" or "Homepage" etc... somewhere in there will the area where your twitter field code is output. Add your extra bits underneath there (I suggest you copy and paste a copy of this before you save any changes!!).

    If I'm missing the mark and you know what you're doing then I suggest posting the Umbraco version and any "social" packages you've got and perhaps someone else here will recognise the error and fix the issue properly?

  • Colin Sales 9 posts 92 karma points
    Sep 08, 2015 @ 09:35
    Colin Sales
    0

    I am indeed new Steve... keen but inexperianced. You were correct about the Homepage under templates. The only option I seem to have is to edit the code, but I can't make much sense of it (below). I can see mention of Tweets but can't see what I might be able to copy and duplicate.

    I hope I'm not being too naive!

    Thanks again, Colin

    @inherits UmbracoTemplatePage @{ Layout = "umbLayout.cshtml"; }

    <div class="bannerContainer">
        <section class="welcomeBanner">
            <div class="container">
                <div class="welcomeBannerRow1"><p>@Umbraco.Field("welcomeMessage")</p></div>
                <div class="transbox"><p>@Umbraco.Field("featureMessage")</p></div>
            </div>                  
        </section>
    </div>
    
    <section>                
            <div class="boxes">
                <div class="container">
                    @{ Html.RenderPartial("3C-homePageFeature"); }                    
                </div>
            </div>        
    </section>
    
    <article class="news-article">
        <section class="fullOuter">
            <div class="container">
                <div class="news-section">
                    <div class="item1">                 
                        <div>
                            <a class="btn" href="/news/">View all news</a>
                        </div>
                        <div class="heading">
                            Latest 3c News and Tweets
                        </div>
    
                        <div class="break"></div>
    
                    </div>
                            @{Html.RenderPartial("umbLatestNewsWidget");}
                </div>
            </div>
        </section>
    </article>                  
    
    <section class="features-outer">
        <div class="container">
            <div class="features">
                <h2>Featured work</h2> 
                <div class="features-item1">
                    <p><img [email protected]("featureWorkImage") /></p>
                    <p class="featureWorkTitle">@Umbraco.Field("featureWorkTitle")</p>
                    <div class="btnWrapper">
                        <a class="btn" href="@Umbraco.Field("featureWorkLinkToPage")">View project</a>
                    </div>
                </div>
            </div>
    
            <div class="features">
                <h2>Meet the team</h2>
                <div class="features-item2">
                    <p class="teamimage"> <img [email protected]("meetTheTeamImage") /></p>
                    <p class="teamtext">@Umbraco.Field("meetTheTeamTitle") <br><br></p>
                    <div class="btnWrapper">
                        <a class="btn" href="@Umbraco.Field("meetTheTeamLinkToPage")">Go</a>
                    </div>
                </div>
            </div>
        </div>
    </section>
    
  • Steve Morgan 1348 posts 4457 karma points c-trib
    Sep 08, 2015 @ 10:03
    Steve Morgan
    0

    Hi,

    OK the bad news is that the magic is happening in a Partial view called umbLatestNewsWidget.

    This will be located as a file under /Views/Partials/umbLatestNewsWidget.cshtml - you'd need file access on the server to get to this (e.g. not via the Umbraco backend).

    The alternative is to replace this RenderPartial call @{Html.RenderPartial("umbLatestNewsWidget");} with a replacement PartialMacro which you can create and edit under Umbraco - you'd also have to replicate the logic to output the other news panels (unless you're planning to totally replace these too?).

    At this point I'd suggest you pause and go through some of the starter documentation / videos to learn these concepts or perhaps you might want to consider getting a freelancer in to add this for you?

    Kind regards

    Steve

  • Nik 1608 posts 7234 karma points MVP 7x c-trib
    Sep 08, 2015 @ 10:15
    Nik
    0

    Hi,

    I do believe you should actually be able to access the file umbLatestNewsWidget,cshtml from the back end of Umbraco. It should be under the Settings menu on the left. Then in "Partial Views". This maps the the directory /Views/Partials on the server and so should show all files within it. If the file isn't showing then you should be able to do "reload nodes" to make it appear.

    If you can see the file, then do as you did before and paste the contents here for us to try and help.

    Nik

  • Colin Sales 9 posts 92 karma points
    Sep 08, 2015 @ 10:31
    Colin Sales
    0

    Thanks Both,

    Nik - Below is the code under the umbSocial view. I can see the @Renderlink that corresponds to the Twitterlink on the Social Home page. Am I able to copy, insert, paste and save the line of code to create another Twitter box on the Social Home page? Many thanks

    @inherits UmbracoTemplatePage @{ // Model.Content is the current page that we're on // AncestorsOrSelf is all of the ancestors this page has in the tree // (1) means: go up to level 1 and stop looking for more ancestors when you get there // First() gets the first ancestor found (the home page, on level 1) var homePage = CurrentPage.AncestorsOrSelf(1).First(); }

    Get in touch

      @RenderLinkIfNotEmpty(homePage.FacebookLink, "facebook", "Facebook") @RenderLinkIfNotEmpty(homePage.TwitterLink, "twitter", "Twitter") @RenderLinkIfNotEmpty(homePage.RssLink, "rss", "RSS") @RenderLinkIfNotEmpty(homePage.DribbbleLink, "dribbble", "Dribbble") @RenderLinkIfNotEmpty(homePage.LinkedinLink, "linkedin", "Linked In") @RenderLinkIfNotEmpty(homePage.GoogleLink, "googleplus", "Google+")

    @helper RenderLinkIfNotEmpty(dynamic link, string cssClass, string linkName) { // A helper function is handy when you have to do the same thing over and over again // So now we only have to write the "if" check and list item once, and we only need // to put in the things that can vary

    if (string.IsNullOrEmpty(link) == false)
    {
        <li><a href="@link" class="@cssClass">@linkName</a></li>
    }
    

    }

  • Nik 1608 posts 7234 karma points MVP 7x c-trib
    Sep 08, 2015 @ 10:44
    Nik
    0

    Hi Colin,

    We need to see the code from the umbLatestNewsWidget page, not the umbSocial view.

    Then we can see how the current set up is creating the widget on screen. From the look of the code you've pasted it would only show a "Follow Me" type of link.

    Nik

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Sep 08, 2015 @ 10:39
    Steve Morgan
    0

    Hi,

    Sorry - my mistake. When I saw Html.Partial I thought it was likely to be a Partial View rather than a Partial Macro - a brain freeze :)

    Nik is right (though under Developer not settings as you've found). Colin - you might need to tell us what you expect to see on the homepage - currently there are four panels under the Latest 3c News and Tweets heading - are you adding new ones, extending the height etc etc to fit more twitter feeds in?

    Steve

  • Colin Sales 9 posts 92 karma points
    Sep 08, 2015 @ 11:08
    Colin Sales
    0

    You guys are fantastic, thanks so much for your support and coming back so quickly.

    All I'm trying to achieve is more than one twitter feed showing in our Follow Us Tweets window on our homepage (i.e. my tweets and also my colleagues tweets). Currently only my tweets are displayed.

    Below is the code from the umLatestNewsWidget:

    @inherits UmbracoTemplatePage @{
    var homePage = CurrentPage.AncestorsOrSelf(1).First();
    var newsOverview = homePage.umbNewsOverviews.First();
    var newsItems = newsOverview.umbNewsItems.OrderBy("createDate").Take(3); int a =0; string inlineStyle = ""; }

    @foreach (var newsItem in newsItems){ switch (a) { case 0: inlineStyle ="background-color:#30538b"; break; case 1: inlineStyle ="background-color:#144074"; break; case 2: inlineStyle ="background-color:#30538b"; break;
    }
    if (a == 3 ){break;} a++;

    @Umbraco.Truncate(newsItem.BodyText, 50, true, false)

    }

    FOLLOW US!

    @*Start to replace the twitter time line script*@ @*Tweets by

    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    *@ Tweets by 3C_Consultants
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    @*Finish to replace the twitter time line script*@

    3CIT | 2 hrs | View

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Sep 08, 2015 @ 11:57
    Steve Morgan
    0

    Hi Colin,

    Hard to read your code .. try to paste it into the forum using the code button { } as the forum messes it up otherwise.

    I think all you need to do is replace the twitter markup between the lines

    @*Start to replace the twitter time line script*@
    @*Finish to replace the twitter time line script*@
    

    To generate a feed with multiple users I think you can use the search functionality - follow the example in the URL below and change the users CNN and dailyshow to your own.

    http://tinyurl.com/oyof8ub

    Just remember to backup the original in case this is wrong.

  • Colin Sales 9 posts 92 karma points
    Sep 08, 2015 @ 13:13
    Colin Sales
    0

    Here it is now inserted where is said Enter code here, so hopefully properly formatted Steve. The web link you sent me just showed a blank white page for some reason.

    @inherits UmbracoTemplatePage
    

    @{
    var homePage = CurrentPage.AncestorsOrSelf(1).First();
    var newsOverview = homePage.umbNewsOverviews.First();
    var newsItems = newsOverview.umbNewsItems.OrderBy("createDate").Take(3); int a =0; string inlineStyle = ""; }

    @foreach (var newsItem in newsItems){ switch (a) { case 0: inlineStyle ="background-color:#30538b"; break; case 1: inlineStyle ="background-color:#144074"; break; case 2: inlineStyle ="background-color:#30538b"; break;
    }
    if (a == 3 ){break;} a++;

    @Umbraco.Truncate(newsItem.BodyText, 50, true, false)

    }

    FOLLOW US!

    @*Start to replace the twitter time line script*@ @*Tweets by

    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    *@ Tweets by 3C_Consultants
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
    @*Finish to replace the twitter time line script*@

    3CIT | 2 hrs | View

  • Colin Sales 9 posts 92 karma points
    Sep 08, 2015 @ 13:15
    Colin Sales
    0

    Could I also ask, when I add/change code, how do I save it? There is no save button on these screens.

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Sep 08, 2015 @ 13:35
    Steve Morgan
    100

    Hi,

    Ahh.. you need to amend your own widget - that was a link to mine I think.

    Don't copy and add the code - what you want to do (I think?) is to have the same twitter field but with a few accounts in the same feed?!

    Goto https://twitter.com/settings/widgets/

    Then click the Search - in the Search Query field enter

    from:duffaSteve OR from:umbraco
    

    Swapping the user names for the two accounts you want (or append OR from:xx for more)

    As for the Save button it should be in the top right?!

  • Colin Sales 9 posts 92 karma points
    Sep 08, 2015 @ 14:45
    Colin Sales
    0

    I think you may have cracked it Steve. So sorry I have been barking up the wrong tree!!

    Thank you so much for persevering with me. Colin

  • Steve Morgan 1348 posts 4457 karma points c-trib
    Sep 08, 2015 @ 14:55
    Steve Morgan
    0

    Blimey - I've just realised - that means you can then just amend that in the Umbraco back end!

    Oh well at least you've had a good tour of how your site works and of couse Umbraco!

    Well done for cracking it! If you could select one of the answers that steered you the right way as a solution it will mark this as solved in case anyone else searches for it.

  • Colin Sales 9 posts 92 karma points
    Sep 08, 2015 @ 15:20
    Colin Sales
    1

    Done it. Many thanks again. Colin

Please Sign in or register to post replies

Write your reply to:

Draft