ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Not able to publish page with FB/Twitter code inside

November 18, 2011 6:38am

Subscribe [6]
  • #1 / Nov 18, 2011 6:38am

    bmpire

    27 posts

    Hello,

    New EE user here!  I am really enjoying the product, however I am unable to publish content when I include the following code in my page from facebook/twitter.  When I click save at the bottom it takes me to the live homepage of my website, however if I remove this specific code then I am able to save the page just fine.  Any/all feedback would be much appreciated! 

    <!—Facebook/Twitter Likebox Code—>
    <div id=“fb-root”></div>
    [removed](function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = “//connect.facebook.net/en_US/all.js#xfbml=1”;
      fjs[removed].insertBefore(js, fjs);
    }(document, ‘script’, ‘facebook-jssdk’));[removed]

    [removed][removed]
    <!—End Facebook/Twitter Likebox Code—>

  • #2 / Nov 18, 2011 3:12pm

    Barrel

    92 posts

    Are you using the original code with script tags?

  • #3 / Nov 18, 2011 10:01pm

    bmpire

    27 posts

    Yes, I used the original code that both twitter and Facebook provided for the like buttons.

    Any ideas?

  • #4 / Nov 19, 2011 9:12am

    bmpire

    27 posts

    I have encountered this same error again on pages without this specific code in it. 

    When I click to save the template, it loads the following link: 

    http://www.faithology.com/admin.php?S=13103238538a00d8d01a857b5c1f0b179f9cdd3a&D=cp&C=design&M=update_template&tgpref=4

    Then when I go back to the template, the template file is empty???

     

  • #5 / Nov 19, 2011 9:40am

    bmpire

    27 posts

    I am trying to copy this (static) webpage directly into a template in EE.  When I click save it takes me to the link in my above post and the template remains blank??

    http://www.faithology.com/religions/christianity/biographies/god.php

    I am checked the html with the w3c html validator and everything passed so I am not sure what is causing this issue?

    Thank you for your help!

    Brandon

  • #6 / Nov 19, 2011 9:58am

    Mark Bowen

    12637 posts

    This could well be a mod_security issue. You’ll need to check with your host to see if anything in the text is causing some kind of security restriction to be taking place here.

    Best wishes,

    Mark

    P.S. - Answered to your other related issue here too - http://ellislab.com/forums/viewthread/204848 It’s best to not post lots of threads about the same problem here though/

  • #7 / Nov 19, 2011 11:50am

    bmpire

    27 posts

    Mark,

    I checked the mod_security, and now I am able to save the file.  Thank you for that suggestion!

    However, expression engine is now removing the twitter/facebook code when saving the file.  Do I need to be saving these files in a separate javascript template instead of in the main webpage template?  Thank you.

    Here is the code:

    <!—Facebook/Twitter Likebox Code—>
    <div id=“fb-root”></div>
    [removed](function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = “//connect.facebook.net/en_US/all.js#xfbml=1”;
      fjs[removed].insertBefore(js, fjs);
    }(document, ‘script’, ‘facebook-jssdk’));[removed]

    [removed][removed]
    <!—End Facebook/Twitter Likebox Code—>

  • #8 / Nov 20, 2011 12:37pm

    Sean C. Smith

    3818 posts

    BMPIRE,

    Could you post your code again but wrap it in

    [code][ /code]

    tags. Also the script tags will not display properly in this forum until you add a space between the bracket and the word script like so < script>

    One other thing to check when pasting your code into templates from another site is to see if you are using curly quotes or strait quotes.

    Sean

  • #9 / Nov 21, 2011 9:18am

    bmpire

    27 posts

    Sean,

    Here is the code and thank you for your help!

    <!--Facebook/Twitter Likebox Code-->
    <div id="fb-root"></div>
    < script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) {return;}
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
      fjs[removed].insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));< /script>
    
    < script src="//platform.twitter.com/widgets.js" type="text/javascript">< /script>
    <!--End Facebook/Twitter Likebox Code-->
  • #10 / Nov 22, 2011 3:33pm

    Kevin Smith

    4784 posts

    Hi BMPIRE,

    It looks like your code is still being removed, so let me ask you to do this instead. Post the exact code you’re trying to use in your templates to http://pastie.org and then paste the link back here for us to access it.

    Also, and as Mark noted above, it’s really not a good idea to post several threads for the same or very closely related issues. As of now, it appears you have at least 3 threads with the same issue, and our staff is helping you with similar issues in all three threads. Please allow us to help you best by concentrating the issues to a single thread. Since this thread appears to have been posted first, let’s concentrate on this one. I will close the others and direct any onlookers’ attention to this thread.

    I suspect there is something in your code that’s causing all of the problems you’ve laid out, and I want to try saving that exact same code in my installations to see if I can reproduce the issue.

    Thanks!

  • #11 / Nov 22, 2011 4:22pm

    bmpire

    27 posts

    Kevin,

    Thank you for your assistance.  In regards to multiple threads for the same issue, each thread is actually meant for a specific seperate issue(4 seperate problems I am having).
    Although they ended up running together as I mentioned other problems I was experiencing within the individual thread.  My apologies, as I could have kept them seperate or combined each of the issues into one thread.

    Here is my previous post( from another thread) outlining the issues I am experiencing.


    Dan,

    Thank you for the email.  I have a few open tickets for multiple issues that I am experiencing:

    I am going to post a recap here to better organize them into one area. 


    1.) In the Christianity template Group, attempting to edit any of the template names does work:

    For example I try to edit the art template : url ending with “C=design&M=edit_template&id=38”

    I open preferences, and change the name in the ‘template name’ field.

    Then I click update, however the page reloads with the initial template name… nothing changed?

     

     

    2.) Clicking “save template as a file” does not work:


    After I click update within the template, the template reloads and I get a note saying “unable to save your template as a text file.”


    3.) After clicking update on template page, some times the template will not save and I am taken to the index.php page of the website?: 

    I had the host white list all the mod_security instances they could find, thinking this may solve this issue?  Everything seems random.  Certain files will work and then spastically I will be unable to edit the file, and redirected to the index.php when clicking “update”.

    4.) Template will not save with the standard Facebook / twitter script code that is supposed to be places after the opening body tag.

    Below is the code I am attempting to save in the template:

    [removed][removed]

    Thank you for your support and helping me find a solution to the above issues.

  • #12 / Nov 23, 2011 9:43am

    bmpire

    27 posts

    Quick update:

    This morning I was able to rename a template, however I was unable to change it back or rename any other templates after this initial change.  It seems the EE system let me make one change and then reverted back to not allowing me to make changes?

    This is also the same for the FB/ Twitter code I have been experiencing issues with. 

    I was able to post the FB / Twitter code in the following template: http://www.faithology.com/christianity/history

    However, after this initial change/template update I was unable to make any additional changes or add the exact same code to any other templates. 

  • #13 / Nov 23, 2011 2:49pm

    Robin Sowell

    13255 posts

    Heh- it took me too long to track that down!  2 issues:

    1. The path to ‘templates’ was wrong, which was jamming up saving templates as text files.  By default it’s located in system/expressionengine/templates so I just modified the template setting to be consistent with your structure and all looks good there.

    2. I tried to save with some example data you were having trouble with and couldn’t.  After a fair bit of testing- including putting up a test form named test_form.php it looks like a mod_security or similar issue.  In other words- your server won’t allow post data with the words ‘select from’ in it.  And probably some more words as well.  But try it on the test form- that is entirely outside of ee.  Put ‘hello’ in the form?  It will show ‘hello’ after you submit.  Put ‘select from’ in the form?  And you get… well, it looks like the front page, but the reason you’re getting it is the server is disallowing the post content.

    So- contact your host or server admin and let them know you need that turned off/modifed or every time you post something with ‘select’ and ‘from’ both in it- it’s not going to work.

    Does that make sense?  And does it do the trick for you?

  • #14 / Nov 23, 2011 3:22pm

    bmpire

    27 posts

    Robin,

    THANK YOU so much for your help in solving this issue. 

    I have contacted the host and am awaiting a response.  I will let you know if they need any additional information.

    Have a great thanksgiving!

    Brandon

  • #15 / Nov 23, 2011 3:24pm

    Robin Sowell

    13255 posts

    😉  Glad to help.  I’m going to leave this open- just to make sure that all is well once the host has a chance to do there thing.  Let us know how it shakes out after they’ve tweaked the settings.

    And you have a happy Thanksgiving too!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases