WAP Version of the Forum
Posted: 10 September 2006 04:36 PM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  281
Joined  11-22-2002

We had a user request a WAP version of our forums, so guess how I spent my Sunday afternoon?

I got it working and thought I’d share, in case anyone else ever feels compelled to approach it.

It uses the templating system not the forum templates.  I don’t know how to parse the pmcode properly, but your WAP users will probably appreciate it, even if it isn’t as pretty as it could be.

You can see it working here.

It is composed of three templates:

This first one uses the Recently posted as the launching point (Index page):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{lang}" lang="{lang}">
<
head>

<
title>WAP Forum - The Other Side of Kim du Toit</title>

<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<
link rel='stylesheet' type='text/css' media='all' href='{stylesheet=tos-shared/tos}' />
<
style type='text/css' media='screen'>@import "{stylesheet=tos-shared/tos}";</style>

</
head>

<
body>

<
h2>50 Recently Discussed</h2>



<
div id=wrappost>

<
font size="1">
<
table width="100%" border="1" cellspacing="0" cellpadding="6">

<
tr>

<
td  width="30%">Title</td>
<
td width="15%">Author</td>
<
td width="15%">Posted On</td>
<
td  width="5%">Posts</td>
<
td width="5%">Views</td>
<
td width="30%">Last Post Info</td>

</
tr>

{exp:forum:topic_titles orderby="recent_post" sort="desc" limit="50"}
<tr>
<
td valign="top"><a href="{path=wapforum/topic/}{topic_id}">{title}</a></td>
<
td valign="top"><a href="{profile_path=forums/member}">{author}</a></td>
<
td valign="top">{topic_date format="%m/%d/%Y %h:%i %a"}</td>
<
td valign="top">{post_total}</td>
<
td valign="top">{views}</td>
<
td valign="top">On: {last_post_date format="%m/%d/%Y %h:%i %a"} |
By: <a href="{last_author_profile_path=forums/member}">{last_author}</a>
</
tr>
{/exp:forum:topic_titles}

</table>
</
font>
</
div>

</
body>
</
html>

The second template displays the forum topic and includes an embed of the posts to that topic (template name: topic):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{lang}" lang="{lang}">
<
head>

<
title>WAP Forum - The Other Side of Kim du Toit</title>

<
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<
link rel='stylesheet' type='text/css' media='all' href='{stylesheet=tos-shared/tos}' />
<
style type='text/css' media='screen'>@import "{stylesheet=tos-shared/tos}";</style>

</
head>

<
body>


<
div id=wrappost>


{exp:query sql="SELECT t.topic_id AS topic_id, t.author_id AS topic_author_id, t.title AS title, FROM_UNIXTIME(t.topic_date,'%m/%d/%Y %h:%i %A') AS topic_date, FROM_UNIXTIME(t.last_post_date,'%m/%d/%Y') AS last_topic_date, t.thread_total, t.thread_views, t.body AS topic_body, f.forum_status, f.forum_permissions, m.screen_name AS author
FROM exp_forum_topics t, exp_forums f, exp_members m
WHERE t.forum_id = f.forum_id
AND t.author_id = m.member_id
AND t.topic_id = {segment_3}
"
}

<h1>{title}</h1>

<
b>Author:</b> {author}<br />
<
b>Date:</b> {topic_date}<br />
<
p>{topic_body}</p>

{/exp:query}

{embed
=wapforum/comments}

</div>

</
body>
</
html>

The third page is embedded in the above so be sure to rename the embed to whatever you are calling this one (template name: comments):

<br />
<
b>Responses:</b><br /><br />
<
table border="1" cellspacing="0" cellpadding="4">
<
tr>

<
td><center><font size="1">Author</font></center></td>
<
td><center><font size="1">Date Posted</font></center></td>
<
td><center><font size="1">Comment</font></center></td>


<
tr>

{exp:query sql="SELECT c.author_id AS comment_author_id, FROM_UNIXTIME(c.post_date,'%m/%d/%Y %h:%i %A') AS comment_date, c.body AS comment_body, m.screen_name AS comment_author
FROM exp_forum_posts c, exp_members m
WHERE c.author_id = m.member_id
AND c.topic_id = {segment_3}
ORDER BY comment_date ASC
"
}



<tr>
<
td valign="top">{comment_author}</td>
<
td valign="top">{comment_date}</td>
<
td valign="top"><p>{comment_body}</p></td>
</
tr>


{/exp:query}

</table>

I created a template group “wapforum” but you can do it anyway you want.  You’ll need to adjust the embeds and links based on how you name things.

Profile
 
 
Posted: 10 September 2006 04:47 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32856
Joined  05-14-2004

I hope you’ll consider adding this to the wiki. =)

 Signature 
Profile
MSG
 
 
Posted: 10 September 2006 04:59 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  281
Joined  11-22-2002

OK, done.

Profile
 
 
Posted: 10 September 2006 05:28 PM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32856
Joined  05-14-2004

Thank you, Connie.  I’m sure this will be useful to a great many people. =)

 Signature 
Profile
MSG
 
 
Posted: 26 May 2007 09:59 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  11-01-2002

VERY useful!

I’m setting this up right now, on my Danish PSP Forum-site - Denmarks largest PSP community actually - and this has been a user request for a long, long time.

Being able to use the forums, directly from a PSP - witch doesn’t have very advanced HTML capabilities by the way, Sony should get Opera to build them a browser - will be a much loved addition to our community, and I’ll let everybody know how it goes. Once again, Lisa has the solution and answer, to our every need smile

Thank you Lisa, for your continuous help and presence in these forums, and congrats on your more “official” status, you sure deserve it! smile

Profile
 
 
Posted: 26 May 2007 10:21 AM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32856
Joined  05-14-2004

Well you’re welcome, but it was Connie that did the work here, including the wiki portion. =)  I’m glad you found a solution here!

 Signature 
Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64905 Total Logged-in Users: 47
Total Topics: 81838 Total Anonymous Users: 29
Total Replies: 440032 Total Guests: 246
Total Posts: 521870    
Members ( View Memberlist )