Dynatree extra attribute - php

I'm using dynatree and generating my dynatree out of json.
Is it possible that I've an extra attribute (data_key) in my fields so I can work with the dynatree with my PHP as well? I want a hover effect on the icons from the dynatree, the pop-up that is coming up, needs to have some data of the "hovered" node.
Somebody an answer?

Custom properties that you add to the JSON child array will be copied to node.data.
So if you pass [{"title": "node 1", "myAttr": "foo"}, ...] you can accesss it like node.data.myAttr.

Related

Mediawiki should react to dynamic created content

I have an extension that dynamically creates content for some pages.
E.g. I have creates headlines with the <html> <h1>, <h2> and <h3>.
I want my mediawiki to react to the headline tags to create a directory dynamically.
I already tried using == in the specific tags in my extension, but mediawiki simply creates the string which will be displayed.
How can I achieve my goal?
Thanks in advance.
Are you hooking to ParserFirstCallInit?
You may need to parse the wikitext that you're returning, before returning it. Use something like $out = $parser->recursiveTagParse( "== Wikitext here ==" );
Alternatively, if you just want to return raw HTML, you can return an array of the form [ 0 => $outputHtml, 'isHTML' => true ].
I'm not sure what you mean by "create a directory dynamically" but if you're just trying to create HTML in a wikipage then the above should work.

How to display recursive xml tree (expandable) with php/jquery like browsers do?

I have the following complex xml source (example at : http://www.fluffyduck.com.au/sampleXML.xml) if it is viewed within a browser, the parent/child method of being displayed = perfect
this is exactly what I am after. However I need to display it within a webpage recursively using php and be able to retrieve each attribute in a table / tree format that is expandable.
I'm tried jstree to no success, jquery.treetable no success, converting to xslt no success.
I am sure it is my lack of experience with these tools, however there must be a way to manipulate the data and display it in a working expandable tree method like chrome does when viewing the above link.
thanks for your help everyone
-- edit to include some sample code :
after multiple tests and no luck, i've gone back to basics using examples from jstree page, utilising xml sample from above link, I had to remove all code above the first tag.
then rename all tags to to conform to jstree requirements, doing this seems to display the correct tree, but no data.
so I then just inserted after the first 3 records test1 etc test2 / test3 but only the first name along side the arrow is displayed.
$(function () {
$("#demo2").jstree({
"xml_data" : {
"ajax" : {
"url" : "../moo.xml"
},
"xsl" : "nest"
},
"plugins" : [ "themes", "xml_data" ]
});
});
The problem here resulted in the source that was supplying the XML to me.
I could not modify it.
but when i manually edited the file so the header was
and the main node was
followed by each records node being
it started to work, i now just need to work out how to do that automatically.

CakePHP HTML Helper: image within a link gets escaped?

Updating from Cake 1.2 to 1.3 and I have an image nested in a link element, both generated by the HTML helper. The nested image's markup is however escaped from < to > ect. I know the HTML helper now escapes stuff by default, but I can't get it to change this behavior.
This is the code generating an example image link:
$html->link($html->image('icons/small/navigation-back.gif', array('alt'=>"Move Left", 'border'=>"0"))
,'#',array('id'=>'options_left'), array('escape'=>false))
I added the array('escape'=>false) bit from the official Cake documentation (part of the $options array), but I still get escaped image tags. Is the order set wrong or did more change than I'm aware of? The original code is straight from cake 1.2.
the third parameter is the options array:
$html->link($html->image('icons/small/navigation-back.gif', array('alt'=>"Move Left", 'border'=>"0"))
,'#',array('id'=>'options_left', 'escape'=>false))

Help me to find $htmlOption Description in Yii

I searched in API without success.
There is an incomplete description of the keys of $htmlOption.
I am particularly interested in some public methods like "fileField($model, $attribute, $htmlOptions=array ())" and others of class CActiveForm.
In general, the $htmlOptions array is described by the HTML element being generated. The array is literally the "attributes" of the HTML element. The keys are the attributes names. So if you are generating an image with CHtml::Image then "src" is a valid $htmlOption key. If you generating a CHtml::Link, then "href" is a valid $htmlOption key.
If you look in the documentation, the description for $htmlOptions parameter of the CHtml::link() element is:
additional HTML attributes. Besides normal HTML attributes, a few special attributes are also recognized (see clientChange and tag for more details.)
I usually use the $htmlOptions array to add classes, IDs or styles to an HTML element, like so:
<?php echo CHtml::link("Click Me","http://stackoverflow.com",array("id"=>"myId","class"=>"class1 class2","style"=>"color: #f00;")); ?>
This would render the following code:
Click Me
There are a couple of extra "special" AJAX options that Yii allows in the $htmlOptions array for some elements (link, button, and a few others). They let you create AJAX links, add JS confirm popups, etc. These options are described here:
http://www.yiiframework.com/doc/api/CHtml#clientChange-detail
For the fileField element, you can look up the relevant attributes here which will be allowed in the $htmlOptions array.

Output HTML in XML Attribute

I am attempting to display HTML information in an attribute of a XML document. For example, I somehow want to accomplish the following:
Attributes:
id = "id"
HTML_Elements = {
link
}
(<something id='id' HTML_Elements='code'></something>)
I am wondering if there is some way to accomplish displaying the code directly inside of the attribute without having to link to it on another page.
Thanks for any help!
XML attributes may not contain HTML.
See Chapter 3.3.3 Attribute Value Normalization in the XML 1.0 Specs

Categories