I would like to add the "read more" text into a line after the teaser, left aligned, rather than right aligned and in the body rather than below it. It gets lost on a list of: posted in..., print this page, add new comment, read more.

I couldn't even find the code for the read more link. Does anyone know where it is?

Comments

davec611’s picture

I second the motion. Particularly with unsophisticated users, the 'read more' text is often not seen, with the result that they think there is no more to the post than what is in front of them.

I cant think of any reason why this would not be an easy change, but i don't even know where to begin looking for the code, nor what to do when I find it.

Sorry. Let's hope someone else more knowledgeable comes along.

jasonwhat’s picture

I'd like to see the read more there also. And I'd like put all the other links in a block. Actually, I'd like them in a block near the title of the content, not within a regular block, but am not quite sure how to go about this.

venkat-rk’s picture

Same problem here. Would be great to place the 'read more' link next to the teaser. People simply miss it when it is placed at the end of the Posted in links.

Geary’s picture

Is this what you're looking for?

Grab the FriendsLight theme and take a look at the node.tpl.php file. This part of the code is what you want:

  <div class="content">
<?php
    if( $main && $node->readmore )
    {
        $content = "$node->teaser<p>" .
            l( t("read more"), "$node_url", array( "title" => t("Read the rest of this posting."), "class" => "read-more") ) .
            "</p>";

        // remove "read more" link from standard node links
        $my_links = link_node( $node, $main );
        if( $my_links )
        {
            // this would be much easier if the array returned by module_links() was indexed
            // see <a href="http://drupal.org/node/view/636">let _link() return structured link info</a>
            $rm = preg_quote( t("read more") );
            $my_links = preg_grep( "/$rm/", $my_links, PREG_GREP_INVERT );
            $links = theme( "links", $my_links );
        }
    }

    print $content;
?>
  </div>

As you can see, it is a bit messy, but it works very well, in 4.5.2 anyway. Haven't tested it with 4.6 yet.

I think I got this code from some other PHPTemplate theme, but I don't remember which one. My apology to the original author for not giving credit here!

jasonwhat’s picture

That worked well thanks.

Zach Harkey’s picture

All I can say is Awesome; thank you. This code needs to get into the handbook.

: z

nautis’s picture

Geary,

Sweet. That's it exactly. I'm going to try to make these changes to 4.6. Thanks for your help.

Update: I tried in 4.6 and got this error: Call to undefined function: link_node()

Does anyone know where I should define this function? I looked in the FriendsLight template.php but there was no reference.

- Matthew

Zach Harkey’s picture

Alas, this no longer works in 4.6.

: z

Geary’s picture

I haven't tested this in 4.6 yet, but I took a look at the difference between 4.5.2 and 4.6, and it looks like this might do the trick. Change this line of code:

        $my_links = link_node( $node, $main );

to:

        $my_links = $node->links;

So the whole thing would be:

  <div class="content">
<?php
    if( $main && $node->readmore )
    {
        $content = "$node->teaser<p>" .
            l( t("read more"), "$node_url", array( "title" => t("Read the rest of this posting."), "class" => "read-more") ) .
            "</p>";
        // remove "read more" link from standard node links
        $my_links = $node->links;
        if( $my_links )
        {
            // this would be much easier if the array returned by module_links() was indexed
            // see <a href="http://drupal.org/node/view/636">let _link() return structured link info</a>
            $rm = preg_quote( t("read more") );
            $my_links = preg_grep( "/$rm/", $my_links, PREG_GREP_INVERT );
            $links = theme( "links", $my_links );
        }
    }
    print $content;
?>
  </div>

I'll test this when I get a chance, but in the meantime if anyone would like to try it and report back, I'd be curious to know if it works. Thanks!

Zach Harkey’s picture

Thank you Geary, that did it perfectly.

: z

silverwing’s picture

Thank you so much for this! You're my Lifesaver of the Day! (You can pick whatever flavor you are!)

silverwing
www.misguidedthoughts.com

naught101’s picture

probably I'm doing something wrong, but this isn't working on the site I'm setting up (opus.org.au). basically it changed nothing. it still looks like it did before. I've added the code to the node.tpl.php file (in place of the content div), and re-uploaded it.

I'm using the green slash theme (http://drupal.org/project/slash), so I'm wondering if maybe the theme is calling a different function... I wouldn't know, I'm not a php coder.

Geary’s picture

There is a PHPTemplate version of Slash in CVS. Are you using that version or the older one which didn't use PHPTemplate? This patch is for PHPTemplate themes only. Try the CVS version of Slash if that's the problem.

naught101’s picture

yeah, you're right.. I'm not confident using CVS though (I never have, infact). perhaps I'll just wait until the downloadable version comes out..

ned

naught101’s picture

I downloaded the http://drupal.org/files/projects/slash-cvs.tar.gz
most of the files in that are reasonably up to date (most jan 2006)

is that still not a PHPtemplate theme? is there any way to tell?

ned

Geary’s picture

That theme has files named page.tpl.php, node.tpl.php, etc. Those are PHPTemplate files.

lisa’s picture

I tried Geary's code to move the 'read more' link and only got it to work after I made a small modification. I am using Drupal 4.6 and the Friends Electric theme with Clean URLs disabled.

When I tried the code provided by Geary, the 'read more' link ended up pointing to:

http://www.mysite.com/?q=?q=node/66

When it should have been pointing to :

http://www.mysite.com/?q=node/66

I changed $node_url to node/$node->nid and then it worked. Like this:

  <div class="content">
<?php
    if( $main && $node->readmore )
    {
        $content = "$node->teaser<p>" .
            l( t("read more"), "node/$node->nid", array( "title" => t("Read the rest of this posting."), "class" => "read-more") ) .
            "</p>";
        // remove "read more" link from standard node links
        $my_links = $node->links;
        if( $my_links )
        {
            // this would be much easier if the array returned by module_links() was indexed
            // see <a href="http://drupal.org/node/view/636">let _link() return structured link info</a>
            $rm = preg_quote( t("read more") );
            $my_links = preg_grep( "/$rm/", $my_links, PREG_GREP_INVERT );
            $links = theme( "links", $my_links );
        }
    }
    print $content;
?>
  </div>

I don't know why, but it works.

KimaJako’s picture

the code worked well with no problem, thanks.
-----
www.PersiaData.com

venkat-rk’s picture

Does this work for all phptemplate themes (4.5)?

I am using Democratica and the code on node.tpl.php looks very different:

<div class="node<?php print ($sticky) ? " sticky" : ""; ?>"> 
  <?php if ($page == 0): ?> 
  <h2 class="page-title"><a href="/<?php print $node_url ?>" rel="bookmark" title="Permanent Link to <?php print $title ?>"><?php print $title ?></a></h2> 
  <?php endif; ?> 
  <small><?php print $submitted ?></small> 
  <div class="content"> 
    <?php print $content ?> 
  </div> 
  <?php if ($links): ?>
  <div class="links">
  <?php if ($terms): ?> <span class="postmetadata">Posted in <?php print $terms ?></span> | <?php endif; ?><?php print $links ?> &#187;</p> 
  </div>
  <?php endif; ?> 
</div>

Being a newbie, I am stumped where to include your code. I would be thankful for some suggestions.

venkat-rk’s picture

One more issue with 'read more'. If you have set the minimum words to 0 and don't use a delimiter, you will get the 'read more' link even if the full text of the post is already there.

Update: Well, you will get the 'read more' link even if you set the minimum words to 10 or something.

tostinni’s picture

I think it's by design, because some module can add content that would not appear in the teaser.
For example : trackbacks & comments are only visible in the "full view" of a node.

venkat-rk’s picture

Oh, I didn't realise that. Thank you.

januario’s picture

I realize that comments and trackbacks may have more information than the original node and therefore if additional information exists, the read more link is appropriate. However, for nodes that have these disabled or for nodes that have not been commented on, the ability to remove the read more link would be useful.

Does anyone know how to either:

  1. Select to keep read more hidden manually for certain links.
  2. Have the read more link only appear if the content is different or if comments exist in the node.

Thanks

varunvnair’s picture

Where do I tweak the 'read more' link in an xtemplate theme?

Thanks.

mattengland’s picture

The following represent changes I made to drupal.4.6.1:themes/engines/xtemplate/xtemplate.engine to implement a "Read More" in the way that I prefer for my site.

I'm relatively new to Drupal, so I ask: is this not a more-general solution then changing a specific theme (like the methods above appear to do)? Therefore, would it not be preferred in order to make it work for any theme or any other site/sheet style?

My modified drupal.4.6.1:themes/engines/xtemplate/xtemplate.engine:

function xtemplate_node($node, $main = 0, $page = 0) {
  global $xtemplate;

  $read_more = '';

  if ($node->readmore)
  {
     $read_more = t("<strong><a href=\"%a\">... Read more ...</a></strong><br><br>",
                      array("%a" => url("node/$node->nid")));
  }

  $xtemplate->template->assign(array(
        "submitted" => theme_get_setting("toggle_node_info_$node->type") ?
                         t("Submitted by %a on %b.",
                           array("%a" => format_name($node),
                            "%b" => format_date($node->created))) : '',
        "link"      => url("node/$node->nid"),
        "title"     => check_plain($node->title),
        "author"    => format_name($node),
        "date"      => format_date($node->created),
        "sticky"    => ($main && $node->sticky) ? 'sticky' : '',
        "content"   => ($main && $node->teaser) ? ("$node->teaser" . "$read_more") : $node->body));

-Matt

nautis’s picture

matt -

very cool. this should work for xemplate 4.5:

function xtemplate_node($node, $main = 0, $page = 0) {
  global $xtemplate;
  $read_more = '';
  if ($node->readmore)
  {
     $read_more = t("<a href=\"%a\">Read more ...</a><br><br>",
                      array("%a" => url("node/$node->nid")));
  }
  $xtemplate->template->assign(array(
        "submitted" => theme_get_setting("toggle_node_info_$node->type") ?
                         t("Submitted by %a on %b.",
                           array("%a" => format_name($node),
                            "%b" => format_date($node->created))) : '',
        "link" => url("node/$node->nid"),
        "title" => $node->title,
        "author" => format_name($node),
        "date" => format_date($node->created),
        "sticky" => ($main && $node->sticky) ? 'sticky' : '',
        "content" => ($main && $node->teaser) ? ("$node->teaser" . "$read_more") : $node->body));
mwoodwar’s picture

I know I'll probably catch hell from the but it's so flexible crowd, but this is a good example of what (I feel) Drupal will have to overcome to really get popular in the mainstream.

I'm a Drupal newbie, but have been around CSS, and PHP for some time now. All I wanted to do is to get the "Read More" link to show up on a line of it's own just under the body of the post.

I'm using 'FriendsElectric', and looked at all of the tpl.php file, the style sheet and the template file...I could not find a reference to 'Read More' anywhere there?? Am I blind? Should this be this difficult?

Mark

sepeck’s picture

Line 20. It's called $links
http://drupal.org/node/11816

What name would you have called it?

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

mwoodwar’s picture

I appreciate the help. Now that I've found it can I ask a new question? Where is the content of $links defined? What I want to do is to separate the "Read More" portion, and be able to move it to the top of the section, and make it stand out?

Mark

ToddZ-1’s picture

Yeah, I find this discouraging too. Much as I like the functionality of a Drupal site, I dread the propect of modifying anything behind the scenes.

As a ColdFusion developer, I'm used to being able to dig into any application and easily modify the presentation HTML. As long as you don't muck up the special CF tags which insert database results, any HTML jockey can customize the template layout til the cows come home with nothing more than HTML and CSS knowledge. Something like repositioning a "read more" link would be no more difficult on a CF template than on a static HTML page.

I know PHP is a different beast, but I sure wish that the content and presentation weren't so intertwined in complex scripting.

mattengland’s picture

My "read more" stuff is not working consistently. Most all the content has gotten consistently "truncated" in the teaser until recently. Now I'm finding some blog posts get truncated at different character-number points, others don't get truncated at all. I see not consistent pattern for the different behavior; seemingly randmon at this point.

Anybody have any ideas?

I'm running 4.6.1.

-Matt

syren-1’s picture

Anyone know how you remove it completely?

sepeck’s picture

What are you asking? You can change teaser length per node type. I think this is in input formats (make it long if you don;t want teasers). If you mean the Read More link itself? That depends on the theme you are using.

-sp
---------
Test sites and good habits: Drupal Best Practices Guide.
Misc Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

syren-1’s picture

I mean the Read More link itself. I want it gone. I'm using Bluemarine if that helps.

sepeck’s picture

Look here for xtemplate theme based instructions.
http://drupal.org/node/6493

Looks like you will want to play with line 87 but I am not entirely sure of the effects. I tend to use phpTemplate based themes.

-sp
---------
Test sites and good habits: Drupal Best Practices Guide.
Misc Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

anewcomb’s picture

I agree that this method seems to make more sense and it does work on my site. However, is there a way to get the "read more" so it appears just after the teaser instead of a few lines down??

I really hope 4.7 has an easy way to deal with this.

Thanks,
Aaron
http://www.thesourceshow.org

hf’s picture

Thanks, Matt, it works perfectly! I would'nt be able to do it....

mwoodwar’s picture

I know I'll probably catch hell from the but it's so flexible crowd, but this is a good example of what (I feel) Drupal will have to overcome to really get popular in the mainstream.

I'm a Drupal newbie, but have been around CSS, and PHP for some time now. All I wanted to do is to get the "Read More" link to show up on a line of it's own just under the body of the post.

I'm using 'FriendsElectric', and looked at all of the tpl.php file, the style sheet and the template file...I could not find a reference to 'Read More' anywhere there?? Am I blind? Should this be this difficult?

Mark

Geary’s picture

It sounds like you're looking for what I implemented in the FriendsLight theme:

http://drupal.mg.to/

FriendsLight is closely based on FriendsElectric, so if you diff the two you will find the code it uses. I described it earlier in this thread, but I think I updated the theme after that to fix some other problems, so grab the latest here:

http://drupal.mg.to/2005/05/14/friendslight-theme-updated-for-drupal-4-6

Marco Palmero’s picture

Thanks guys for the info...

I actually asked myself the same question nautis asked in April (its now September?!)

And thanks to Geary for the info too!

---------------------------------------------------------
My Blog - Photography, travelling and University...

Marco Palmero’s picture

I've just come to report that this "hack" is having some weird effects with the image.module and comments

---------------------------------------------------------
My Blog - Photography, travelling and University...

t3rmin’s picture

Twofold approach. See it in effect at http://thetrents.org

1) I edited the CSS in my theme to make the "read more" link both bright green and larger in size (and therefore more noticeable).
2) I changed the way teasers are created when you post content. Now it adds a "...CONTINUED..." line at the end of any content that's chopped. Patch to node.module is below:

--- node.module 2005-09-08 23:14:24.000000000 -0700
+++ /var/www/modules/node.module        2005-12-02 12:56:45.000000000 -0800
@@ -178,9 +178,9 @@
   }

   // If a valid delimiter has been specified, use it to chop of the teaser.
   if ($delimiter > 0) {
-    return substr($body, 0, $delimiter);
+    return substr($body, 0, $delimiter) . " <strong><em>...CONTINUED...</em></strong>";
   }

   // If we have a short body, the entire body is the teaser.
   if (strlen($body) < $size) {
@@ -193,14 +193,14 @@
   // the next sentence.
   $breakpoints = array('</p>' => 4, '<br />' => 0, '<br>' => 0, "\n" => 0, '. ' => 1, '! ' => 1, '? ' => 1, 'ã' => 1, 'Ø ' => 1);
   foreach ($breakpoints as $point => $charnum) {
     if ($length = strpos($body, $point, $size)) {
-      return substr($body, 0, $length + $charnum);
+      return substr($body, 0, $length + $charnum) . " <strong><em>...CONTINUED...</em></strong>";
     }
   }

   // If all else fails, we simply truncate the string.
-  return truncate_utf8($body, $size);
+  return truncate_utf8($body, $size) . " <strong><em>...CONTINUED...</em></strong>";
 }


 /**

hedgehog’s picture

personally i think the break link should be put into $content, so that it shows up in rss feeds (currently on most feeds it just looks like the entry abruptly ends, confusing folks quite a bit i imagine.)

considering this is part of a core module, a hook_readmore($message) might be nice to set a custom message, place an image instead if desired, etc?

what i wound up doing for now...well, it's a total hack since it involves commenting out a few lines in a module, but, for a phpTemplate solution...

in node.module, around line 635 or so, you should see:

if ($main == 1 && $node->teaser && $node->readmore) {
  $links[] = l(t('( read the full entry )'), "node/$node->nid", array('title' => t('Read the rest of this posting.'), 'class' => 'read-more'));
}

comment that out, then, create a node.tpl.php if you don't already have one. wherever you want your "read more" link, paste this in:

<?php if ($main == 1 && $node->teaser && $node->readmore) : ?>
  <a href="/<?php print $node_url ?>" title="read the rest of this entry">read more</a>
<?php endif; ?>

that should do it.

w4shburnj’s picture

Using the code provided here (with a tip-of-the-cap to Geary), I was unable to drop-in any of the code snippets with my theme (which is a hack of the chameleon theme).

This snippet works with drupal 4.6.5 (and I imagine the whole 4.6 series).

<?php
### Comment out this statement from your original code
#  if ($main && $node->teaser) {
#    $output .= $node->teaser;
#  }
#  else {
#    $output .= $node->body;
#  }
###

### Add this statement
  if ($main && $node->teaser) {
      if ($node->readmore) {
        $read_more = l(t('the rest of the article'), "node/$node->nid", array("title" => t("Read the rest of this posting."), "class" => "read-more"));
      }
        $my_links = $node->links;
        $rm = preg_quote(t("read more"));
        $my_links = preg_grep("/$rm/", $my_links, PREG_GREP_INVERT);
        $links[] = implode('] &middot; [', $my_links);
### Replace "] &middot; [" with whatever delimiter suits your fancy
        $output .= $node->teaser;
  }
  else {
    if ($node->links) {
        $links = $node->links;
    }
    $output .= $node->body;
    }
###

...

### Comment out this section from your original code
#  $links = array_merge($submitted, $terms);
#  if ($node->links) {
#    $links = array_merge($links, $node->links);
#  }
#  if (count($links)) {
#    $output .= " <div class=\"links\">". theme('links', $links) ."</div>\n";
#  }
###

### Add this section
  $output .= "  <div class \"links\">\n";

  if (count($read_more)) {
  $output .= "   <p>&middot; [". $read_more ."] &middot;</p>\n";
  }

  if (count($submitted)) {
  $output .= "   <p>&middot; [". theme('links', $submitted) ."] &middot;</p>\n";
  }

  if (count($links)) {
  $output .= "   <p>&middot; [". theme('links', $links) ."] &middot;</p>\n";
  }

  if (count($terms)) {
  $output .= "   <p>&middot; [". theme('links', $terms) ."] &middot;</p>\n";
  }

  $output .= " </div>\n";       # This extra tag closes the DIV tag opened by the first "links" item
###
?>
naught101’s picture

I reckon you're on to something. I'd even prefer it to be on the same line as the teaser. it's in a different colour, cause it's a link anyway so it'd be kind of obvious.

I'd also like to be able to remove the "add comment" link from the teaser. I don't want people commenting on the teaser, but on the actual page.

ToddZ-1’s picture

I agree - if a node is long enough to split to a teaser and a "read more" page, I'd like people to see the full page before commenting.

I don't like mucking about with code though. I wonder if someone could create a module to control placement of node links? ;-)

w4shburnj’s picture

Now that's a fine idea :)

Do excuse the hack 'n slash directness of the solution (and the mucking through code ;-)

Making the "add comment" link not show up on teasers is fairly easily achieved. This snippet relies on the snippet posted earlier.

<?php
### Old
#  if (count($links)) {
#  $output .= "   <p class=\"links3\">&middot; [". theme('links', $links) ."] &middot;</p>\n";
#  }
###

### New
  if (count($links)) {
    if (!count($read_more)) {
  $output .= "   <p class=\"links3\">&middot; [". theme('links', $links) ."] &middot;</p>\n";
    }
  }
###
?>

Voila! Now your users can't add comments to articles with teasers from the mainpage.

Heine’s picture

Yet Another Links Solution.

I've posted it elsewhere as well, but thought I might share here. This works for 4.7beta2.

Background $node-> links is an array with all links:

Array (
  [0] => '<a href="" title="">add new comment</a>
  [1] => '<a href="" title="">read more</a>
)

Depending on the number of nodelinks read more may be in 0 or 1 (or ?).

Goal is to convert the array to

Array (
  ['read more'] => '<a href="" title="">read more</a>'
  ['add new comment'] => '<a href="" title="">add new comment</a>'
)

But in a way that makes it also work in a translation.

In node.tpl.php (or combine with http://drupal.org/node/16383)

<?php
if (isset($node->links)) {
    foreach($node->links as $item){
      $split = preg_split("/(<a.*>|<\/a>)/U", $item, 0, PREG_SPLIT_NO_EMPTY);
      $my_links[$split[0]] = $item;
    }
}
?>

(edit: $node->links is not always set, added isset())

Then when I'm ready to print the read more links:

<?php
$rm = t('read more');      // Always use t!
if ( isset($my_links[$rm])) {
  print $my_links[$rm];
  unset($my_links[$rm]); // delete so it won't appear elsewhere
}
?>

You may beautify the printing with some divs/spans

The rest of the links can be printed in more or less the same way, a foreach loop or a simple:

<?php
    if(isset($my_links)){
      print implode($my_links, '|');
    }      
?>

Possible drawbacks: with implode, links may not always be drawn in the same order. Other point 'add new comment' changes to 'n comments' when there are comments.

--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.

archetwist’s picture

Works great. Thank you :)

dyp’s picture

Work greates! But how do the same for "user's bolg" link?

rareexample’s picture

How would I use this method to display the "# of reads" in a different area?

I tried

<?php
$rm = t('read more');      // Always use t!
if ( isset($my_links[$rm])) {
  print $my_links[$rm];
  unset($my_links[$rm]); // delete so it won't appear elsewhere
}
?>

But that dont work, any help would be greatly appreciated.

t3rmin’s picture

Something else I've just noticed, when viewing my RSS feed, is that you do want the teaser itself to reflect that there's more to the article, because that'll show up in your feed. A method like the one I posted earlier in this thread accomplishes that.

oziumjinx’s picture

Has anyone figured out how to accomplish this in 4.7?

I'd like the "Read More" link to appear right after the last word in the teaser, not in the Links area.

I'd love to see some code on this...

t3rmin’s picture

Here's a patch for a recent CVS pull of 4.7. I also make the "read more" link bigger and bright green in my CSS (http://thetrents.org/).

--- node.module 2006-03-09 14:38:40.000000000 -0800
+++ node.module 2006-03-26 18:06:53.000000000 -0800
@@ -172,7 +172,7 @@

// If a valid delimiter has been specified, use it to chop of the teaser.
if ($delimiter !== FALSE) {
- return substr($body, 0, $delimiter);
+ return substr($body, 0, $delimiter) . " ...CONTINUED...";
}

// If we have a short body, the entire body is the teaser.
@@ -187,12 +187,12 @@
$breakpoints = array('

' => 4, '
' => 0, '
' => 0, "\n" => 0, '. ' => 1, '! ' => 1, '? ' => 1, '。' => 1, '؟ ' => 1);
foreach ($breakpoints as $point => $charnum) {
if ($length = strpos($body, $point, $size)) {
- return substr($body, 0, $length + $charnum);
+ return substr($body, 0, $length + $charnum) . " ...CONTINUED...";
}
}

// If all else fails, we simply truncate the string.
- return truncate_utf8($body, $size);
+ return truncate_utf8($body, $size) . " ...CONTINUED...";
}

function _node_names($op = '', $node = NULL) {

coupet’s picture

How can I remove the "» read more" link from the front page?

Thanks, Darly

Apache is bandwidth limited, PHP is CPU limited, and MySQL is memory limited.

jasonwhat’s picture

Depending how your frontpage is setup (this matters because you might end up removing "Read More" from any page it would normally appear on) look at your css and figure out what the div tag is for read more. FireFox's web developer tools are great for this. Usually it is called

or something similar. So just add
.read-more {display: none}

to your stylesheet. If you just want the full content on the front page than change your settings so a very high number of characters are allowed on the frontpage under mysite.com/admin/node/configure or add

at the bottom of your post.

coupet’s picture

Thanks, works great!

Apache is bandwidth limited, PHP is CPU limited, and MySQL is memory limited.

sisconda’s picture

Hrmm, I'm trying to raise my character cap high, but I can't seem to find the area. When I go to mysite.com/admin/node/configure it just shows the Manage Content displaying all of my posts?

I get the headline "Settings for the core of Drupal. Almost everything is a node so these settings will affect most of the site." but nothing different from the admin/node page

Annika’s picture

I want the read more link at the end of the body text and the rest of the links in a block. Teasers should
have the commenting link removed so readers only can comment on the whole post.

I'm pretty bad at modifying modules etc, so anyone who answers, please write what goes where as that isn't very clear in the options describes above.

Thanks in advance!

/ Ayza

P.S. Maybe this hack should go into the handbook instead in a more structured way?

peterx’s picture

http://drupal.org/node/58050 is working in a 4.7.2 site and makes the comment an administration option.

petermoulding.com/web_architect

Annika’s picture

Thanks, Peter, for your reply.

However, I have no idea where to put the code. I've looked through the files that seem relevant and the only I can find that seem to match somehow is the template.php file in my theme directory. However, since a patch seemed necessary, I got the feeling it was a core function.

Please tell me what goes where!

Thanks again,

Ayza

peterx’s picture

comment_configure() is about line 350 in modules/comment.module
comment_link() is about line 180 in modules/comment.module

petermoulding.com/web_architect

Annika’s picture

Btw, do you know if there is anyway to put an extra comment link on the page, say if I want one in a block but also one at the end of a post?

How should the PHP snippet read?

alancooney’s picture

I'd like to add "...read more" to the end of each teaser, and then below that where the links normally are, show this instead (aligned to the right as usual):

Submitted by username on Mon, 2006-07-10 21:39
[catigory1/catigory2/catigory3]

Stephen’s picture

Would anybody well versed in the code care to go through and ensure this still works properly in 5.1. I'm right now as I'm writing this about to try to use it in 5.1 I'll post an update as to what I got when I'm done. However, in the meantime it might be helpful to me and everyone else if someone would run through the correct coding to be used in 5.1

rafaeldwan’s picture

for 4.x and 5.x

http://drupal.org/project/ed_readmore

sweet!

It took me like ten minutes, searching, refining the search, going through this thread, going to angrydonuts before I found it, and it hilites a frustration I've been having with drupal.org ... many search results go to long, long, no longer active threads from before 4.7 or 5.x and contain reams of code, disputed code, or irrelevant code to problems that now have either a.)different solutions in 5.x or b.)a module.

I wonder if there's some way to give weight to more recent or relevant results in searches (modules before threads?), or to archive older threads, or something. It's definitely a problem, and will get even worse as the years go on and we move to 6.x, 7.x etc.

Maybe at the release of 6.x just starting the forums fresh and creating olddrupal.org or somesuch as an archive should be considered?

Of course, this rant is at the end of one of those long, old, outdated threads, so it probably won't really get read, but it feels good to vent.

Rafael
http://mediaisland.org

VM’s picture

Using the advance search would allow you to search just for modules or projects or project pages.

betolea’s picture

Hello to everybody, I am completely new with Drupal. I need to put a "Read more... "on my main page as I will be posting some news...
What steps should I follow to make this work? I have seen in this forum some code on a template.PHP file, but I really don't know what file this is, where it is and how to do it. Can someone please tell me how to do this? (step by step). Thanks.

VM’s picture

you don't need code to do this anymore, there is a module available, ed_readmore in the downloads area. linked in this comment : http://drupal.org/node/21538#comment-237215

WeRockYourWeb.com’s picture

What if I simply want to place "read more" before "add comment" in the links section? Is there a configuration for this somewhere? I see the "first" and "last" tags in CSS but don't know where to change those...

WeRockYourWeb.com’s picture

Just found a way to do it for anyone interested. In your theme's stylesheet:

.last.node_read_more { text-align: left } 
.first.comment_comments, .first.comment_add { float: right }

Alex
----------
Contract Web Development, Inc.

WeRockYourWeb.com’s picture

To keep the links aligned horizontally in IE 6-, you need to define list elements:

ul li.last.node_read_more { text-align: left } 
ul li.first.comment_comments, ul li.first.comment_add { float: right }

Alex
----------
Contract Web Development, Inc.

tille’s picture

just in case it is still of interest: I was recently digging through the $links and the $taxonomy and found a way to cut-out whatever from within the links-array:

http://drupal.org/node/115920#comment-273091

..hope it's not too confusing - worked fine for me..:]

greetz, t..

___________________________
my pictures: www.bilderbook.org

___________________________

mrgoltra’s picture

subscribing!

peterx’s picture

davidneedham’s picture

I know this thread is old, but this is issue is much improved in D7 with granular rendering. http://drupal.org/update/themes/6/7#granular

--
David Needham
Team Lead of Training at Datadog