Hello,

Here is an example of what you could do.

Cheers,

Philippe

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml";>
<wml>
<%@ page import="org.jahia.data.*" %>
<%@ page import="org.jahia.data.fields.*" %>
<%@ page import="org.jahia.data.containers.*" %>
<%@ page import="org.jahia.exceptions.*" %>
<%@ page import="org.jahia.gui.*" %>
<%@ page import="org.jahia.params.*" %>
<%@ page import="org.jahia.utils.JahiaTools" %>
<%@ page import="java.util.*" %>
<%!
/**
* Remove all html &gt;tags&lt; except BR tag
* @param str Input string (html code).
* @return Output string
*/
public String removeTags (String str)
{
if (str == null) {
return null;
}
str = JahiaTools.replacePattern(str,"\n<br>","--br--");
StringBuffer result = new StringBuffer(str.length());
int startIndex = 0;
int i = str.indexOf("<");
while (i != -1){
result.append(str.substring(startIndex,i));
i = str.indexOf(">",i);
if (i != -1){
startIndex = i + 1;
}
i = str.indexOf("<" , startIndex);
}
str = result.append(str.substring(startIndex,str.length())).toString();
str = JahiaTools.replacePattern(str,"--br--","<br/>");
return str;
}
%>
<%
JahiaData jData = (JahiaData) request.getAttribute("org.jahia.data.JahiaData");
if(jData == null) {
HashMap tempEngineMap = (HashMap) request.
getAttribute("org.jahia.engines.EngineHashMap");
jData = (JahiaData) tempEngineMap.get("jData");
}
boolean isRealBrowser = jData.gui().isIE(request) || jData.gui().isNS(request);
response.setContentType("text/vnd.wap.wml");
%>
<card id="MainCard" title="<%=jData.gui().getHomePage().getTitle()%>">
<p><img src="http://www.jahia.org/images/jahia.wbmp"; alt="Jahia Logo"/><br/>
<%
// card is used to generate the sub cards
StringBuffer card = new StringBuffer("");
int anchor = 0;
String anchorStr = "";
JahiaContainerList pressList = jData.containers().
getAbsoluteContainerList("press", jData.gui().getLevelID( 1 ) );
Enumeration pressEnumeration = pressList.getContainers();
while (pressEnumeration.hasMoreElements()){
anchor++;
// we keep only the 3 first news
JahiaContainer press = (JahiaContainer)pressEnumeration.nextElement();
if (anchor < 3){
String date1 = removeTags(press.getFieldValue("date1","");
String title = removeTags(press.getFieldValue("title","");
String content = removeTags(press.getFieldValue("content","");
// now we display the index
%> <%=date1%> <a href="#c<%=anchor%>"><%=title%></a><br/>
<%
try {
anchorStr = Integer.toString(anchor);
} catch (NumberFormatException nfe) {
anchorStr = "";
}
card.append("<card id=\"c" + anchorStr + "\" title=\"" + title + "\">\n");
card.append(" <p><b>" + title + "</b><br/>\n");
card.append(" " + date1 + "<br/>\n");
card.append(" " + content + "</p>\n");
card.append(" <p><a href=\"#MainCard\">Back</a></p>\n");
card.append("</card>\n");
}
}
%>
</p>
</card>
<%=card.toString()%>
</wml>


At 13.07.2004 09:25, you wrote:
hi,

I would like to enter content on a web site and have prepared a template for that. let's say we are talking about news articles in a list. up to this point I don't have any problem but I would also like to make the news articles available to users via WAP. how can I reuse the same content and make the WML-pages known to Jahia so that I can few them on a mobile device!?

I have checked the Jahia page for any info but I could only find the entries in the wish list. is it already possble to use more than the WEB access channel?

TIA,

Aaron

_________________________________________________________________
Sorgen Sie daf�r, dass Sie Ihre Messenger-Nachrichten auch unterwegs erhalten! http://www.msn.at/msnmobile/

-------=[ pvollenweider at jahia dot com ]=--------- Jahia : A collaborative source CMS and Portal Server www.jahia.org Community and product web site www.jahia.com Commercial services company




Reply via email to