Typoscript change menu parameter - typo3

I want to generate a menu which changes by a parameter "menu". All menu items have the same pid, therefore the parameter overrideId is set.
So the problem is, the active state doesn't change because I don't change the page. You can see the current script in action via innovisions.artec-berlin.de. It's the menu on the left side.
For some reason the typoscript worked fine in 4.5.2 LTS but not in 4.6.3. Any suggestions or ideas?
lib.menu_main {
# Level 1
1 = TMENU
1.noBlur = 1
1.overrideId = 95
1.expAll = 1
1.wrap = <ul id="outer">|</ul>
1.NO = 1
1.NO.additionalParams.stdWrap.override.insertData = 1
1.NO.additionalParams.stdWrap.override = &menu={field:uid}
1.NO.ATagBeforeWrap = 1
1.NO.insertData = 1
1.NO.linkWrap = <img src="fileadmin/templates/images/arrow_menu.gif" alt="Arrow" title="Arrow" />
1.NO.wrapItemAndSub.insertData = 1
1.NO.wrapItemAndSub = <li id="x1 menu_{field:uid}" class="first>|</li> |*| <li id="xx1 menu_{field:uid}">|</li> |*| <li id="xxx1 menu_{field:uid}" class="last">|</li>
1.NO.ATagTitle.field = subtitle // title
1.ACT = 1
1.ACT.additionalParams.stdWrap.override.insertData = 1
1.ACT.additionalParams.stdWrap.override = &menu={field:uid}
1.ACT.ATagBeforeWrap = 1
1.ACT.linkWrap = <img src="fileadmin/templates/images/arrow_menu.gif" alt="Arrow" title="Arrow" />
1.ACT.wrapItemAndSub.insertData = 1
1.ACT.wrapItemAndSub = <li id="x2 menu_{field:uid}" class="first_active">|</li> |*| <li id="xx2 menu_{field:uid}" class="active">|</li> |*| <li id="xxx2 menu_{field:uid}" class="last">|</li>
1.ACT.ATagTitle.field = subtitle // title
1.CUR = 1
1.CUR.additionalParams.stdWrap.override.insertData = 1
1.CUR.additionalParams.stdWrap.override = &menu={field:uid}
1.CUR.ATagBeforeWrap = 1
1.CUR.linkWrap = <img src="fileadmin/templates/images/arrow_menu.gif" alt="Arrow" title="Arrow" />
1.CUR.wrapItemAndSub.insertData = 1
1.CUR.wrapItemAndSub = <li id="x3 menu_{field:uid}" class="first_active">|</li> |*| <li id="xx3 menu_{field:uid}" class="active">|</li> |*| <li id="xxx3 menu_{field:uid}" class="last_active">|</li>
1.CUR.ATagTitle.field = subtitle // title
# Level 2
2 = TMENU
2.noBlur = 1
2.overrideId = 95
2.expAll = 1
2.wrap = <ul id="inner">|</ul>
2.NO = 1
2.NO.additionalParams.stdWrap.override.insertData = 1
2.NO.additionalParams.stdWrap.override = &menu={field:uid}
2.NO.wrapItemAndSub.insertData = 1
2.NO.wrapItemAndSub = <li id="1 menu_{field:uid}" class="first">|</li> |*| <li id="11 menu_{field:uid}">|</li> |*| <li id="111 menu_{field:uid}" class="last">|</li>
2.NO.ATagTitle.field = subtitle // title
2.ACT = 1
2.ACT.additionalParams.stdWrap.override.insertData = 1
2.ACT.additionalParams.stdWrap.override = &menu={field:uid}
2.ACT.wrapItemAndSub.insertData = 1
2.ACT.wrapItemAndSub = <li id="2 menu_{register:count_HMENU_MENUOBJ}" class="first">|</li> |*| <li id="22 menu_{field:uid}" class="active">|</li> |*| <li id="222 menu_{field:uid}" class="last">|</li>
2.ACT.ATagTitle.field = subtitle // title
2.CUR = 1
2.CUR.additionalParams.stdWrap.override.insertData = 1
2.CUR.additionalParams.stdWrap.override = &menu={field:uid}
2.CUR.wrapItemAndSub.insertData = 1
2.CUR.wrapItemAndSub = <li id="3 menu_{field:uid}" class="first">|</li> |*| <li id="33 menu_{field:uid}" class="active">|</li> |*| <li id="333 menu_{field:uid}" class="last">|</li>
2.CUR.ATagTitle.field = subtitle // title
}

Related

leaflet map does not centre correct

Hopefully somebody can help me to centre correct. I'm not sure were the problem comes from, because it seems that the problem only exist on the PC screen and on my mobile screen it is correct.
After I resize the size of the browser window the markers are centred correct. But how to do that automatic?
The problem is shown since I updated from leaflet 0.7 to 1.0.3
On the map are shown several markers and polylines. At the end I try to fit the markers with:
map.fitBounds(myBounds,{maxZoom:10});
map.invalidateSize();
myBounds are the bounds of the markers.
var myBounds = pline2.getBounds();
To test I made this pline between all added markers:
var marker = L.marker(".$event->getLatLonJSArray().", { icon: myIcon, title: '".$title."'}).addTo(map);
pline2.addLatLng(".$event->getLatLonJSArray().");
The map is not centred to the bounds, but the centre is more north from the markers. If zoomed in to much the markers are even out of the viewbox.
If I do invalidateSize() before fitBounds the picture look as underneath. Also than it's corrected afted I resize the browserwindow.
Who can help me with the correct code for centring the map?
Thanks for reaction!
The complete taken from the browser development tools:
<script>
var MapData = 'Map data © OpenStreetMap contributors';
var Imagenary = ' | Imagery © Mapbox';
var osm = L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
attribution: MapData,
maxZoom: 18
});
var mapbox = L.tileLayer('//{s}.tiles.mapbox.com/v3/oddityoverseer13.ino7n4nl/{z}/{x}/ {y}.png',
{
attribution: MapData + Imagenary,
maxZoom: 18
});
var map = L.map('osm-map'); //.fitWorld().setZoom(10);
osm.addTo(map);
var baseLayers = {
'Mapbox': mapbox,
'OpenStreetMap': osm
};
L.control.layers(baseLayers).addTo(map);
var pline2 = L.polyline([], {color: "black"});var polyline = L.polyline([], {color: 'red', opacity:'0.6'});
var myHtml = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-icon-svg" width="25" height="50"><path class="svg-icon-path" d="M 0.5 13 C 0.5 25 12.5 20 12.5 49.5 C 12.5 20 24.5 25 24.5 12.5 A 6.25 6.25 0 0 0 0.5 12.5 M 2.5 12.5 A 10 10 0 0 1 22.5 12.5 A 10 10 0 0 1 2.5 12.5 Z" stroke-width="1" stroke="red" fill="red"></path></svg>';
var myIcon = L.divIcon({className: 'my-div-icon icon-resi', iconSize: [25,50], iconAnchor: [12.5,50], popupAnchor: [0,-50], html: myHtml });
var marker = L.marker([52.16201,4.50147], { icon: myIcon, title: ' hij zelf: Paulus Dircksz Planjer (–) | Woonplaats: 8 augustus 1650 — Leiden'}).addTo(map);
marker.bindPopup('<span class="label"><i class="icon-selected"></i> hij zelf: </span><span class="NAME" dir="auto" translate="no">Paulus Dircksz <span class="SURN">Planjer</span></span> (<span title=""></span>–<span title=""></span>)<div class="fact_RESI"><span class="label">Woonplaats:</span> <span class="field" dir="auto"><span class="date">8 augustus 1650</span> — <span title="Leiden, Zuid-Holland, Nederland" dir="auto">Leiden</span></span></div>');
polyline.addLatLng([52.16201,4.50147]);
pline2.addLatLng([52.16201,4.50147]);
polyline.addTo(map);
var myHtml = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-icon-svg" width="25" height="50"><path class="svg-icon-path" d="M 0.5 13 C 0.5 25 12.5 20 12.5 49.5 C 12.5 20 24.5 25 24.5 12.5 A 6.25 6.25 0 0 0 0.5 12.5 M 2.5 12.5 A 10 10 0 0 1 22.5 12.5 A 10 10 0 0 1 2.5 12.5 Z" stroke-width="1" stroke="red" fill="red"></path></svg>';
var myIcon = L.divIcon({className: 'my-div-icon icon-resi', iconSize: [25,50], iconAnchor: [12.5,50], popupAnchor: [0,-50], html: myHtml });
var marker = L.marker([52.1624538,4.5015904], { icon: myIcon, title: ' hij zelf: Paulus Dircksz Planjer (–) | Woonplaats: 28 juni 1669 — Leiden'}).addTo(map);
marker.bindPopup('<span class="label"><i class="icon-selected"></i> hij zelf: </span><span class="NAME" dir="auto" translate="no">Paulus Dircksz <span class="SURN">Planjer</span></span> (<span title=""></span>–<span title=""></span>)<div class="fact_RESI"><span class="label">Woonplaats:</span> <span class="field" dir="auto"><span class="date">28 juni 1669</span> — <span title="Leiden, Zuid-Holland, Nederland" dir="auto">Leiden</span></span></div>');
polyline.addLatLng([52.1624538,4.5015904]);
pline2.addLatLng([52.1624538,4.5015904]);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'blue', opacity:'0.6'});
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'green', opacity:'0.6'});
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'purple', opacity:'0.6'});
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'orange', opacity:'0.6'});
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'darkred', opacity:'0.6'});
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'salmon', opacity:'0.6'});
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'beige', opacity:'0.6'});
var myHtml = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-icon-svg" width="25" height="50"><path class="svg-icon-path" d="M 0.5 13 C 0.5 25 12.5 20 12.5 49.5 C 12.5 20 24.5 25 24.5 12.5 A 6.25 6.25 0 0 0 0.5 12.5 M 2.5 12.5 A 10 10 0 0 1 22.5 12.5 A 10 10 0 0 1 2.5 12.5 Z" stroke-width="1" stroke="beige" fill="beige"></path></svg>';
var myIcon = L.divIcon({className: 'my-div-icon icon-birt', iconSize: [25,50], iconAnchor: [12.5,50], popupAnchor: [0,-50], html: myHtml });
var marker = L.marker([52.15890,4.49268], { icon: myIcon, title: 'Dochter: Dina Paulusdr Planjer (1661–) | Gedoopt: 6 februari 1661 — Leiden'}).addTo(map);
marker.bindPopup('<span class="label">Dochter: </span><span class="NAME" dir="auto" translate="no">Dina <span class="SURN">Paulusdr Planjer</span></span> (<span title="6 februari 1661">1661</span>–<span title=""></span>)<div class="fact_CHR"><span class="label">Gedoopt:</span> <span class="field" dir="auto"><span class="date">6 februari 1661</span> — <span title="Leiden, Zuid-Holland, Nederland" dir="auto">Leiden</span></span></div>');
polyline.addLatLng([52.15890,4.49268]);
pline2.addLatLng([52.15890,4.49268]);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'darkblue', opacity:'0.6'});
var myHtml = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-icon-svg" width="25" height="50"><path class="svg-icon-path" d="M 0.5 13 C 0.5 25 12.5 20 12.5 49.5 C 12.5 20 24.5 25 24.5 12.5 A 6.25 6.25 0 0 0 0.5 12.5 M 2.5 12.5 A 10 10 0 0 1 22.5 12.5 A 10 10 0 0 1 2.5 12.5 Z" stroke-width="1" stroke="darkblue" fill="darkblue"></path></svg>';
var myIcon = L.divIcon({className: 'my-div-icon icon-birt', iconSize: [25,50], iconAnchor: [12.5,50], popupAnchor: [0,-50], html: myHtml });
var marker = L.marker([52.15890,4.49268], { icon: myIcon, title: 'Zoon: Jacobus Paulusz Planjer (1662–) | Gedoopt: 12 maart 1662 — Leiden'}).addTo(map);
marker.bindPopup('<span class="label">Zoon: </span><span class="NAME" dir="auto" translate="no">Jacobus <span class="SURN">Paulusz Planjer</span></span> (<span title="12 maart 1662">1662</span>–<span title=""></span>)<div class="fact_CHR"><span class="label">Gedoopt:</span> <span class="field" dir="auto"><span class="date">12 maart 1662</span> — <span title="Leiden, Zuid-Holland, Nederland" dir="auto">Leiden</span></span></div>');
polyline.addLatLng([52.15890,4.49268]);
pline2.addLatLng([52.15890,4.49268]);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'darkgreen', opacity:'0.6'});
var myHtml = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-icon-svg" width="25" height="50"><path class="svg-icon-path" d="M 0.5 13 C 0.5 25 12.5 20 12.5 49.5 C 12.5 20 24.5 25 24.5 12.5 A 6.25 6.25 0 0 0 0.5 12.5 M 2.5 12.5 A 10 10 0 0 1 22.5 12.5 A 10 10 0 0 1 2.5 12.5 Z" stroke-width="1" stroke="darkgreen" fill="darkgreen"></path></svg>';
var myIcon = L.divIcon({className: 'my-div-icon icon-birt', iconSize: [25,50], iconAnchor: [12.5,50], popupAnchor: [0,-50], html: myHtml });
var marker = L.marker([52.15890,4.49268], { icon: myIcon, title: 'Zoon: Paulus Planjer (1664–) | Gedoopt: 23 maart 1664 — Leiden'}).addTo(map);
marker.bindPopup('<span class="label">Zoon: </span><span class="NAME" dir="auto" translate="no">Paulus <span class="SURN">Planjer</span></span> (<span title="23 maart 1664">1664</span>–<span title=""></span>)<div class="fact_CHR"><span class="label">Gedoopt:</span> <span class="field" dir="auto"><span class="date">23 maart 1664</span> — <span title="Leiden, Zuid-Holland, Nederland" dir="auto">Leiden</span></span></div>');
polyline.addLatLng([52.15890,4.49268]);
pline2.addLatLng([52.15890,4.49268]);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'cadetblue', opacity:'0.6'});
var myHtml = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-icon-svg" width="25" height="50"><path class="svg-icon-path" d="M 0.5 13 C 0.5 25 12.5 20 12.5 49.5 C 12.5 20 24.5 25 24.5 12.5 A 6.25 6.25 0 0 0 0.5 12.5 M 2.5 12.5 A 10 10 0 0 1 22.5 12.5 A 10 10 0 0 1 2.5 12.5 Z" stroke-width="1" stroke="cadetblue" fill="cadetblue"></path></svg>';
var myIcon = L.divIcon({className: 'my-div-icon icon-birt', iconSize: [25,50], iconAnchor: [12.5,50], popupAnchor: [0,-50], html: myHtml });
var marker = L.marker([52.15890,4.49268], { icon: myIcon, title: 'Zoon: Paulus Planjer (1666–) | Gedoopt: 7 februari 1666 — Leiden'}).addTo(map);
marker.bindPopup('<span class="label">Zoon: </span><span class="NAME" dir="auto" translate="no">Paulus <span class="SURN">Planjer</span></span> (<span title="7 februari 1666">1666</span>–<span title=""></span>)<div class="fact_CHR"><span class="label">Gedoopt:</span> <span class="field" dir="auto"><span class="date">7 februari 1666</span> — <span title="Leiden, Zuid-Holland, Nederland" dir="auto">Leiden</span></span></div>');
polyline.addLatLng([52.15890,4.49268]);
pline2.addLatLng([52.15890,4.49268]);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
var polyline = L.polyline([], {color: 'darkslateblue', opacity:'0.6'});
var myHtml = '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="svg-icon-svg" width="25" height="50"><path class="svg-icon-path" d="M 0.5 13 C 0.5 25 12.5 20 12.5 49.5 C 12.5 20 24.5 25 24.5 12.5 A 6.25 6.25 0 0 0 0.5 12.5 M 2.5 12.5 A 10 10 0 0 1 22.5 12.5 A 10 10 0 0 1 2.5 12.5 Z" stroke-width="1" stroke="darkslateblue" fill="darkslateblue"></path></svg>';
var myIcon = L.divIcon({className: 'my-div-icon icon-birt', iconSize: [25,50], iconAnchor: [12.5,50], popupAnchor: [0,-50], html: myHtml });
var marker = L.marker([52.15890,4.49268], { icon: myIcon, title: 'Zoon: Johannes Planjer (1669–) | Gedoopt: 14 april 1669 — Leiden'}).addTo(map);
marker.bindPopup('<span class="label">Zoon: </span><span class="NAME" dir="auto" translate="no">Johannes <span class="SURN">Planjer</span></span> (<span title="14 april 1669">1669</span>–<span title=""></span>)<div class="fact_CHR"><span class="label">Gedoopt:</span> <span class="field" dir="auto"><span class="date">14 april 1669</span> — <span title="Leiden, Zuid-Holland, Nederland" dir="auto">Leiden</span></span></div>');
polyline.addLatLng([52.15890,4.49268]);
pline2.addLatLng([52.15890,4.49268]);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
polyline.addTo(map);
pline2.addTo(map);var myBounds2 = pline2.getBounds();map.fitBounds(myBounds2,{maxZoom:10});
map.invalidateSize();
</script>
Could not reproduce your issue outside of your framework (Webtrees.net?):
http://playground-leaflet.rhcloud.com/huto/1/edit?html,output
What may happen is that your map container size is adjusted several times before and after your code runs.
The fact that everything works fine when you resize your browser window is indeed a very good indicator that Leaflet could not retrieve the correct map container size, and you were probably right trying to execute map.invalidateSize(). However your map container still changes size before and after that, since changing your map view does not results in expected view.
A blind workaround could be to execute the size invalidation and map view change after some delay, hoping that your framework settles down your map container size in the meantime.
setTimeout(function () {
map.invalidateSize();
map.fitBounds(myBounds2, {
maxZoom: 10
});
}, 500); // Adjust the value (in ms)
Of course the proper resolution would be to make sure if the issue comes indeed from map container size being changed, then how to know once the size reaches its final state, and execute the above code at that moment.
If this does not solve your issue, even when using a long delay (like a few seconds), then the issue might be different.
BTW: your new screenshot shows some sort of tabs at the top. In that case, make sure you run invalidateSize after your tab is revealed, and change again the map view after that.
See: Data-toggle tab does not download Leaflet map

TYPO3 Menu: Repeat parent link in first child

I want to repeat the parent of a navigation as the first child of its child.
Example:
PARENT 1
-- Parent 1
-- Child 1
-- Child 2
---- Subchild 1
---- Subchild 2
-- Child 3
PARENT 2
-- Parent 2
-- Child 1
-- Child 2
-- Child 3
As this should only be the case in one menu, hence manually adding page links is not an option.
My current TypoScript is as follows.
lib.mainmenu = HMENU
lib.mainmenu {
1 = TMENU
1.expAll = 1
1.NO.stdWrap.htmlSpecialChars = 1
1.NO.wrapItemAndSub = <li class="menuopener">|</li>
1.ACT < .NO
1.ACT = 1
1.ACT.wrapItemAndSub = <li class="menuopener active">|</li>
2 < .1
2.wrap = <ul>|</ul>
2.NO.wrapItemAndSub = <li>|</li>
2.ACT.wrapItemAndSub = <li class="active">|</li>
3 < .1
3.wrap = <ul>|</ul>
3.NO.wrapItemAndSub = <li>|</li>
3.ACT.wrapItemAndSub = <li class="active">|</li>
}
Thanks!
So I found a solution, adapted from here:
lib.mainmenu = HMENU
lib.mainmenu.entryLevel = 0
lib.mainmenu {
1 = TMENU
1 {
expAll = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <li class="menuopener">|</li>
stdWrap.htmlSpecialChars = 1
accessKey = 1
}
IFSUB < .NO
IFSUB = 1
IFSUB {
wrapItemAndSub = <li class="menuopener">|</li>
linkWrap= |
ATagParams =
ATagBeforeWrap = 1
stdWrap.htmlSpecialChars = 1
}
ACTIFSUB < .IFSUB
ACTIFSUB {
wrapItemAndSub = <li class="menuopener active">|</li>
}
ACT < .NO
ACT = 1
ACT {
wrapItemAndSub = <li class="active">|</li>
}
CURIFSUB < .IFSUB
CURIFSUB = 1
CURIFSUB {
wrapItemAndSub = <li class="active">|</li>
}
}
# second level
2 = TMENU
2.stdWrap.wrap.stdWrap.cObject = COA
2.stdWrap.wrap.stdWrap.cObject {
10 = TEXT
10.typolink.parameter = {field:pid}
10.typolink.parameter.insertData = 1
10.wrap = <ul><li>|</li>
20 = TEXT
20.value = |</ul>
}
2{
expAll = 1
NO{
ATagTitle.field = title
wrapItemAndSub = <li>|</li>
}
IFSUB = 1
IFSUB{
ATagTitle.field = title
wrapItemAndSub = <li>|</li>
}
}
3 < .1
3.wrap = <ul>|</ul>
3.NO.wrapItemAndSub = <li>|</li>
3.ACT.wrapItemAndSub = <li class="active">|</li>
}

How to get Hocr output using python-tesseract

I had been getting really good results using pytesseract but it is not able to preserve double spaces and they are really important for me.
And, so i decided to retrieve hocr output rather than pure text.But;there doesn't appear to be any way of specifying config file using pytessearct.
So, is it possible to specify cofiguration file using pytesseract or is there some default config file that i can change to get hocr output?
#run method from pytessearct.py
def run_tesseract(input_filename, output_filename_base, lang=None, boxes=False, config=None):
'''
runs the command:
`tesseract_cmd` `input_filename` `output_filename_base`
returns the exit status of tesseract, as well as tesseract's stderr output
'''
command = [tesseract_cmd, input_filename, output_filename_base]
if lang is not None:
command += ['-l', lang]
if boxes:
command += ['batch.nochop', 'makebox']
if config:
command += shlex.split(config)
#command+=['C:\\Program Files (x86)\\Tesseract-OCR\\tessdata\\configs\\hocr']
#print "command:",command
proc = subprocess.Popen(command,
stderr=subprocess.PIPE)
return (proc.wait(), proc.stderr.read())
You can use this another library to use Tesseract in Python: pyslibtesseract
Image:
Code:
import pyslibtesseract
tesseract_config = pyslibtesseract.TesseractConfig(psm=pyslibtesseract.PageSegMode.PSM_SINGLE_LINE, hocr=True)
print(pyslibtesseract.LibTesseract.simple_read(tesseract_config, 'phrase0.png'))
Output:
<div class='ocr_page' id='page_1' title='image ""; bbox 0 0 319 33; ppageno 0'>
<div class='ocr_carea' id='block_1_1' title="bbox 0 0 319 33">
<p class='ocr_par' dir='ltr' id='par_1_1' title="bbox 10 13 276 25">
<span class='ocr_line' id='line_1_1' title="bbox 10 13 276 25; baseline 0 0"><span class='ocrx_word' id='word_1_1' title='bbox 10 14 41 25; x_wconf 75' lang='eng' dir='ltr'><strong>the</strong></span> <span class='ocrx_word' id='word_1_2' title='bbox 53 13 97 25; x_wconf 84' lang='eng' dir='ltr'><strong>book</strong></span> <span class='ocrx_word' id='word_1_3' title='bbox 111 13 129 25; x_wconf 79' lang='eng' dir='ltr'><strong>is</strong></span> <span class='ocrx_word' id='word_1_4' title='bbox 143 17 164 25; x_wconf 83' lang='eng' dir='ltr'>on</span> <span class='ocrx_word' id='word_1_5' title='bbox 178 14 209 25; x_wconf 75' lang='eng' dir='ltr'><strong>the</strong></span> <span class='ocrx_word' id='word_1_6' title='bbox 223 14 276 25; x_wconf 76' lang='eng' dir='ltr'><strong>table</strong></span>
</span>
</p>
</div>
</div>
This worked for me :)
from pytesseract import pytesseract
pytesseract.run_tesseract('image.png', 'output', lang=None, boxes=False, config="hocr")
where : image.png is the image file besides this python file. The output file named output.hocr will be generated next to these files. Open this file in text editor to see the hocr output.
Just add hocr at the end of your command like this
tesseract input_filename output_filename_base hocr
Output file will be a html file
I've edited krozaine's answer:
import pytesseract
pytesseract.run_and_get_output('image.jpg', 'hocr', lang=None, config="hocr")

"sectionIndex" only returns headlines in the first content element

if i set "sectionIndex = true", in the menu only the headlines of the first backend element are shown. But i need all headlines of this page.
This is the code of the dropdownmenu:
2 = TMENU
2 {
wrap = <ul class="dropdown-menu" role="menu">|</ul>
noBlur = 1
expAll = 0
sectionIndex = true
NO = 1
NO.allWrap >
NO.wrapItemAndSub = <li>|</li>
CUR = 1
CUR < .NO
CUR.wrapItemAndSub = <li class="active current">|</li>
ACT = 1
ACT < .NO
ACT.wrapItemAndSub = <li class="active">|</li>
IFUSB < .1.IFSUB
CURIFSUB < .1.CURIFSUB
ACTIFSUB < .1.ACTIFSUB
SPC = 1
SPC.doNotLinkIt = 1
SPC.doNotShowLink = 1
SPC.allWrap = <li class="divider"></li>
}
can anybody help me?
Thanks!
If any have the same problem:
i have found the answer. You have to add this column:
sectionIndex.useColPos = -1

Is there a solution for integrating the tt_news AMENU into my existing HMENU?

My menu structure should be in this format
PressRelease (in the page tree)
Archive (in the page tree)
- Press releases 2012 (from the tt_news archive)
- Press releases 2011 (from the tt_news archive)
This is my HMENU
lib.sidebarmenu = COA
lib.sidebarmenu {
10 = HMENU
10 {
entryLevel = 1
1 = TMENU
1 {
expAll = 1
noBlur = 1
stdWrap.cObject = COA
stdWrap.cObject {
10 = HMENU
10 {
special = rootline
special.range = 1|1
wrap = <h2>|</h2>
1 = TMENU
1.NO.doNotLinkIt = 0
}
20 = HMENU
20 {
entryLevel = 1
1 = TMENU
1 {
expAll = 1
noBlur = 1
NO {
ATagTitle.field = subtitle//title
ATagParams = class="sidebarNav"
stdWrap.htmlSpecialChars = 1
wrapItemAndSub = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li class="active"> | </li>
}
}
2 < .1
2.wrap = <ul id="submenu">|</ul>
3 < .2
4 < .2
}
}
wrap = <ul class="tabs"> | </ul>
NO {
}
}
}
}
This is my AMENU
[PIDinRootline = 55]
lib.newsArchiveMenu < plugin.tt_news
lib.newsArchiveMenu {
code >
code = AMENU
pid_list >
pid_list = 42,61,63
singlePid = 44
archiveTypoLink.parameter =55
catImageMode = 0
catTextMode = 0
archiveMode = year
archiveTitleCObject {
10 = TEXT
10.field = start
10.strftime =%Y
}
}
Yes, just put your tt_news menu as next element of COA object (probably just before the end of [PIDinRootline = 55] condition:
lib.sidebarmenu.30 < lib.newsArchiveMenu