Forums / General / Extra <br /> tag while using linebreaks with paragraph

Extra <br /> tag while using linebreaks with paragraph

Author Message

John Smith

Monday 20 March 2006 6:24:17 am

If you enter a text with a linebreak you will get the following results:

<p>test<br />text<br /></p>

The issue is with the last <br /> in the example. It is completly unneeded..

Is it a bug, has anybody solved it?

Please help

Cheers

John Smith

Kirill Subbotin

Thursday 23 March 2006 1:34:31 am

It's a bug. We will try to fix it soon.

I've added a bug report http://ez.no/bugs/view/8028

John Smith

Friday 24 March 2006 6:16:48 am

hi Kirill,

Thanks for your reply. Mate I think you have solved the bug. Would it be possible to know the changes, so that i can update my version.

Cheers

Regards
John..

Kirill Subbotin

Monday 27 March 2006 1:13:01 am

Yes, here is the patch:

Modified: trunk/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
===================================================================
--- trunk/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php	2006-03-24 11:26:45 UTC (rev 15292)
+++ trunk/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php	2006-03-24 11:29:44 UTC (rev 15293)
@@ -341,8 +341,20 @@
 
         $sectionLevel = $currentSectionLevel;
         $class = $paragraph->attributeValue( 'class' );
+        $curChildIndex = 0;
+        $totalChildren = count( $paragraph->children() );
         foreach ( $paragraph->children() as $paragraphNode )
         {
+            $curChildIndex++;
+
+            if ( $curChildIndex == $totalChildren ) 
+            {
+              $this->LastParagraphChild = true;
+            }
+            else
+            {
+                $this->LastParagraphChild = false;
+            }
             $isBlockTag = false;
             $content =& $this->renderXHTMLTag( $tpl, $paragraphNode, $sectionLevel, $isBlockTag, $tdSectionLevel );
             if ( $isBlockTag === true )
@@ -1020,6 +1032,12 @@
                 $tpl->setVariable( 'content', $childTagText, 'xmltagns' );
                 $uri = "design:content/datatype/view/ezxmltags/$tagName.tpl";
 
+                //force rendering last line without <br> i.e. as plain text
+                if ( $tagName == 'line' && $this->LastParagraphChild ) 
+                {
+                    $uri = "design:content/datatype/view/ezxmltags/text.tpl";
+                }
+
                 $textElements = array();
                 include_once( 'lib/eztemplate/classes/eztemplateincludefunction.php' );
                 eZTemplateIncludeFunction::handleInclude( $textElements, $uri, $tpl, 'foo', 'xmltagns' );
@@ -1110,6 +1128,10 @@
 
     /// Contains the Nodes hashed by ID
     var $NodeArray = array();
+    
+    /// Contains boolean flag if current child is last among paragraph children
+    /// used when rendering last <line> tag.
+    var $LastParagraphChild = false;
 
     /// Array of parameters for rendering tags that are children of 'link' tag
     var $LinkParameters = array();

John Smith

Monday 27 March 2006 1:42:13 am

hi Kirill,

Thanks for your kind help. I just want to know whether this patch is applicable to ezpublish 3.6.1

I am using ez 3.6.1 at the moment.

Thanks in advance.

Cheers

John...

Kirill Subbotin

Monday 27 March 2006 2:02:50 am

Not sure about 3.6.1, may be, but most likely it should work with the latest 3.6.*

John Smith

Monday 27 March 2006 2:19:27 am

Thanks,

I have tried on ezpublish 3.6.1, it seems to be working.Obviously the line numbers are different what you said in your last reply.

Once again thanks for your kind help.

Cheers.

John...

eZ debug

Timing: Jan 19 2025 01:10:56
Script start
Timing: Jan 19 2025 01:10:56
Module start 'content'
Timing: Jan 19 2025 01:10:57
Module end 'content'
Timing: Jan 19 2025 01:10:57
Script end

Main resources:

Total runtime0.6688 sec
Peak memory usage4,096.0000 KB
Database Queries206

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0081 590.2109180.8203
Module start 'content' 0.00810.5344 771.0313517.9297
Module end 'content' 0.54250.1262 1,288.9609337.7891
Script end 0.6687  1,626.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.6057210.0002
Check MTime0.00150.2229210.0001
Mysql Total
Database connection0.00080.112410.0008
Mysqli_queries0.598289.45222060.0029
Looping result0.00210.30842040.0000
Template Total0.638295.420.3191
Template load0.00200.298320.0010
Template processing0.636295.135820.3181
Template load and register function0.00020.036210.0002
states
state_id_array0.00090.137110.0009
state_identifier_array0.00140.203520.0007
Override
Cache load0.00170.2505370.0000
Sytem overhead
Fetch class attribute can translate value0.00160.237330.0005
Fetch class attribute name0.00100.148570.0001
XML
Image XML parsing0.00040.056730.0001
class_abstraction
Instantiating content class attribute0.00000.001670.0000
General
dbfile0.00520.7816210.0002
String conversion0.00000.001130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 19
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs