Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN Not Bugs
Author Message
CodyG
Life Cycles Becoming CPU Cycles



Joined: Jan 02, 2003
Posts: 714
Location: Vancouver Island

PostPosted: Fri Mar 23, 2007 1:35 pm Reply with quote

This isn't a problem on ravenphpscripts.com, but I'm having issues with the Home Page ReadMore link. With very short articles, one line for example, that darn ReadMore link is ubiquitous across three domains. I thought it was themes, but the issue is in both fisubice and deepblue. Is it just me or do others have a misbehaving ReadMore link?

_________________
"We want to see if life is ubiquitous." D.Goldin 
View user's profile Send private message
Gremmie
Former Moderator in Good Standing



Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Fri Mar 23, 2007 1:44 pm Reply with quote

Hmmm...I do not with RN2.10 but I have a custom theme. It may be a function of your theme. Maybe check the themeindex() function in theme.php.

_________________
Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module 
View user's profile Send private message
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Sat Mar 24, 2007 6:16 am Reply with quote

I must admit I have found this on some of my sites that I have upgraded and I am using fisubice. I haven't been able to work out what is causing it. Confused
 
View user's profile Send private message
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Sat Mar 24, 2007 9:14 am Reply with quote

That is definitely odd. I have upgraded three sites now and have not seen this. CodyG, is it doing this on EVERY article? If not, check the database directly to see if there is anything in the extended text field there, even if it is a blank space (not NULL).

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
CodyG







PostPosted: Sat Mar 24, 2007 9:41 am Reply with quote

it's got to be in my old theme files ... time to do a bit more upgrading. Wink
 
CodyG







PostPosted: Sat Mar 24, 2007 11:31 am Reply with quote

later ... although my original deepblue theme.php is ugly compared to the RN deepblue theme.php, the ReadMore ubiquitous link is still a problem with new RN 2.1 DeepBlue and fibsubice themes.

Code:


FormatStory($thetext, $notes, $aid, $informant);
    echo
                                                '</td>
                                            </tr>
                                        </table>'."\n"
                                    .'</td>
                                </tr>
                            </table><br />'."\n"
                        .'</td>
                    </tr>
                    <tr>
                        <td bgcolor="#FFFFFF" align="center">'."\n"
                            .'<font class="tiny">'._POSTEDBY.' ';
                            formatAidHeader($aid);
                        echo ' '._ON.' '. $time .'('.$counter .' '._READS.')<br /></font>'."\n"
                            .'<font class="content">'.$morelink.'</font>'."\n"
    .'<img src="themes/DeepBlue/images/pixel.gif" border="0" height="2" alt="" />'."\n"
                        .'</td>
                    </tr></table>'."\n"
                .'</td>
            </tr>
        </table><br />'."\n";
}


Where is the $morelink defined? Maybe something there?
 
CodyG







PostPosted: Sat Mar 24, 2007 11:37 am Reply with quote

yes, every article, montego.
in bodytext column Null is No and default is empty and the field is empty too.
 
Gremmie







PostPosted: Sat Mar 24, 2007 12:36 pm Reply with quote

In modules/News/index.php there is this:

Code:


        if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
            $morelink .= "$story_link".'<b>'._READMORE.'</b></a> | ';
        } else {
            $morelink .= '';
        }


So it looks like you get Read More if
$fullcount > 0 - if you have any body text this will be true
$c_count > 0 - number of comments in the story table for this article
$articlecomm == 0 - this I don't get; this is from your config table (mine is 1)
$acomm == 1; this is from the story table (all my stories have this set at 0)
 
CodyG







PostPosted: Sat Mar 24, 2007 1:53 pm Reply with quote

I've turned article comments off... $articlecomm

brilliant gremmie ...

I turned comments back on and the ubiquitous ReadMore goes away.
Can you confirm this Jakec?

How is this connected and how do I fix it? Can I take out the reference to $articlecomm in the if statement?
 
Gremmie







PostPosted: Sat Mar 24, 2007 2:09 pm Reply with quote

It seems to me that maybe that if statement has a bug.

Maybe it should be:

Code:


        if (($fullcount > 0) || ($c_count > 0 && ($articlecomm == 1 || $acomm == 1))) {
            $morelink .= "$story_link".'<b>'._READMORE.'</b></a> | ';
        } else {
            $morelink .= '';
        }


I'm assuming that $articlecomm == 1 means the admin has globally allowed comments, and I'm also assuming that $acomm is a way to let individual stories have comments, overriding the global setting.

So with that reworked, you get the Read More if you either have body text OR (you have any comments and comments are allowed globally or for that one story). Question
 
Gremmie







PostPosted: Sat Mar 24, 2007 2:48 pm Reply with quote

The questionable if statement is in modules/News/index.php where $morelink is computed.

It is apparently just displayed in themeindex(), so I was wrong about it being a theme issue.
 
jakec







PostPosted: Sat Mar 24, 2007 2:53 pm Reply with quote

CodyG wrote:
Can you confirm this Jakec?


Yes, Gremmie has hit the nail on the head!

Gremmie you are a genius. Wink
 
montego







PostPosted: Sat Mar 24, 2007 7:05 pm Reply with quote

But it does not explain why we are not seeing that on RavenNuke.com, nor any of my three sites?? Maybe I am missing something here, but this has always worked right for me. Confused
 
Gremmie







PostPosted: Sat Mar 24, 2007 9:32 pm Reply with quote

When you turn off comments on articles in preferences you get a "Read more" link even when there isn't any more to read. I've always had comments on so I never noticed this bug.
 
montego







PostPosted: Sun Mar 25, 2007 8:46 am Reply with quote

Thank you for helping me understand the issue, Gremmie. I do not have alot of time most days and cannot always dig deep.

If you feel that the above is the final tested solution, I will make it so in our repository so that any future patch release will have this fixed. In addition, a clear and concise explanation of the issue and the fix should be added to the RN Bug Fixes forum (Staff Only) in case others wish to make the fix.

BTW, I also thank you for changing your last post text. Wink
 
Gremmie







PostPosted: Sun Mar 25, 2007 9:52 am Reply with quote

Let me look at it some more; I didn't test that code and I'm not sure what the acomm field is really for (it doesn't seem to be set anywhere).

As far as changing my text... Embarassed sometimes I am in a hurry to respond and give a less than helpful answer.
 
Gremmie







PostPosted: Sun Mar 25, 2007 11:00 am Reply with quote

Ok...$articlecomm is a 1 when the admin has globally allowed comments for articles in the admin panel/preferences. $acomm controls comments on a per-story basis. When you submit a new story, you get the choice to activate/deactive comments for that story. $acomm is that flag. However, CONFUSINGLY, a value of 1 for acomm means comments are DISABLED. Mad

Here is my whole fix. All of the changes are in modules/News/index.php:

Find:
Code:



        if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
            $morelink .= "$story_link".'<b>'._READMORE.'</b></a> | ';
        } else {
            $morelink .= '';
        }


Change that to this:

Code:


        if ($fullcount > 0 || ($c_count > 0 && $articlecomm == 1 && $acomm == 0)) {
            $morelink .= "$story_link".'<b>'._READMORE.'</b></a> | ';
        } else {
            $morelink .= '';
        }


And finally, and I'm not proud of this, but there is already precedence. The existing code is so hacked up it is hard to fix correctly. There is an issue with the vertical bars. When you have disabled comments (either globally or locally), and you have a short article with no extra text, the read more link gets displayed like this: "( | Score: 0)".

To "fix" this Embarassed find:

Code:


        $morelink = str_replace(' |  | ', ' | ', $morelink);


After that, add

Code:


        $morelink = str_replace('( | ', '(', $morelink);


Again, I'm not proud of that, but someone already realized their logic was horked up and began patching it after the fact instead of fixing the root cause. I'll just pile on otherwise the number of changes would be too great to post here.
 
montego







PostPosted: Mon Mar 26, 2007 6:26 am Reply with quote

Gremmie, thank you for this! I am adding notes to our bug tracker pointing to each final fix. Once you are comfortable with the results, I'll incorporate into the project code and start running it through some test cycles.

Thanks again for the help on this!

BTW, I can honestly say that I touched that line of code last in RavenNuke(tm), but it was for the mass conversion of double-quotes to single-quotes. Whew!!!! Smile So, that was either FB's mess (my bet) or the patch series.
 
Gremmie







PostPosted: Mon Mar 26, 2007 7:18 am Reply with quote

montego, that same broken logic exists in 7.9.

I tested it through every combination I could think of (global comments on/off, and I created test stories with comments on and off, some with body text and some without). So I'm happy with the above changes. Someone else can certainly double check it.
 
CodyG







PostPosted: Mon Mar 26, 2007 7:40 am Reply with quote

What about News/categories.php?
 
Gremmie







PostPosted: Mon Mar 26, 2007 10:50 am Reply with quote

CodyG wrote:
What about News/categories.php?


Hi Cody, what is the issue with that file? I haven't looked at it.
 
CodyG







PostPosted: Mon Mar 26, 2007 11:51 am Reply with quote

It's the same issue as the index.php file.... when viewing the story via categories, the readmore link becomes ubiquitous.
iow, the same code is in the categories.php file

just thought you all might like to know... Wink
 
Gremmie







PostPosted: Mon Mar 26, 2007 12:00 pm Reply with quote

Ah, okay, I'll check that out. Too bad the code wasn't reused for that function. Too much copy & paste going on in the code base for my tastes.
 
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Mon Mar 26, 2007 2:25 pm Reply with quote

Quote:
Too much copy & paste going on in the code base for my tastes.


LOL, right on Gremmie!! This is a ubiquitous and insidious problem with the themes particularly and one we really should address for the next release. I will write something up soon.
 
View user's profile Send private message Visit poster's website
Gremmie







PostPosted: Mon Mar 26, 2007 5:33 pm Reply with quote

CodyG, forgive me but how do you view stories via categories? What do you click on to make it do that? I'm not sure I've ever used that feature of Nuke. LOL.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN Not Bugs

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©