Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 03:38:32 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: "Read More" News... - no more news...  (Read 3790 times)
glued2

Offline Offline

Posts: 20


WWW
« on: June 05, 2005, 06:12:13 PM »

Hi Folks, I can't find this answer anywhere so thought I'd ask....  

For about half the news items i add I simply want to add a short text, with no long version at all...  (I'm using round templates) it still says Read More.. though.  Sad  

Is there a way to only show the read more link if there is a longer story?
(otherwise thats going on my wish list Smiley )  

cheers
Nick.
.
Logged
fienieg
Guest
« Reply #1 on: June 06, 2005, 02:08:12 AM »

No there isn't! You can remove the readme link, but that will permantly remove it!
Logged
pcwacht
Guest
« Reply #2 on: June 14, 2005, 11:11:30 PM »

I managed to get rid of an unwanted " Read More " link

Logic, test if length of longtext is shorter then 9 characters (sometimes a wysiwyg editor leaves a '< /P>' in place).

Open up /modules/news/view.php AFTER YOU MADE A BACKUP!!!!! You have been warned!

search for:
// Query posts (for this page)

change next line from :
   $query_posts = $database->query("SELECT group_id,post_id,title,link,short,posted_by,posted_when FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra ORDER BY position DESC".$limit_sql);

to :
   $query_posts = $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts WHERE section_id = '$section_id' AND active = '1' AND title != ''$query_extra ORDER BY position DESC".$limit_sql);


search for:
// Replace vars with values

add a new line after:
$post_long = strlen($post['long']);

replace these lines (lill bit down):
Code:

if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $TEXT['READ_MORE']);
} else {
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, '', '', '', '', $TEXT['READ_MORE']);
}


to:

Code:
if(isset($users[$uid]['username']) AND $users[$uid]['username'] != '') {
if ($post_long < 9) {
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], '');
} else {
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, $uid, $users[$uid]['username'], $users[$uid]['display_name'], $users[$uid]['email'], $TEXT['READ_MORE']);
}
} else {
if ($post_long < 9) {
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, '', '', '', '', '');
} else {
$values = array(PAGE_TITLE, $group_id, $group_title, $group_image, $display_group, $display_image, stripslashes($post['title']), stripslashes($post['short']), $post_link, $post_date, $post_time, '', '', '', '', $TEXT['READ_MORE']);
}
}




Have fun!

John
Logged
melissa

Offline Offline

Posts: 166


« Reply #3 on: October 09, 2005, 04:19:51 AM »

Thanks a lot for this. I just came up with the same question.

It's sort of annoying for the "Read More" link to pop up if you haven't even populated the "long" section.
Logged
melissa

Offline Offline

Posts: 166


« Reply #4 on: October 09, 2005, 04:34:03 AM »

Actually, is there any chance of fixing this up for 2.6?  cheesy

I can post the whole file with the change, if it would save time for anyone.
Logged
zaggi

Offline Offline

Posts: 56


« Reply #5 on: October 30, 2005, 10:32:17 PM »

Please do melissa, that would be nice Smiley Thx
Logged
Ryan

Offline Offline

Posts: 2048



WWW
« Reply #6 on: October 31, 2005, 12:05:48 AM »

@melissa: If you haven't already done it (sorry I haven't checked), then I suggest posting this to the tracker on the project page (and then us developers won't forget to look at it). wink
Logged

Website Baker Project Founder
www.websitebaker.or g

To contact me via email, visit:
www.ryandjurovich.c om
melissa

Offline Offline

Posts: 166


« Reply #7 on: November 01, 2005, 02:13:26 AM »

For those who want it, here is the view.php file with the change to "read more".

Ryan, I will add give it my best shot to add to the tracker.

Cheers,

Melissa.

With the attachment, rename to view.php. (Covered in shame from not having used an attachment when I first posted.) embarassed

[attachment deleted because of being too old]
« Last Edit: November 04, 2005, 03:50:37 AM by melissa » Logged
Ryan

Offline Offline

Posts: 2048



WWW
« Reply #8 on: November 01, 2005, 08:45:07 AM »

Melissa, I would much prefer if you could either upload an attachment to your post or have a link to view.php, rather than placing all code inside the post (it makes your post unnecessarily long). I am sorry to say it but I don't think this will make it into 2.6 sad
Logged

Website Baker Project Founder
www.websitebaker.or g

To contact me via email, visit:
www.ryandjurovich.c om
kibmcz

Offline Offline

Posts: 217



WWW
« Reply #9 on: November 01, 2005, 07:57:15 PM »

Would it be possible to have it so if the "Long:" text box is empty it dosn't put the "Read More" link??
Logged
i2Paq

Offline Offline

Posts: 511


« Reply #10 on: November 02, 2005, 08:55:25 AM »

Would it be possible to have it so if the "Long:" text box is empty it dosn't put the "Read More" link??

I was under the inpression that it would do this, but it does not. Is there a way that would make this possible?
The reason I aske this is that it then can be used in more the one way. I was planning on using the News module as a sort of web-blog.
Logged

Opensource is my life, but then elsewhere.
melissa

Offline Offline

Posts: 166


« Reply #11 on: November 04, 2005, 07:41:29 AM »

Okay Ryan.

I've updated my previous post.  tongue

If it's not going to be possible for 2.6, how about 2.6.1?  grin
Logged
pcwacht
Guest
« Reply #12 on: November 04, 2005, 12:28:55 PM »

Quote
I was under the inpression that it would do this, but it does not. Is there a way that would make this possible?
It does just this!

Get the view.php.txt from Melissa, some posts up, rename it to view.php and copy it over the existing one -> /modules/news/view.php
(As allways, backup!!)

The logic it uses:
It test to see if the longtext has a length shorter then 9 characters, if so no read more, if not read more
Why test length ?
Cause the wysiwyg editors tend to leave <p></p> in the fields so a check on empty wouldn't be enough.

It does work.

John
Logged
i2Paq

Offline Offline

Posts: 511


« Reply #13 on: November 04, 2005, 02:14:31 PM »

@pcwacht, works.
Logged

Opensource is my life, but then elsewhere.
pcwacht
Guest
« Reply #14 on: November 05, 2005, 12:47:30 AM »

@i2Paq, change the style of the postloop, the post title is still a link to long text Wink
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!