Unwanted line break generated

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
Jimmy_Jazz
Posts: 23
Joined: Thu 28. Oct 2004, 13:04
Location: London

Unwanted line break generated

Post by Jimmy_Jazz »

Firstly, thanks Oliver for a great CMS. Ive tried so many CMS solutions and this by far is the easiest and most concise for my purposes. Ive been searching the forum for a month or so now and have found all the answers to my questions - great community!

Anyway - heres my problem:

Ive been adding html content parts to my articles like this:

Image

When I then view this page in my browser the CMS has placed an unwanted and <br /> tag:

Image

Any ideas how I can get rid of this line break?


Thanks
submike
Posts: 50
Joined: Wed 25. Aug 2004, 17:36
Location: Chicago
Contact:

Post by submike »

Just curious, did you find a solution to this? I ran into the same problem.
kubens
Posts: 168
Joined: Sat 6. Nov 2004, 15:29
Location: Duesseldorf near Cologne ;-)

Post by kubens »

I have the same problem. The only way to solve this is to modify directly the files which are repsonsible for rendering the different block elements. Take a look into the folder include/inc_frontend/content. For example cnt14.article.inc.php is responsible for rendering a HTML block element:

Code: Select all

//HTML

$content["main"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
$content["main"] .= ($crow["acontent_html"]) ? "<br />".$crow["acontent_html"] : "";
Peekay
Posts: 286
Joined: Sun 25. Jul 2004, 23:24
Location: UK

Post by Peekay »

Hi Kubens. Thanks for the tip about this. The extra space has been bugging me for a while too. I assume the 'cntnn.article.inc.php' file generates plain HTML content part? Do you know if I (we) would need to remove the <br /> tag from any other files? :?:
kubens
Posts: 168
Joined: Sat 6. Nov 2004, 15:29
Location: Duesseldorf near Cologne ;-)

Post by kubens »

Yes, it seems to me that it is necessary to overwork all files in that folder, but I am not sure at this moment. Furthermore there was anything else buggy, but I could not remember. If I am back at home, i will examine my sources and will post my results.
kubens
Posts: 168
Joined: Sat 6. Nov 2004, 15:29
Location: Duesseldorf near Cologne ;-)

Post by kubens »

Durring some tests last days I recognized some additional unmeanted <br /> tags in my html source. After some tests I found out that the problem was the following line:

Code: Select all

$content["main"] .= nl2br(div_class($crow["acontent_text"],$template_default["article"]["text_class"])); 
after i replaced the line above by the following one the <br /> tags are gone with the wind.

Code: Select all

$content["main"] .=	nl2br($crow["acontent_text"]);
Unfortunatelly I have no experience with PHP, so i was not able to analyze the nl2br function in more detail. But maybe we have another member of this forum, who is able to bring more details forward?
Karla
Posts: 223
Joined: Tue 26. Oct 2004, 11:56

Post by Karla »

kubens wrote:I have the same problem. The only way to solve this is to modify directly the files which are repsonsible for rendering the different block elements. Take a look into the folder include/inc_frontend/content. For example cnt14.article.inc.php is responsible for rendering a HTML block element:

Code: Select all

//HTML

$content["main"] .= headline($crow["acontent_title"], $crow["acontent_subtitle"], $template_default["article"]);
$content["main"] .= ($crow["acontent_html"]) ? "<br />".$crow["acontent_html"] : "";
That is actually for WYSIWYG HTML.
cnt6.article.inc.php is for HTML, BUT it is all brought together in content.article.inc.php:

Code: Select all

$content["main"] .= "<a name="jump".$row["article_id"].""></a>";

Code: Select all

if($content["summary"]) {
	$content["main"] .= $content["summary"];
	$content["main"] .= $template_default["article"]["head_after"];

Code: Select all

$content["main"] .= ($crow["acontent_before"]) ? "<br />".spacer(1,$crow["acontent_before"]) : "";
	
	switch($crow["acontent_type"]) { //Felder für passenden Content Type
	
		case 1:		include("include/inc_front/content/cnt1.article.inc.php");	break;	//Text mit Bild
		case 2:		include("include/inc_front/content/cnt2.article.inc.php");	break;	//Nur Bilder
		case 3:		include("include/inc_front/content/cnt3.article.inc.php");	break;	//Link & Email
		case 4:		include("include/inc_front/content/cnt4.article.inc.php");	break;	//Bullet List
		case 5:		include("include/inc_front/content/cnt5.article.inc.php");	break;	//Link Liste
		case 6:		include("include/inc_front/content/cnt6.article.inc.php");	break;	//HTML
		case 14:	include("include/inc_front/content/cnt14.article.inc.php");	break;	//WYSIWYG HTML
		case 7:		include("include/inc_front/content/cnt7.article.inc.php");	break;	//File List
		case 8:		include("include/inc_front/content/cnt8.article.inc.php");	break;	//Link Article
		case 15:	include("include/inc_front/content/cnt15.article.inc.php");	break;	//Article Menu
		case 9:		include("include/inc_front/content/cnt9.article.inc.php");	break;	//Multimedia
		case 10:	include("include/inc_front/content/cnt10.article.inc.php");	break;	//Email Form
		case 11:	include("include/inc_front/content/cnt11.article.inc.php");	break;	//Code
		case 12:	include("include/inc_front/content/cnt12.article.inc.php");	break;	//Newsletter Subscription
		case 13:	include("include/inc_front/content/cnt13.article.inc.php");	break;	//Search Form
		case 16:	include("include/inc_front/content/cnt16.article.inc.php");	break;	//Ecard
		case 18:	include("include/inc_front/content/cnt18.article.inc.php");	break;	//guestbook
		case 19:	include("include/inc_front/content/cnt19.article.inc.php");	break;	//sitemap
		case 20:	include("include/inc_front/content/cnt20.article.inc.php");	break;	//bid
		case 21:	include("include/inc_front/content/cnt21.article.inc.php");	break;	//page / ext. content
		case 50:	include("include/inc_front/content/cnt50.article.inc.php");	break;	//reference
		case 100:	include("include/inc_front/content/cnt100.article.inc.php");break;	//<ul>/<li> Liste
		default:	include("include/inc_front/content/cnt0.article.inc.php");	break;	//Text

	}
	
	//Standardfelder Abschluß
	if($crow["acontent_top"]) { //check if top link should be shown
		if($template_default["article"]["top_sign_before"].$template_default["article"]["top_sign_after"]) {
			$content["main"] .= $template_default["article"]["top_sign_before"];
			$content["main"] .= '<a href="#top">'.$template_default["article"]["top_sign"].'</a>';
			$content["main"] .= $template_default["article"]["top_sign_after"];
		} else {
			$content["main"] .= '<br /><a href="#top">'.$template_default["article"]["top_sign"].'</a>';
		}						
	}
	$content["main"] .= ($crow["acontent_after"]) ? "<br />".spacer(1,$crow["acontent_after"]) : "";
	
}
mysql_free_result($cresult);
}
}
}

$content["main"] = str_replace("</table>\n<br />", "</table>\n", $content["main"]);
$content["main"] = str_replace("</table><br />", "</table>", $content["main"]);
$content["main"] = str_replace("</div><br />", "</div>", $content["main"]);
Post Reply