make <!--break--> work on PHP pages
Kobus - January 3, 2006 - 07:55
| Project: | Drupal |
| Version: | 4.7.x-dev |
| Component: | node system |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Hi!
In previous versions of Drupal I could split a node to have a "read more" section by using the <!--break--> tag. It seems that I can't do that with Drupal CVS of 19 December (or thereabouts). According to replies I received from the support list, this is probably a bug in the node system, and therefore I am filing it as such.
Regards,
Kobus

#1
Can you give an example of the content your were testing with?
Have you changed the teaser length at admin/settings/node?
I can't reproduce with the latest CVS version. (I tested with a couple of paragraphs of lorem ipsum text.)
#2
I also can't reproduce this with latest HEAD.
#3
Make sure you are using <!--break--> and NOT <!-- break -->.
#4
Someone else on the support list had the same issue. I am downloading the latest Drupal now to see if that is still the case. If not so, it means it has been fixed. Thanks!
Kobus
#5
Kobus, can you give us an update? Do you still experience this problem? If not, please close this issue.
#6
Hi,
I still experience this problem. I have replaced node.module on my test site with a version that is from a later CVS update and still gets that problem. I have played around quite a lot with input formats, and I am wondering if that is not where the issue lies? Is that possible?
If not, I will replace my copy of Drupal with a complete newer version, but I have done quite some modifications to the search module that I don't want to undo, so that will be the last resort. I will provide more feedback a.s.a.p.
Regards,
Kobus
#7
In 4.6.5 I found that I had to use "full html" filter in order for this to work.
Perhaps that is why some people can find it and others can't is due to their default input filter?
#8
I have disabled HTML filtering in my input formats, so I doubt that is the problem in my case. I will see if Drupal 4.7 beta 3 still has this problem for me.
Kobus
#9
I tried with today's HEAD of Drupal CVS, and the break tag works as expected, even when using Filtered HTML as an input format.
#10
Thanks! I had issues with this until about a week ago, but it seems fixed now!
Kobus
#11
The bug is back! I have finally been able to reproduce exactly when this occurs. It is when you have
<?php
?>
<?php
?>
#12
Changing priority. This is indeed critical in my opinion, although it will mostly not affect end users, but adminsitrators who like to customize content.
#13
I can't reproduce on 4.7.0-beta4. even with the php tags..
#14
Kobus, the Code you posted, to show us the tags, is filtered. Could you re-post the tags?
#15
I have just reproduced it with Drupal 4.7.beta4 at www.drupal.co.za.
<?php
$result1 = db_result(db_query("SELECT COUNT(`translation`) from {locales_target} WHERE `translation` != ''"));
$result2 = db_result(db_query("SELECT COUNT(`translation`) from {locales_target}"));
print "<span style=\"font-size: 56px; font-family: monotype corsiva, arial; color: #008000\">" . round($result1 / $result2 * 100, 2) . "%</span><br />(" . $result1 . " van " . $result2 . " stringe)";
?>
If you don't understand the text, I apologize, but the code above shows to me that there is no fault with the code, as the display is done as I expect it to. The moment I put that (tags and code) in the node, the tag doesn't work. Here is the complete source of that node:
<p>En wie dink ons is ons besig om om die bos te lei? As iets nuut is kan dit nie verbeter wees op dieselfde tyd nie. As dit verbeter is, kan dit nie nuut wees nie. Kom ons sê maar dit is nuut vir so dag of wat, en van daar af kan dit net verbeter!</p>
<p>Drupal.co.za. is tans besig om "ons eie hondekos te eet" en "ons eie sjampanje te drink". Daar is sekerlik nog BAIE metafore hiervoor, maar die betekenis daarvan is dat ons opgradeer na die jongste weergawe van Drupal. As ons nie self bereid is om dit te doen nie, hoe kan ons van ander mense verwag om dit te doen?</p>
<?php
$result1 = db_result(db_query("SELECT COUNT(`translation`) from {locales_target} WHERE `translation` != ''"));
$result2 = db_result(db_query("SELECT COUNT(`translation`) from {locales_target}"));
print "<span style=\"font-size: 56px; font-family: monotype corsiva, arial; color: #008000\">" . round($result1 / $result2 * 100, 2) . "%</span><br />(" . $result1 . " van " . $result2 . " stringe)";
?>
<!--break-->
<p>Die opgradering is klaar gedoen, maar die inhoud, vertaling en tema is nog besig om geskep te word. Wees asseblief geduldig. Indien jy na die 4.6.x weergawe se Afrikaanse weergawe soek, is dit nog op die <a href="http://www.drupal.co.za/4.6/">ou blad</a> beskikbaar. Ons sal in die volgende dag of twee klaar wees met die inhoud van die blad, die vertaling so iewers in volgende week en die tema die week daarna.</p>
<p>Indien jy betrokke wil raak by die Afrikaanse vertalingsproses, skakel asseblief vir <a href="?q=user/1/contact">Kobus</a> vandag nog.</p>
#16
It should only happen if you use <?php tags /with/ the PHP filter. This is by design.
from node_teaser():
<?phpif (isset($format)) {
$filters = filter_list_format($format);
if (isset($filters['filter/1']) && strpos($body, '<?') !== false) {
return $body;
}
}
?>
#17
When php mode is active, we do not ever use the break!
#18
I don't understand why that is the case. I've wanted to do this before:
<?php print "something"; ?>
<!--break-->
<?php print "something else"; ?>
I think we can assume that people who use PHP-snippets know what they are doing.
#19
#20
I also think this is handy. If you allow users to insert PHP code on your site, you obviously trust them enough to do so. If you don't, you won't give that access
If you add php code and break your site with it, it is usually not difficult to fix it again, unless you really went out to see if you can break it, but then that would be your own problem :-)
Kobus
PS: Since it is now a task, I am going to take it off "by design", as I am sure it is not going to be easily detected in this state.
#21
This now works: the logic of node_teaser() was changed in 4.7 (not sure which subversion) - compare http://api.drupal.org/api/function/node_teaser/4.7 with http://api.drupal.org/api/function/node_teaser/4.6.
[Update]
Was finally fixed in this issue http://drupal.org/node/49926 on 4 Dec 2006 after a partial fix in http://drupal.org/node/80989 in Sept 2006.
#22
Automatically closed -- issue fixed for two weeks with no activity.