PDA

View Full Version : Read More only if needed


HeavyEddie
01-14-2006, 08:44 PM
This is an itty bitty hack, but resolves a small annoyance I have.

Anyway, if you have typed a description but no actual article information when writing a news article you can insert this code so it won't even give the option to Read More. Why say more when there isn't?


Find this in news.php
****// display link to article
****echo ' <a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&p2_articleid=' . $article['articleid']) . '">' . $p2_language['read_more'] . '</a>';

Replace it with this
****// display link to article
****if (strlen($article['article']) > 0)
****{
****echo ' <a href="' . RewriteLink('index.php?categoryid=' . $categoryid . '&p2_articleid=' . $article['articleid']) . '">' . $p2_language['read_more'] . '</a>';
****}


Find this in latestnews.php
************if($showreadmore)
************{
**************echo ' <a href="' . RewriteLink('index.php?categoryid=' . $article['categoryid'] . '&p2_articleid=' . $article['articleid']) . '">' . $language['read_more'] . '</a><br />';
************}

Replace it with this
************if($showreadmore)
************{
**********if (strlen($article['article']) > 0)
**********{
******************echo ' <a href="' . RewriteLink('index.php?categoryid=' . $article['categoryid'] . '&p2_articleid=' . $article['articleid']) . '">' . $language['read_more'] . '</a><br />';
**************}
************}

72dpi
01-16-2006, 10:16 AM
man,
Awesome again heavy. Cheers!

bopheim
02-27-2006, 06:28 PM
<div class='quotetop'>QUOTE(72dpi &#064; Jan 16 2006, 11&#58;16 AM) 3040</div>
man,
Awesome again heavy. Cheers&#33;
[/b]

You don&#39;t really need this, because this is done simply by typing everything in the article field. (Description: The full article will be placed on a new page if you enter a description.)

geiri
02-27-2006, 06:44 PM
<div class='quotetop'>QUOTE(bopheim &#064; Feb 27 2006, 06&#58;28 PM) 4209</div>
You don&#39;t really need this, because this is done simply by typing everything in the article field. (Description: The full article will be placed on a new page if you enter a description.)
[/b]


I am running sd 2.2.3 and if I write the news in Article field I will get an empty news on my frontpage with only the read more link.

I have tried this many times.

Sd 2.3 dos not do this.

bopheim
02-28-2006, 01:19 PM
That is strange. I have never had that problem. And I have been using it since the beginning.

HeavyEddie
02-28-2006, 11:08 PM
OK, I investigated this a little bit since I put the hack up here. I used the latest version of SD.

bopheim is correct for the NEWS plugin, if you only type the article information and leave the description empty... it simply displays the article and does not show "read more". Good to know.

However, Latest News does have this issue. Latest news will always display "read more". This is an option in the cp for the latest news plugin. It looks like it either always shows "read more" or never shows "read more"... not intelligent.

Community
08-23-2008, 12:27 AM
How will I do this for the latest version this time.

Maybe it's a good thing to update these sort of hacks?