TinyButStrong - the PHP Template Engine
Categories > OpenTBS general LibreOffice >

How can I insert style-name at tag of sub block items?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Hedwig
Date: 2013-04-09
Time: 22:56

How can I insert style-name at tag of sub block items?

Hi!

I use openTBS to generate a libreoffice document from a php source and would like to know how I can assign a style-name attribute (which differs from tag to tag) to a created tag inside a sub block.

Here is my template:
[arbeitgeber;block=begin;sub1=projekte;][arbeitgeber.von] - [arbeitgeber.bis]    [arbeitgeber.name;magnet=text:span], [arbeitgeber.ort;magnet=text:span;]
[arbeitgeber.beruf;magnet=text:p;]
[arbeitgeber.abteilungs_gruppe;magnet=text:p;]
[arbeitgeber_sub1;block=begin;bmagnet=text:p][arbeitgeber_sub1.text][arbeitgeber_sub1.ebeneMitPunkt;att=#text:style-name]
[arbeitgeber_sub1;block=end;]
[arbeitgeber;block=end;]

That is how the objects look like:
array(8) {
  ["name"]=> "Unternehmen"
  ["ort"]=> "Berlin"
  ["beruf"]=> "Beruf"
  ["abteilungs_gruppe"]=>  ""
  ["ueberlasser"]=> ""
  ["von"]=> "2011"
  ["bis"]=> "2012"
  ["projekte"]=>
  array(2) {
    [0]=>
    array(4) {
      ["styleName="]=>
      string(8) "Standard"
      ["ebeneMitPunkt"]=>
      string(8) "Standard"
      ["ebene"]=>
      string(1) "0"
      ["text"]=>
      string(35) "Flashen und Vorbereiten der Targets"
    }
    [1]=>
    array(4) {
      ["styleName="]=>
      string(8) "Standard"
      ["ebeneMitPunkt"]=>
      string(8) "Standard"
      ["ebene"]=>
      string(1) "0"
      ["text"]=>
      string(30) "Testen der Navigationssoftware"
    }
  }
}

The result inside content.xml is:
<text:p text:style-name="P66"><text:span text:style-name="T11">Testen der Navigationssoftware<text:span text:style-name="Standard"></text:span></text:p>

I expect following result:
<text:p text:style-name="text:style-name="Standard"">Testen der Navigationssoftware</text:p>

What am I doing wrong? Can anyone help me? :(

Thanks in advance, Hedwig
By: Skrol29
Date: 2013-04-10
Time: 02:47

Re: How can I insert style-name at tag of sub block items?

Hi Hedwig,

When you specify "att=#text:style-name", this will move the TBS field in to the attribute "text:style-name" of first element on the left.
In you case, I guess your text is split into several <text:span> and it goes on the first one.

You can precise the target element in parameter "att", just like this :
att=text:p#text:style-name

But take care that your text is still encapsulated into other <text:span> that may force the style.
By: Hedwig
Date: 2013-04-10
Time: 07:19

Re: How can I insert style-name at tag of sub block items?

Hi Skrol29,

Thanky for your answer. I tried it and get following error messages inside apache/error.log + a blank page:

PHP Notice:  Undefined property: clsTbsLocator::$AttForward in /srv/www/htdocs/persoc_development/lib/vendor/tbs_us/tbs_class.php on line 1045
PHP Notice:  Undefined property: clsTbsLocator::$AttInsLen in /srv/www/htdocs/persoc_development/lib/vendor/tbs_us/tbs_class.php on line 1048
PHP Notice:  Undefined property: clsTbsLocator::$PrevPosBeg in /srv/www/htdocs/persoc_development/lib/vendor/tbs_us/tbs_class.php on line 1076

Why isn't this working as expected???

Thanks for your help, Hedwig
By: Hedwig
Date: 2013-04-10
Time: 13:05

Re: How can I insert style-name at tag of sub block items?

I resolved the issue by inserting an return after the text and before the attribute.

Next problem is: How can I define some of the sub block elements (decisions comes from database) as list-element and some not?

Thx, Hedwig