How can I remove the link "Read more" in selected pages?

Comments

mkalbere’s picture

You have many solutions ex
1) use css and .links {display:none;} (".links" depend on the theme you choosed)
2) have a look on http://api.drupal.org/api/function/template_preprocess_node/6 and unset($variable['links'])

myparis’s picture

Thanks but that's not I want to happen, I want to have an option if i want to display the link "Read more" or not.
But now I've got a solution:

In node.tpl.php I edited and wrote this one

session_start();
if ($links && !$_SESSION['remove_links']):

endif;
$_SESSION['remove_links'] = 0;

Then in each of my post i write this code at the end of the line:

Ut in pulvinar magna. Phasellus in feugiat ligula. Nulla porttitor rutrum tristique. Nullam pulvinar, lectus id hendrerit commodo, augue risus pharetra nibh, sit amet bibendum felis augue eget lectus. Sed et erat eget felis congue placerat sed nec leo. Duis sit amet purus diam, id laoreet mauris. Cras sit amet tempor nisl. Nullam semper libero elit, quis eleifend ipsum. Aliquam ut diam felis. Aliquam ac orci laoreet tellus porta faucibus...
<?php
//If I don't want to show the "Read more" link.
session_start();
$_SESSION['remove_links'] = 1;
?>

So there I can control which post will I want the "Read more" link to display or not

Max Rebo’s picture

I would like to make this very change to my site because this is exactly the type of control I want on the "Read More" link on my website.

Just wanted to know if this is acceptable, or if there is another better solution.

GreenSpiderDesign’s picture

The patent Drupal answer is that this is a "hack" and is frowned upon.

The other answer is that Drupal (at least in its present incarnation) often forces you to hack it in order to get what you want. Though in this particular case someone may actually have another solution that will provide the option you seek. I do know that the "split summary at cursor" mechanism within the node add module is a bit unfriendly - but the answer probably lies somewhere in there if there is an existing way to control it.

The challenges of building the greatest open-source framework is that there are often inconsistencies in modules. But even though you have to beat it into shape sometimes it is still the best solution IMHO.

:)

mboracci’s picture

I just pasted the additional code that was used in the node itself to turn off the "read more" link. Did not realize that I had not yet uploaded the new modified node.tpl.php file and behold the "read more" link was gone. So it works to remove the link without modifying node.tpl.php. Tested it and it certainly worked

Running Acquia_Slate and Drupal 6.x

This was the code snippet in question

//If I don't want to show the "Read more" link.
session_start();
$_SESSION['remove_links'] = 1;
imagex-1’s picture

i wanted to do the same thing - thanks for the info here , but there is another thread with a more simple sloution

http://drupal.org/node/232764

Simply add to your node body (under all your content)

AND hey presto, the "read more" link vanishes and the content has expanded!