1
ghia
News and Comments
  • 2008/8/27 9:11

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


When you look at the end of an article in News (1.56 - 1.62) with XOOPS 2.2.6 then you see at the bottom something like:
Quote:
Read More... | 6774 bytes more | 16 comments

To my surprise both links point to the same URL of the full article view.
I found that very ennoying and illogical, because when I click on comments, I expect to land on the comments at the bottom of the article and not pages away at the top.

So, I patched it.

First we need an anchor to land. I choose this at the top of the comment functions block (in this way other modules can benefit as well).

In /include/comment_view.php at 153 change

$navbar '

to

$navbar ' <a name="comments"></a>


Next we adapt the links in modules\news\class\class.newsstory.php around 640 or 690 from

if ( $ccount == ) {
                
$morelink .= '">'._NW_COMMENTS.'</a>';
            } else {
                if ( 
$fullcount ) {
                    if ( 
$ccount == ) {
                        
$morelink .= '">'._NW_READMORE.'</a> | '.$morelink2.'">'._NW_ONECOMMENT.'</a>';
                    } else {
                        
$morelink .= '">'._NW_READMORE.'</a> | '.$morelink2.'">';
                        
$morelink .= sprintf(_NW_NUMCOMMENTS$ccount);
                        
$morelink .= '</a>';
                    }
                } else {
                    if ( 
$ccount == ) {
                        
$morelink .= '">'._NW_ONECOMMENT.'</a>';
                    } else {
                        
$morelink .= '">';
                        
$morelink .= sprintf(_NW_NUMCOMMENTS$ccount);
                        
$morelink .= '</a>';
                    }
                }
            }

in five changes to

if ( $ccount == ) {
                
$morelink .= '#comments">'._NW_COMMENTS.'</a>';
            } else {
                if ( 
$fullcount ) {
                    if ( 
$ccount == ) {
                        
$morelink .= '">'._NW_READMORE.'</a> | '.$morelink2.'#comments">'._NW_ONECOMMENT.'</a>';
                    } else {
                        
$morelink .= '">'._NW_READMORE.'</a> | '.$morelink2.'#comments">';
                        
$morelink .= sprintf(_NW_NUMCOMMENTS$ccount);
                        
$morelink .= '</a>';
                    }
                } else {
                    if ( 
$ccount == ) {
                        
$morelink .= '#comments">'._NW_ONECOMMENT.'</a>';
                    } else {
                        
$morelink .= '#comments">';
                        
$morelink .= sprintf(_NW_NUMCOMMENTS$ccount);
                        
$morelink .= '</a>';
                    }
                }
            }


And when we were changing anyway, I found the layout of the comment functions block for posting a comment very confusing and the link to post is easy overlooked. It deserves a more prominent place for easier access.

The four controls are placed in a table with 1 row and 1 column. So I decided to add a new row, because a new column wasn't it what I was looking for.

For this you have to change

$navbar .= '&nbsp;<input type="button" onclick="self.location.href=''.$postcomment_link.''.$link_extra.''" class="formButton" value="'._CM_POSTCOMMENT.'" />';

in /include/comment_view.php at 204 to

$navbar .= '</td></tr><tr><td class="odd" align="center"><input type="button" onclick="self.location.href=''.$postcomment_link.''.$link_extra.''" class="formButton" value="'._CM_POSTCOMMENT.'" />';


So that looks already much nicer!

Only the text
Quote:
The comments are owned by the poster. We aren't responsible for their content.

looks a little orphaned, maybe I must add it in the table in a row between the controls, but that's for a next time!

2
trabis
Re: News and Comments
  • 2008/8/27 9:49

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Very nice! Well though!

3
Mamba
Re: News and Comments
  • 2008/9/26 11:58

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Nice work!!! Thanks for sharing it!!!
Hopefully Herve will include it in the next release of News!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

4
voltan
Re: News and Comments
  • 2008/9/26 12:19

  • voltan

  • Theme Designer

  • Posts: 724

  • Since: 2006/12/5


very nice . thank you . i gonna test it

Login

Who's Online

170 user(s) are online (115 user(s) are browsing Support Forums)


Members: 0


Guests: 170


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits