For issues related to the current stable release please use it's own Help forum.
IMPORTANT:Please read this before using an git or nightly build version: wiki.webtrees.net/en/GIT

Before asking for help please read "How to request help" by clicking on that tab above here.

TOPIC: Add a Special ID in the BODY tag of a unique page

Add a Special ID in the BODY tag of a unique page 6 days 13 hours ago #1

  • pfelix
  • pfelix's Avatar
  • Offline
  • New
  • Posts: 8
Hi all,
I want to create a new page with external jscripts.
How can I call these scripts in my header ? Wich file do I have to customize to help me :
  1. Call external Jscripts only in this page ?
  2. Load a special ID in the BODY Tag (ex : <body id="geocode">)

My theme is F.A.B
Do I have to add a php condition in the "webtrees\app\Theme\FabTheme.php to indicate :
If WT_SCRIPT_NAME = 'TheNameOfMyPage.php' Then .....


I am a bit confused and lost in that architecture.
Thanks for your help !
The administrator has disabled public write access.

Add a Special ID in the BODY tag of a unique page 6 days 9 hours ago #2

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Posts: 11357
You have asked a question in the 2.0 forum, but you mention WT_SCRIPT_NAME, which exists only in webtrees 1.7.

2.0 and 1.7 are completely different. Which version are you using?
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net
The administrator has disabled public write access.

Add a Special ID in the BODY tag of a unique page 5 days 23 hours ago #3

  • pfelix
  • pfelix's Avatar
  • Offline
  • New
  • Posts: 8
Oups !!
I use the 1.7 .... sorry
The administrator has disabled public write access.

Add a Special ID in the BODY tag of a unique page 5 days 21 hours ago #4

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Posts: 11357
> 1. Call external Jscripts only in this page ?
> 2. Load a special ID in the BODY Tag (ex : <body id="geocode">)

Just put your javascript in your page?

i.e. TheNameOfMyPage.php will look like this:
<?php
namespace Fisharebest\Webtrees;
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
define('WT_SCRIPT_NAME', 'TheNameOfMyPage.php');
require './includes/session.php';
$controller = new PageController;
$controller->setPageTitle(I18N::translate('This is my custom page'));
$controller->pageHeader();
?>
<p>my page....</p>
<script>
document.body.id="geocode";
<script>
<script src="URL of my external script"/>
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net
The administrator has disabled public write access.
Powered by Kunena Forum