Jeknifer (whataboutjen) wrote in component_help,
Jeknifer
whataboutjen
component_help

Problems with Entries in Scrollbox tutorial

***Still need help with this issue:

I used the entries in scrollbox tutorial listed on the left with the others. I love the look of the scrollbox entries. However, if you look on my journal, you'll notice that it posts the memory and edit icons twice.


I went through the code a couple times and I can't figure out why it does that.

Maybe you could?


Could someone go through this code to see where I may have goofed?

function print_entry(Page p, Entry e, Color bgcolor, Color fgcolor, bool hide_text) {
  var int maxLength = 100*6;
  """<div style="width: 650px;">""";
  print_entry_header((defined $e.security_icon?"$e.security_icon   ":"")+$e.time->time_format()+" <b>"+$e.time->date_format("long")+"</b>");

  """
  <table cellspacing="0" cellpadding="0" border="0" width="100%">
    <tr>
      <td width="1" colspan="3" class="dkLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    </tr><tr>
      <td width="1" class="dkLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
  """;

    if ($p.view=="friends" or ($*show_entry_userpic and defined $e.userpic) or $e.journal.journal_type=="C") { 
    
     """
     <td class="entryHolderBg" valign="top">
     <table cellspacing="0" cellpadding="0" border="0" align="center">
       <tr>
         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
       </tr>
     """;
    
     if (defined $e.userpic) { """
       <tr>
         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="2" alt="" border="0" /></td>
         """;
         
         if ($p.view=="friends") { 
            """ <div style="padding-top: 3px; padding-left: 3px; padding-right: 3px; padding-bottom: 3px; background-color: """; print $bgcolor.as_string; """ ;" align="center">
            <img border="1" src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" alt="" style="border-color: """; print $fgcolor.as_string; """ ;" />
            </div> """;
         }else{
            """ <td align="center" class="userpic"><img border="1" src="$e.userpic.url" width="$e.userpic.width" height="$e.userpic.height" alt="" /></td> """;
         }
         """
       </tr>
     """; }
     
     if ($p.view=="friends" or $e.journal.journal_type=="C") { """
       <tr>
         <td><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="2" alt="" border="0" /></td>
         <td align="center" class="ljuser">$e.journal""";
         if ($e.journal.username!=$e.poster.username) {"""
           <div align="center" class="ljuser">$e.poster</div>""";
         } """
         </td>
       </tr>""";
     }
     """
     </table>
  """; }

  """<td class="entryHolderBg" width="100%" valign="top">""";
  print_content_top();

   if ($e.subject!="") { """
        <div class="entryHeader">$e.subject</div>
        <div class="entryDash"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></div>
      </td>
      <td width="1" class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
    </tr>
    <tr>
      <td width="1" class="medLine"><img src="http://www.livejournal.com/palimg/component/clear.gif" width="1" height="1" alt="" border="0" /></td>
      <td class="entry"><
  """; }
  if ($e.text->length() > $maxLength) {
     """<div style="height: 250px; width: 545px; overflow: auto;">""";
  } else {
     """<div style="width: 545px; overflow: auto;">""";
  }

  """ $e.text """;

    if ($e.metadata{"mood"}!="") { 
  
    """<br/><br/>""";
    """<b> $*text_meta_mood : </b>"""; print $e.metadata{"mood"}; 
        if (defined $e.mood_icon) { """ $e.mood_icon """; }
    """<br/>""";
    if ($e.metadata{"music"}=="") { """<br/>"""; }
  }
    if ($e.metadata{"music"}!="") { 
    if ($e.metadata{"mood"}=="") { """<br/><br/>"""; }
    """<b> $*text_meta_music : </b>"""; print $e.metadata{"music"};
    """<br/><br/>""";
  }

   """ $e.text """;
  
  
  """</div>""";
  print_content_bottom();

  """
  <table width="100%">
    </tr>
      <td width="40%" align="left" valign="center">
        <div class="entryComments">
        """;
       if ($e.comments.enabled) {
          $e.comments->print();
        }
        """
        </div>
      </td>
      <td width="20%" align ="center" valign="center">""";
        
        """
	<div class="entryComments"><b>( <a href="$e.permalink_url" class="commentLinks">$*text_permalink</a> )<b></div>
      </td>
      <td width="40%" align ="right" valign="center">""";
        
        """<div class="entryComments">
          """;
          
          $e->print_linkbar();
          
         if (viewer_is_owner() and $e.poster.username==$p.journal.username) { """
            <a href="http://www.livejournal.com/editjournal_do.bml?journal=$e.journal.username&itemid=$e.itemid">
               <img border="0" width="22" height="20" alt="Edit Entry" src="http://stat.livejournal.com/img/btn_edit.gif" /></a>
            """;
          }"""
          <a href="http://www.livejournal.com/tools/memadd.bml?journal=$e.journal.username&itemid=$e.itemid">
             <img border="0" width="22" height="20" alt="Add to Memories" src="http://stat.livejournal.com/img/btn_memories.gif" /></a>
          <a href="http://www.livejournal.com/tools/tellafriend.bml?journal=$e.journal.username&itemid=$e.itemid">
              <img border="0" width="22" height="20" alt="Tell A Friend" src="http://stat.livejournal.com/img/btn_tellfriend.gif" /></a>""";
        """
        </div>
      </td>
    </tr>
  </table></div>
  """;

   print_system_box_bottom();
  """ <div><img src="http://www.livejournal.com/palimg/component/clear.gif" width="3" height="3" alt="" border="0"></div> """;

} 



I appreciate any advice you could give me. Thank you!

Update:I appreciate all the help so far, but the problem is still not solved. I looked for the key text given by the tutorial author in the comments. I could not find it in the code. So there are still entries printed twice, kunzite1 gave me the answer. Thank you!

There are still two edit journal buttons and there are still two add to memory buttons. I tried going back to the tutorial to see if there is any optional text. Supposedly it is colour coded but the only colours showing up is default and red. I don't want to delete any part of the coded that may be needed. The code I am currently using is included in the lj-cut.
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 14 comments