Seite 1 von 1

Moduloutput erzeugt immer <p></p> zu Beginn

Verfasst: Di 20. Okt 2009, 15:08
von stefkey
Hallo,

ich nutze folgendes Artikel einfügen Modul für einen Teaser. Der Moduloutput erzeugt immer ein
<p></p> zu Beginn. Ich finde aber nichts im Moduloutput.
Kann da mal jemand drüber schauen?

wenn ich Testweise den Moduloutput lösche sind auch im Frontend die <p></p> weg, also muss es vom Moduloutput kommen.

Besten Dank und Grüße,
stefkey

PS Gibt es vielleicht ein neuers "besseres" Modul welches man hierfür verwenden kann?

Code: Alles auswählen

<?php
/***********************************************
* Article Include Output
*
* Author      :     Willi Man
* Copyright   :     Contenido - four for business
* Created     :     18-12-2003
* Modified    :     02-01-2004
* Modified    :     05-08-2005, Andreas Lindner
************************************************/

#Get current settings
$cms_idcat = "CMS_VALUE[1]";
$cms_idcatart = "CMS_VALUE[2]";

$bDebug = false;
if ($bDebug) echo "<pre> cat $cms_idcat catart $cms_idcatart</pre>";

if ((strlen($cms_idcat) > 0 AND $cms_idcat != '0') AND (strlen($cms_idcatart) > 0 AND $cms_idcatart != '0')) {
    if (strlen($cms_idcatart) > 0 AND $cms_idcatart > 0) {      
        #Get idart from database
        $sql = "SELECT idcat, idart
                FROM ".$cfg["tab"]["cat_art"]."
                WHERE idcatart='".$cms_idcatart."'";
        if ($bDebug) {echo "<pre>";print_r($sql);echo "</pre>";}
        $db->query($sql);
        $db->next_record();

        $cms_catid = $db->f("idcat");
        $cms_artid = $db->f("idart");
        
        $db->free();        
    }
    
    if ($cms_idcatart == 0) {
        $cms_catid = $cms_idcat;
                
        $sql = "SELECT A.idart, B.lastmodified
                FROM ".$cfg["tab"]["cat_art"]." AS A, ".$cfg["tab"]["art_lang"]." AS B
                WHERE
                    A.idart = B.idart AND
                    B.online = 1 AND
                    A.idcat = '".$cms_idcat."'
                    ORDER BY B.lastmodified DESC";
                    
        if ($bDebug) {echo "<pre>";print_r($sql);echo "</pre>";}
        $db->query($sql);
        
        if ($db->next_record()) {
            $cms_artid = $db->f("idart");
            $lastmod = $db->f('lastmodified');
        }
        
        $db->free();
        
        $sql = "SELECT idcatart
                FROM ".$cfg["tab"]["cat_art"]."
                WHERE
                    idart = '".$cms_artid."' AND
                    idcat = '".$cms_catid."' ";
                    
        if ($bDebug) {echo "<pre>";print_r($sql);echo "</pre>";}
        $db->query($sql);
        
        if ($db->next_record()) {
            $cms_idcatart = $db->f("idcatart");
        }
        
        $db->free();        
    }   
    
    #Check if category is online or protected
    $sql = "SELECT public, visible FROM ".$cfg["tab"]["cat_lang"]." WHERE idcat='".$cms_catid."' AND idlang='".$lang."'";
    if ($bDebug) {echo "<pre>";print_r($sql);echo "</pre>";}
    $db->query($sql);
    $db->next_record();

    $public = $db->f("public");
    $visible = $db->f("visible");
        
    $db->free();

    #Check if article is online
    $sql = "SELECT online FROM ".$cfg["tab"]["art_lang"]." WHERE idart='".$cms_artid."' AND idlang='".$lang."'";
    if ($bDebug) {echo "<pre>";print_r($sql);echo "</pre>";}
    $db->query($sql);
    $db->next_record();

    $online = $db->f("online");
        
    $db->free();

    #If the article is online and the according category is not protected and visible, include the article

    if ($public == 1 AND $visible == 1 AND  $online == 1) {
        #Check if code creation is necessary
        $sql = "SELECT
                createcode
            FROM
                ".$cfg["tab"]["cat_art"]."
            WHERE
                idcat = '".$cms_catid."' AND
                idart = '".$cms_artid."'";
        if ($bDebug) {echo "<pre>";print_r($sql);echo "</pre>";}
        $db->query($sql);
        if ($db->next_record()) {
            $createcode = $db->f("createcode");
        } else {
            $createcode = 1;
        }
    
        $db->free();
        
        #Create code if necessary
        if ($createcode == 1) {
            cInclude('includes', 'functions.con.php');
            cInclude('includes', 'functions.tpl.php');
            cInclude('includes', 'functions.mod.php');
            
            conGenerateCode($cms_catid, $cms_artid, $lang, $client);
        }
        
        #Get code from database and execute it
        $sql = "SELECT code FROM ".$cfg["tab"]["code"]." WHERE idcatart = '".$cms_idcatart."' AND idlang = '".$lang."'";
        if ($bDebug) {print_r($sql);echo "</pre>";}

        $db->query($sql);
        if ($db->next_record()) {
            $code = stripslashes($db->f("code"));
            
            $db->free();
            
            ob_start();
        
            eval("?>
".$code."
<?php
");
    
            $code = ob_get_contents();
    
            #Clean buffer
            ob_end_clean();
    
            $startpos = strpos($code, "<!--start:content-->");
            $endpos = strpos($code, "<!--end:content-->");
            $difflen = $endpos - $startpos;
        
            $code = substr($code, $startpos, $difflen); 
        
            echo $code;
        } else {
            echo "<!-- ERROR in module Article Include<pre>no code created for article to include!<br>idcat $cms_catid, idart $cms_artid, idlang $lang, idclient $client</pre>-->";
        }
    }
}

?>

Re: Moduloutput erzeugt immer <p></p> zu Beginn

Verfasst: Mo 26. Okt 2009, 16:57
von McHubi
Wilde Idee: Ist im zu includenden Artikel ein <p></p> am Anfang?

Re: Moduloutput erzeugt immer <p></p> zu Beginn

Verfasst: Mo 26. Okt 2009, 17:09
von Dodger77
McHubi hat geschrieben:Wilde Idee: Ist im zu includenden Artikel ein <p></p> am Anfang?
Wahrscheinlich schon, da der TinyMCE automatisch die Inhalte mit <p></p> umschließt, wenn keine Block-Level-Elemente im Inhalt enthalten sind:

http://wiki.moxiecode.com/index.php/Tin ... root_block

Das kann man natürlich auch als System-/Mandanteneinstellung abschalten.

Re: Moduloutput erzeugt immer <p></p> zu Beginn

Verfasst: Mo 26. Okt 2009, 17:18
von stefkey
hmm, im zu includenden Artikel ist ganz normaer Inhalt, zB:

<p>Überschrift</p>
<p>Text blablabla</p>

Und im Frontend wird pötzlich:

<p></p>
<p>Überschrift</p>
<p>Text blablabla</p>

Der Artikel mit normales Template hat im Frontend auch kein <p></p>. Von daher muss doch der Modul Output hier irgendwo was erzeugen, oder nicht?

Danke und Grüße,
stefkey

Re: Moduloutput erzeugt immer <p></p> zu Beginn

Verfasst: Mo 26. Okt 2009, 17:22
von idea-tec
Könnte das dieses dämliche Leerzeichen sein, dass man nicht immer gleich sieht, wenn man Text editiert?
kann man testen, wenn man in den Text klickt (oberste Zeile) und dann mit dem Cursor mittels Pfeiltaste ganz an den Anfang geht.
ist da ein Leerzeichen, könnte es dieses sein, dass das zusätzliche p-tag erzwingt; ist es das nicht bin ich recht ratlos.

Re: Moduloutput erzeugt immer <p></p> zu Beginn

Verfasst: Mo 26. Okt 2009, 18:32
von stefkey
habs nochmal gecheckt und muss mich korrigieren:

Das Modul gibt folgendes aus:

Code: Alles auswählen

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
blablabla
</head>
<body>
<!--start:content-->
<div><p><p>
Und hier die Übeschrift.
</p>
<p>
Und hier ein Text...
</p>
</p></div>
<!--end:content-->

</body>
</html>

Hier das Include Layout:

Code: Alles auswählen

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Include Text</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--start:content-->
      <div><container id="51" name="Text" types="Content" mode="optional" default="">Include</container></div>
<!--end:content-->
</body>
</html>
Das Modul ist in meinem 1. Post.

Meiner Meinung macht das Modul hier ein <p> am Anfang und ein </p> am Ende. Und so kommt es das dann im Frontend eben <p><p>......</p></p> steht.
Kann man das ändern?

Besten Dank für die Hilfe hier und Grüße,
stefeky

Re: Moduloutput erzeugt immer <p></p> zu Beginn

Verfasst: Mo 26. Okt 2009, 18:44
von Dodger77
So, wie es aussieht, liegt es weder am Inhalt selbst, noch am Modul Article_Include, noch am Layout des inkludierten Artikels. Also wird es wohl das Modul sein, welches den Inhalt darstellt, oder dessen Modul-Template.