This Help forum is for issues relates to the latest release (1.1.x). For issues related to beta or svn version please use their own Help forum.
When requesting help please provide as much information as possible. Explain what version of webtrees, PHP and MYSQL you are using. If possible provide a URL to your site so we can see the problem first-hand.
Tip: Think about putting these details in your signature, so it appears in the footer of ALL your messages
  • Page:
  • 1

TOPIC: HTML Scripts in HTML Block

HTML Scripts in HTML Block 8 years 11 months ago #1

  • Boomn4x4
  • Boomn4x4's Avatar Topic Author
  • Visitor
  • Visitor
Is there a way to get scripts to work in an HTML box?

I'd like to add a facebook comments box, but it dosen't seem to render: Below is an example
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="example.com" num_posts="2" width="500"></fb:comments>

Please Log in or Create an account to join the conversation.

Re: HTML Scripts in HTML Block 8 years 11 months ago #2

  • ToyGuy
  • ToyGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Live like it's Christmas every day - Santa Stephen
  • Posts: 4925
You may wish to review this thread, as well:
sourceforge.net/projects/phpgedview/foru...185165/topic/3909086
Santa Stephen the Fabled Santa
Latest webtrees at MyArnolds.com
Hosted by webtreesonline.com , a division of GeneHosts LLC
MacOS 10.6.8, Apache 2.2+, PHP 5.4.16, MySQL 5.5.28

Please Log in or Create an account to join the conversation.

Re: HTML Scripts in HTML Block 8 years 11 months ago #3

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 12924
Blocks that are quick to generate are generated inline.
Blocks that are slow to generate are fetched asynchronously using AJAX.

The HTML block frequently contains embedded statistics or other blocks which are slow - hence this block loads via AJAX.

You cannot load (and execute) JavaScript using AJAX. It does not get executed.

(Also - we don't want to encourage our users to add JavaScript into their own pages - another reason for loading this block via AJAX.)

Your options include:

1) Add the JavaScript to the footer (or a custom theme). You can use the WT_SCRIPT_NAME to only emit the JavaScript on the index.php page.

2) Change the HTML block to load synchronously (a simple code change - look for the canLoadAjax() function)

3) There is a module called something like "custom javascript" in the addons area, which allows you to add JavaScript to the footer. This is something that may eventually be part of the core code, but it needs the existing code to be refactored to use it.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum