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
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

wulff - January 3, 2006 - 12:24

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

DriesK - January 3, 2006 - 13:14

I also can't reproduce this with latest HEAD.

#3

varunvnair - January 3, 2006 - 13:19

Make sure you are using <!--break--> and NOT <!-- break -->.

#4

Kobus - January 3, 2006 - 15:07

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

DriesK - January 6, 2006 - 17:46

Kobus, can you give us an update? Do you still experience this problem? If not, please close this issue.

#6

Kobus - January 9, 2006 - 13:27

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

greggles - January 10, 2006 - 14:39

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

Kobus - January 11, 2006 - 10:15

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

kbahey - January 17, 2006 - 17:42
Status:active» fixed

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

Kobus - January 25, 2006 - 05:56
Status:fixed» closed

Thanks! I had issues with this until about a week ago, but it seems fixed now!

Kobus

#11

Kobus - January 26, 2006 - 08:55
Status:closed» active

The bug is back! I have finally been able to reproduce exactly when this occurs. It is when you have

<?php

?>
tags in the text as well. Remove any content where
<?php

?>
tags are used, and the tags works as expected.

#12

Kobus - January 26, 2006 - 11:42
Priority:normal» critical

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

dopry - February 2, 2006 - 06:39

I can't reproduce on 4.7.0-beta4. even with the php tags..

#14

Bèr Kessels - February 2, 2006 - 09:08

Kobus, the Code you posted, to show us the tags, is filtered. Could you re-post the tags?

#15

Kobus - February 2, 2006 - 16:32

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

Steven - February 2, 2006 - 18:57
Priority:critical» normal

It should only happen if you use <?php tags /with/ the PHP filter. This is by design.

from node_teaser():

<?php
 
if (isset($format)) {
   
$filters = filter_list_format($format);
    if (isset(
$filters['filter/1']) && strpos($body, '<?') !== false) {
      return
$body;
    }
  }
?>

#17

Bèr Kessels - February 2, 2006 - 19:29
Status:active» by design

When php mode is active, we do not ever use the break!

#18

Dries - February 2, 2006 - 19:39

I don't understand why that is the case. I've wanted to do this before:


<?php print "something"; ?>
&lt;!--break--&gt;
<?php print "something else"; ?>

I think we can assume that people who use PHP-snippets know what they are doing.

#19

Bèr Kessels - February 2, 2006 - 21:14
Title: tag not functioning» make work on PHP pages
Category:bug report» task

#20

Kobus - February 7, 2006 - 13:40
Status:by design» active

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

gpk - November 29, 2007 - 22:49
Version:x.y.z» 4.7.x-dev
Status:active» fixed

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

Anonymous - December 13, 2007 - 22:51
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.