Posts tagged ‘Lectora’

Adding content to the head of Lectora HTML output

There’s the possibility to add an “external HTML object”. If you choose “header scripting”, your content would be added to the <script> section of Lectora in the header. In most cases that’s not what you want to achieve. There’s another strange option “Top of file scripting” which simply inserts your content just before the <!DOCTYPE> tag. The only use I can see for this is for PHP scripting which needs to be done before any output was sent to the browser (i.e. header modification).

What you want to choose to include arbitrary content to the <HEAD> section of Lectora generated HTML documents is the “META Tag” option. Unfortunately, this does not allow to include external .txt files, so you have to paste your code in Lectora’s input window. (You would have needed to update the .txt file anyways, as Lectora stays with the initial .txt file version instead of updating it from the hard disk every time. That way it’s not really a big loss that you can’t use .txt files.)

And there IS a way to include a file’s contents in the header. Just drop a PHP file somewhere on your server and include it using the following as a “meta tag”:

<?php include(‘your/path/to/header.php’);?>

Lectora and unterminated string literals

Sometimes Lectora renders the HTML, and you end up with broken pages. You start trying to disable things, sometimes it works, sometimes it doesn’t.

My advice: first use Firefox’ error console to find out what the error is about. Sometimes it’s an “unterminated string literal“:

VarAktuellerKapitelname.set( ‘El modelo biopsicosocial integrativo de la CIF

‘ )

You can solve this problem by patching the file and re-copying it over the output when rendering. (Of course you have to keep track of whether the page gets updated …)

Here’s the correct version of this line of code:

VarAktuellerKapitelname.set( ‘El modelo biopsicosocial integrativo de la CIF’ )

Easy, huh? The real challenge lies in tracking the little files … Well, why don’t you make it our problem? We’ll solve Lectora problems for you – ask for our competitive rates!