How to use navtitle from parent topicref instead of child one during generating pdf by dita-ot - dita

I'm using dita-ot tool to convert dita to pdf.
I have parent ditamap file like this:
<topicref href="111.ditamap" navtitle="Parent title 111" format="ditamap">
...
</topicref>
<topicref href="222.ditamap" navtitle="Parent title 222" format="ditamap">
...
</topicref>
and 2 child ditamap files
111.ditamap:
<topicref navtitle="Child title 111" format="ditamap">
Child content 111
</topicref>
222.ditamap:
<topicref navtitle="Child title 222" format="ditamap">
Child content 222
</topicref>
In the result pdf I have somth. like this:
...
Child title 111
Child content 111
Child title 222
Child content 222
...
but I'd like to have this:
...
Parent title 111
Child content 111
Parent title 222
Child content 222
How can I achieve it?

A reference to a DITA Map is transparent in the table of contents, it does not add an extra title and level to it.
What you want could be achieved like:
<topichead navtitle="Parent title 111">
<topicref href="111.ditamap" format="ditamap">
...
</topicref>
</topichead>
Regards,
Radu

Yes, another possibility would be that in your main DITA map you could refer to your secondary map like:
<topicref href="secondary.ditamap" format="ditamap">
...
</topicref>
and the secondary.ditamap would have only one first level topicreference like:
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<title>DITA Topic Map</title>
<topicref href="installation.dita">
<topicref href="linux-installation.dita"/>
..........
</topicref>
</map>

Related

Fetching dynamic id and url from image with JS

I'm implementing a fancybox into my project and I'm writing a script to automatically wrap an anchor around the images with the url to the image and a "data-fancybox" attribute to let the fancybox script do its thing. However, I'm only getting the url to the very first image, since they all share the same class. There is a dynamic figure id that seems to be the one to get.
My question is - how do I use this figure id to fetch the appropriate img src?
The html is like this:
<figure id="XXXXXXX">
<div>
<img src="image.jpg" />
</div>
</figure>
... other stuff ...
<figure id="YYYYYYY">
<div>
<img src="image2.jpg" alt="">
</div>
</figure>
My code right now is as follows (which works, but only returns the first image url):
$(document).ready(function() {
var src = $("figure img").attr("src");
var a = $("<a/>").attr( { href:src , "data-fancybox":"" } );
$("figure img").wrap(a);
});
I know I can use
var id = $("figure").attr("id");
to get the id I need, but I'm pretty new to coding so I'm not sure how I implement this and use it to get the correct url. Any help is appreciated!
If your goal is to make your images clickable, then you can do smth like this:
$('figure img').each(function() {
$(this).parent().css({cursor: 'pointer'}).attr('data-fancybox', 'gallery').attr('data-src', this.src);
});
DEMO - https://jsfiddle.net/1jznsL7x/
Tip: There is no need to create anchor elements, you can add data-fancybox and data-src attributes to any element and it will work automagically.

TYPO3: pass variable to typoscript via cObject?

I would like to create a dropdown login form in my menu, like in this example: http://bootsnipp.com/snippets/featured/fancy-navbar-login-sign-in-form
I have this cObject that calls typoscript for the navigation:
<f:cObject typoscriptObjectPath="menu.navbar" />
I need to get the content of the login form somehow into the menu typoscript. Is it maybe possible to pass a variable (in my case the login form) to typoscript via cObject ?
f:cObject has a data Attribute, that can take different kind of values.
Usually the data attribute takes an array and you then can use those values to render content objects using the .field properties in typoscript.
An example:
lib.testFluid = COA
lib.testFluid {
wrap = <div>|</div>
10 = TEXT
10.field = title
10.wrap = <b>|</b>
20 = TEXT
20.field = content
}
If you have TypoScript like that, a data array, that has the keys title and content is expected. Rendering such a content object would possibly look like this in fluid:
<f:cObject typoscriptObjectPath="lib.testFluid" data="{title: 'Hello World', content: 'Foobar'}" />
However, if you just have some "content" (e.g. string content) and want to output it at one place in your content object, you can pass it in as-is and use the .current property in TypoScript to let it use the "current value".
lib.testFluid = COA
lib.testFluid {
wrap = <div>|</div>
10 = TEXT
10.current = 1
10.wrap = <b>|</b>
}
And in fluid:
<f:cObject typoscriptObjectPath="lib.testFluid" data="simple text content" />
or
<f:cObject typoscriptObjectPath="lib.testFluid">simple text content</f:cObject>
Of course data also takes normal variables. Depending on your use case, one of those cases might be what you want.
Edit: However, it seems to be a bit more complicated, if you want to use data together with an HMENU. The nested TMENU instances (or other menus) have different data values because it's being overwritten by HMENU with the current page for that menu entry. You probably have to do some convoluted wrapping, or avoid inserting the desired content in a TMENU/GMENU et cetera. I suggest to instead render the menu completely with fluid in that case.
Edit 2 - Example
Something like this is not going to work:
lib.testFluid = HMENU
lib.testFluid {
special = directory
special.value = 1
wrap = <ul>|</ul>
1 = TMENU
1 {
NO.stdWrap.cObject = COA
NO.stdWrap.cObject {
10 = TEXT
10.field = title
10.noTrimWrap = || |
20 = TEXT
20.current = 1
}
}
}
20.current = 1 won't include the value from data supplied by the fluid viewhelper, because the "data" of TMENU has been changed to the current page by the HMENU content object.
However, it should be possible to wrap a COA or similar around the HMENU to insert the desired content somewhere around the HMENU.

Orchard Microdata Breadcrumbs

I am trying to add microdata to Orchard CMS 1.8.1 breadcrumbs.
I need to add itemprop="child" to breadcrumbs.cshtml taken from /Core/Shapes/Views of which I added to my theme views folder. I works fine but it does not display the itemprop="child", I added as .Itemprop.Add("child") to the below breadcrumbs code.
But the child attribute does not show up
#{
// Model is Model.Menu from the layout (Layout.Menu)
var tag = Tag(Model, "ul");
tag.AddCssClass("breadcrumb");
var items = (IList<dynamic>)Enumerable.Cast<dynamic>(Model.Items);
if(items.Any()) {
items[0].Classes.Add("first");
items[items.Count - 1].Classes.Add("last").Itemprop.Add("child");
}
}
<nav itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
#tag.StartElement
#* see MenuItem shape template *#
#DisplayChildren(Model)
#tag.EndElement
</nav>
I have added to MenuItemLink.cshtml in my theme views folder which gives me all the microdata for breadcrumbs but the child attribute.
<a itemprop="url" href="#Model.Href"><span itemprop="title">#Model.Text</span></a>
How or where can I add the itemprop="child" to orchard and get it working as everything is added by
#DisplayChildren(Model).
change
items[items.Count - 1].Classes.Add("last").Itemprop.Add("child");
to
items[items.Count - 1].Classes.Add("last");
items[items.Count - 1].Attributes.Add("itemprop", "child");
items[items.Count - 1] - it is Shape class. Classes - it is IList<string> collection classes for shape.
Attributes - it is IDictionary<string, string> collection attributes for shape.

Create a subpart menu for a one page template in typo3

I integrate a one page parallax template in typo 3 in this i want to get a menu like below so i can access specific content on click , in a subpart of page object.
<ul class="nav navbar-nav navbar-right">
<li>HOME</li>
<li>ABOUT</li>
<li>PRICING</li>
<li>CONTACT</li>
<li>Call: +23-689-90 </li>
</ul>
Try
temp.contentnav = CONTENT
temp.contentnav {
table = tt_content
select {
pidInList = this
orderBy = sorting
where = colPos=0
languageField=sys_language_uid
}
renderObj = TEXT
renderObj {
field = header
wrap=|
typolink.parameter.field=pid
typolink.parameter.dataWrap=|#{field:uid}
if.isTrue.field=header
}
}
So you will get an menu of all items. Then again, you won't like that the menu item's title is taken from the header field. If your site is very small and you keep control over it, why don't you just hardcode this (look at the source, by default, each article has an id).
PS I copied that from http://www.typo3wizard.com/en/snippets/menus/content-element-navigation.html
EDIT on your getting started with TS question:
In your HTML Template:
<html>...
<!-- ###CONTENTNAV### START --><!-- ###CONTENTRIGHT### END -->
...</html>
In your TypoScript setup:
page.10.subparts {
# we fill the "subpart" (that's how this type of marker is called) with the temp object
CONTENTNAV < temp.contentnav
}
So the caret pointing left tells TYPO3 that in that region ("subpart"), it should add the content menu you've created with the TS snippet.
Note that you can also use "Marks" (###CONTENTNAV###, don't need start and end commentary, assign with page.10.marks) and the more modern fluid templates (<f:format.html>{contentnav}</f:format.html>), which are the future. You could start here: http://typo3buddy.com/typo3-template-tutorial/fluid/

Custom Element Preset => Form Field: Images

I tried to create a typo3 template with a special div-tag.
The editors should have the possibility to add images to the page-element. The goal should be the following code:
<div id="special_div_tag_in_template">
<img src="first_image_from_editor_in_page_element.png" />
<img src="second_image_from_editor_in_page_element.png" />
<img src="third_image_from_editor_in_page_element.png" />
</div>
Is there a possibility to create a custom element preset / form field?
I hope some one has a hint how to solve with this problem.
Thanks, Andreas
You can use the media field of the page properties:
lib.headerImage = COA
lib.headerImage {
wrap = <div id="special_div_tag_in_template">|</div>
10 = IMAGE
10 {
file {
import = uploads/media/
import {
field = media
listNum = 0
}
// set the dimensions if you want
height = 200
width = 100m
}
}
// create a copy and select 2nd image
20 < .10
20.file.import.listNum = 1
// create a copy and select 3rd image
30 < .10
30.file.import.listNum = 2
}
Take a look at the TYPO3 Wiki for more examples of header images.
A different approach would be to create DS/TO in TemplaVoila and insert this as a flexible content element (FCE)