Output HTML in XML Attribute - php

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

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 can I update an element property using simple_html_dom

Id like to update the 'src' attribute of an img tag using Simple HTML DOM. Ive got his at the top of the php file (join.php) which contains the img file:
include_once("simplehtmldom/simple_html_dom.php");
$htmldomOb = file_get_html('join.php');
$htmldomOb->find('img[id=imgtapchat]', 0)->src = './tapchat/clss_tapcht-1.php';
echo $htmldomOb;
This works but outputs the entire page again since i read in the entire page dom object. How can i just update the image src similar to how it is done in jQuery - As it says in the SimpleHTMLDOM site docs
Find tags on an HTML page with selectors just like jQuery
With thanks
I use PHP Dom extension to rewrite PHP Simple Dom, just finished. You can try it here.
http://shinbonlin.github.io/html-parser/

In Dynamic contents, complete all the incompleted html tags with jQuery

I want to check all those elements in my page which are not enclosed within the html tags properly. for example i have the following scenario:
This is the picture of my village <img src="path_to_image" <br> some other text.....
Here in the above string in the page which also contained the tag after the image tag in the string and want to complete it with jQuery.
Please also note that the contents are displayed on my page from mysql database table.
Any help will be appreciated. thanks
try and run your markup through a validator:
https://validator.w3.org/

Dynatree extra attribute

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.

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.

Categories