HTML Template - XML - HTML - html

I'm working on a mailer system where I'm required to replace variables in html template with actual values in our database. Earlier, I was getting a plain HTML template where I was required to overwrite the variable's actual value from database to the template itself. However, I was not comfortable with it. I made the following suggestion that instead of whole HTML template, pass XML containing the attributes which we seek to replace with actual values from database(sort of RSS). Now I am finding a way to put the actual values found from the database to the original template. Let us take an example:
<html>
<body>
<div var="toxml">
<li>
PROFILEID(This will be a number)
NAME
AGE(etc.)
</li>
</div>
</body>
</html>
The XML which will be generated out of this will be
<PROFILEID val="Number">
<NAME></NAME>
<AGE></AGE>
</PROFILEID>
Now I will stuff in the values from database in this xml only(XML parsing tools are available for php).
Now my question is, how can I put the stuffed values in the XML back to the HTML template from which it came?

Related

Getting a HTML template as a HTML string

consider that I have several HTML templates and they have custom HTML tags. For ex: c-icon, c-text, c-button etc.
For some usecase(Display other content along with innerHTML), I need to access c-icon tag HTML inside c-text and append it to some text so that I can render it with some other html text. In future, I may have another component called c-badge and even I want to refer and render.
Could you please provide any suggestions for achieving the same?

How To create own Entity Code character in HTML

Is it possible to create custom Entity Code character in HTML ? as if i want to display space on web page so i have to Write but i want to create custom Entity Code like
first i set code admin = 'This is admin'
&admin; so it should display on page as 'This is admin'.
if it is possible so please help me for that.
Hi Dear,
I do not know if it is possible or not in HTML.
but you can create in XML.
Example :
First You have to write top of XML file.
<!DOCTYPE custome_code [
<!ENTITY admin "This is admin">
]>
Now you can use &admin; in any where in XML file.
It's not possible, unfortunately, in current browsers (see Using custom entities in HTML documents) - the list of HTML entities is usually fixed. Using a server-side templating language (PHP, ASP.NET, etc.) would allow you to do something similar with variables. E.g. with PHP:
<?php
$admin = 'This is admin';
?>
Lorem ipsum <?=$admin?> fillare emptimum spatium.
Or in javascript / jQuery you could set up placeholders like <span class="admin"></span> and then fill them using:
$('.admin').html('This is admin');

How can I convert an asterisk delimited text string to HTML using JSP?

I am working for a client who currently has their product attributes defined in a single textarea field in their CMS. The attributes are separated by asterisks (*)
e.g. * 100% cotton * Machine washable * Loose fit
I want to format these as an unordered list in html but WITHOUT the use of javascript or jQuery. They need to be rendered at JSP page load level.
Unfortunately, amendments to the CMS at this point are not possible for me.
Any suggestions?
Thanks to Alvaro, I used the following:
<c:set var="attribute" value="${product.attributes.value}"/>
<c:set var="attributeList" value="${fn:replace(attribute,'*', '<li>')}" />
<ul>
${attributeList}
</ul>

Alfresco html tag properties plain text search

I want to do plain text seach in html files.
It seems that properties values are not indexed.
if i have a html file containing tag like this <div property="property value"> Textual value </div> i can't found this file by searching property value.
Is there a way to make this possible ?
You need to define your own custom metadata extracter.You can fine more information on below link.
http://wiki.alfresco.com/wiki/Metadata_Extraction
For your requirement,
alfresco-community-sdk-3.4.b\src\alfresco-repository-src.zip\java\org\alfresco\repo\content\metadata\HtmlMetadataExtracter.java
Above is the class which is responsible for extracting data from the html file.If you see the content of that file it is neglecting tags and attributes inside tag.So you can take reference of above file and define your own Metadata Extractor

Emit raw html in ASP page?

This is extremely aggravating. I just want to simply insert raw html. I can't use the literal control because there's no ignoring the quote character. I don't want to use a script element because I'm adding it in a ascx file. I just want raw html output. Is there no operater for this?
I've properbly misunderstood you completely but:
In Classic ASP it is:
<%=("<div style=""color:red;"">html</div>")%>
output:
<div style="color:red;">html</div>