Author |
Message |
CodyG
Life Cycles Becoming CPU Cycles

Joined: Jan 02, 2003
Posts: 714
Location: Vancouver Island
|
Posted:
Fri Mar 23, 2007 1:35 pm |
|
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 |
|
|
 |
Gremmie
Former Moderator in Good Standing

Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA
|
Posted:
Fri Mar 23, 2007 1:44 pm |
|
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 |
|
|
 |
jakec
Site Admin

Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom
|
Posted:
Sat Mar 24, 2007 6:16 am |
|
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.  |
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Sat Mar 24, 2007 9:14 am |
|
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! |
|
|
 |
CodyG

|
Posted:
Sat Mar 24, 2007 9:41 am |
|
it's got to be in my old theme files ... time to do a bit more upgrading.  |
|
|
|
 |
CodyG

|
Posted:
Sat Mar 24, 2007 11:31 am |
|
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

|
Posted:
Sat Mar 24, 2007 11:37 am |
|
yes, every article, montego.
in bodytext column Null is No and default is empty and the field is empty too. |
|
|
|
 |
Gremmie

|
Posted:
Sat Mar 24, 2007 12:36 pm |
|
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

|
Posted:
Sat Mar 24, 2007 1:53 pm |
|
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

|
Posted:
Sat Mar 24, 2007 2:09 pm |
|
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).  |
|
|
|
 |
Gremmie

|
Posted:
Sat Mar 24, 2007 2:48 pm |
|
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

|
Posted:
Sat Mar 24, 2007 2:53 pm |
|
CodyG wrote: | Can you confirm this Jakec? |
Yes, Gremmie has hit the nail on the head!
Gremmie you are a genius.  |
|
|
|
 |
montego

|
Posted:
Sat Mar 24, 2007 7:05 pm |
|
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.  |
|
|
|
 |
Gremmie

|
Posted:
Sat Mar 24, 2007 9:32 pm |
|
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

|
Posted:
Sun Mar 25, 2007 8:46 am |
|
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.  |
|
|
|
 |
Gremmie

|
Posted:
Sun Mar 25, 2007 9:52 am |
|
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... sometimes I am in a hurry to respond and give a less than helpful answer. |
|
|
|
 |
Gremmie

|
Posted:
Sun Mar 25, 2007 11:00 am |
|
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.
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 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

|
Posted:
Mon Mar 26, 2007 6:26 am |
|
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!!!! So, that was either FB's mess (my bet) or the patch series. |
|
|
|
 |
Gremmie

|
Posted:
Mon Mar 26, 2007 7:18 am |
|
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

|
Posted:
Mon Mar 26, 2007 7:40 am |
|
What about News/categories.php? |
|
|
|
 |
Gremmie

|
Posted:
Mon Mar 26, 2007 10:50 am |
|
CodyG wrote: | What about News/categories.php? |
Hi Cody, what is the issue with that file? I haven't looked at it. |
|
|
|
 |
CodyG

|
Posted:
Mon Mar 26, 2007 11:51 am |
|
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...  |
|
|
|
 |
Gremmie

|
Posted:
Mon Mar 26, 2007 12:00 pm |
|
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
|
Posted:
Mon Mar 26, 2007 2:25 pm |
|
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. |
|
|
|
 |
Gremmie

|
Posted:
Mon Mar 26, 2007 5:33 pm |
|
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. |
|
|
|
 |
|