andrew_biggart Posted June 3, 2009 Share Posted June 3, 2009 Ok so i am trying to design a simple guestbook. I have managed to get the code working finally and i can display the information no problem without styling it. But im now trying to get it diisplayed in a table and this is the where the problem start. i want to display the information in the following table. <table style="width: 100%" cellspacing="0" cellpadding="0" class="cat"> <tr> <td colspan="3" class="header"> </td> </tr> <tr> <td rowspan="2" class="logo" style="height: 40px; width: 40px;" valign="top"> <img alt="Guestbook entry" src="Guesbook_Logo2.png" width="30" height="30" /></td> <td class="written">Written by : </td> <td class="writtenby">Name echoed here</td> </tr> <tr> <td class="subject" colspan="2">post echoed hear</td> </tr> </table> this si my read.js file <?php //Set no caching header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> var guestbook; window.addEvent('domready', function(){ guestbook = new GuestBook(); }); var GuestBook = new Class({ initialize: function(){ var req = new Request.JSON({ url: 'control.php?action=getPage', onSuccess: this.success }).send(); }, success: function(jArray){ jArray.each(function(post){ var post = new PostItem(post.id, post.name, post.comment); post.display().inject($('commentList')); }, this); } }); var PostItem = new Class({ initialize: function(id, name, comment){ this.id = id; this.name = name; this.comment = comment; }, display: function(){ var cont = new Element('td',{ 'class':'', 'id':'post'+this.id }); var title = new Element('td',{ 'class':'written', 'text':this.name + ' says...' }); var comment = new Element('td',{ 'class':'writtenby', 'text':this.comment }); title.inject(cont); comment.inject(cont); return cont; } }); Cant someone please poin me in the right direction please? Quote Link to comment https://forums.phpfreaks.com/topic/160802-help-with-my-assignment/ Share on other sites More sharing options...
andrew_biggart Posted June 3, 2009 Author Share Posted June 3, 2009 im now using this code and it is working to an extent, but i duont know how i can add exta fields so that th comment appears eblow the name. <?php //Set no caching header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); ?> var guestbook; window.addEvent('domready', function(){ guestbook = new GuestBook(); }); var GuestBook = new Class({ initialize: function(){ var req = new Request.JSON({ url: 'control.php?action=getPage', onSuccess: this.success }).send(); }, success: function(jArray){ jArray.each(function(post){ var post = new PostItem(post.id, post.name, post.comment); post.display().inject($('commentList')); }, this); } }); var PostItem = new Class({ initialize: function(id, name, comment){ this.id = id; this.name = name; this.comment = comment; }, display: function(){ var cont = new Element('tr',{ 'class':'', }); var title = new Element('td',{ 'class':'written', 'text':this.name + ' says...' }); var comment = new Element('td',{ 'class':'writtenby', 'text':this.comment }); title.inject(cont); comment.inject(cont); return cont; } }); Quote Link to comment https://forums.phpfreaks.com/topic/160802-help-with-my-assignment/#findComment-848688 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.