Seite 1 von 1

Im Output Variable abspeichern

Verfasst: Di 28. Okt 2008, 22:58
von Deddy
Hallo!

Ich habe eine Frage zur Übergabe zu Variablen. CMS_VAR[x] ist der Variablen-Name die zur Übergabe des Werts an das System dient. So hab ich es in einem Handbuch gelesen. Im Inputbereich kapier ich es. Aber wie schaffe ich das im Output anzuwenden.

Gibt es eine function dafür? Oder wie schaffe ich es dass eine Variable in z.B. CMS_VALUE[35] im Output-Bereich gespeichert wird.

Verfasst: Di 28. Okt 2008, 23:34
von Martin S.
ganz einfach im Output:

Code: Alles auswählen

<?php
$variable = "CMS_VALUE[x]";
echo $variable;
?>

Verfasst: Mi 29. Okt 2008, 07:45
von Deddy
Ich wollte es genau umgekehrt haben.

Code: Alles auswählen

"CMS_VALUE[x]" = $variable ;


Aber so funktioniert das ja nicht.

Verfasst: Mi 29. Okt 2008, 08:51
von Martin S.
conSaveContentEntry ($idartlang, "CMS_IMG", "x", $variable);

Sowas in der Richtung habe ich mal als Übergabe einer ID für Bilder gemacht, weiss aber nicht ob es bei dir auch mit CMS_VALUE geht, einfach mal testen.

Verfasst: Mi 29. Okt 2008, 09:26
von Deddy
Hallo Martin!

Und wie kommst du zu $idartlang?

Ich hab alle möglich Varianten probiert. Aber nichts haut hin.

Verfasst: Mi 29. Okt 2008, 09:30
von MichFress
$idartlang ist automatisch bekannt.

Spezifizier die Aussage "Ich hab alle möglich Varianten probiert. Aber nichts haut hin." doch bitte mal...

Verfasst: Mi 29. Okt 2008, 10:03
von Deddy
Hallo!

Ja ich weiß ich sollte mich genauer ausdrücken. :-)

Ok. Ich bin jetzt nicht der große Php-Crack. Deshalb verzeiht mir falls ich den
einen oder anderen fatalen Fehler gemacht habe. Ist auch noch nicht ganz
fertig. Möchte dann noch ein Modul-Template einbauen. Zu sehen ist das unter
http://www.die-lumpen.de/photos/band-photos.html
Außerdem sind noch Sachen drin, die raus gehören.

Ich habe mir das List-Modul etwas aufgebohrt. Ich kann mit meiner Liste
mehrere Lightbox-Gallery Artikel auslesen. Aber immer nur die ersten 3
Bilder und eben die Überschrift. Dazu hab ich in das Lightbox-Gallery Modul
noch zwei Marker vor das ausgegebene Bild gesetzt. Besser gesagt in das
Modul Template lightbox-gallery_image.html.

Code: Alles auswählen

<td class="gallery_image">
    <div class="link">   
    <a href="{LINK}" rel="lightbox[Images]" title="{LINKDESCRIPTION}">
    <!--BEGINN-->
    <img src="{FILE}" title="{MEDIANAME}" alt="{DESCRIPTION}" />
    <!--STOP-->
    </a>    
    </div>
    <div class="medianame"><h3>{MEDIANAME}</h3></div>
    <div class="description">{DESCRIPTION}</div>
</td>
Das ganze Problem dabei ist, dass die Lightbox-Gallery dynamisch
erzeugt wird und nicht abgespeichert wird. Dadurch dauert es eine ganze
Weile bis meine Seite geladen wird. Ich habs zwar auf 10 Artikel begrenzt.
Aber es dauert immer noch zu lange.
Jetzt war meine Idee, dass ich in den Input-Bereich einen Schalter einbaue,
mit dem ich die Seite einmal automatisch genieren lasse und anschließend
in eine Variable abspeichere, die ich dann in der DB ablegen kann. Also
eine Art Cache baue. Ich hoffte, dass ich das mit CMS_VAR irgendwie schaffen könnte.

Hier nun mein Code:

Input:


Und der Output:

Code: Alles auswählen

?><?php
/***********************************************
* CONTENIDO MODUL - INPUT
*
* Modulname  :      News
* Author(s)   :     Andreas Lindner, 4fb
* Copyright   :     Contenido - four for business, Andreas Lindner
* Created     :     12.08.2005
************************************************/

#Select category
$cms_idcat = "CMS_VALUE[1]";

echo '<table cellpadding="0" cellspacing="0" border="0">';

echo '
        <tr><td class="text_medium" style="padding:5px">Kategorie wählen: </td></tr>
        <tr><td class="text_medium" style="padding:5px">';

echo buildCategorySelect("CMS_VAR[1]", "CMS_VALUE[1]");
echo '&nbsp;<input type="image" src="images/submit.gif">';

echo '</td></tr>';

#Select sort field and sort order
$sortdate = 'checked';
$cms_imgsize = "CMS_VALUE[14]";
$cms_limit_articles = "CMS_VALUE[15]";
$cms_sort_direction = "CMS_VALUE[16]";

if ("CMS_VALUE[4]" != '') {
    $article_stored = ' checked';
} else {
    $article_stored = '';
}





if ("CMS_VALUE[17]" != '') {
    $cms_include_start_article = ' checked';
} else {
    $cms_include_start_article = '';
}

if ("CMS_VALUE[3]" == 'sortdate') {
    $sortdate = 'checked';
    $sortnum = '';
}
elseif ("CMS_VALUE[3]" == 'sortnum') {
    $sortdate = '';
    $sortnum = 'checked';
}

echo '
        <tr>
          <td class="text_medium" style="padding:5px;">'.mi18n("Sortierung nach Datum").':</td>
          <td style="padding:5px;"><input type="radio" name="CMS_VAR[3]" value="sortdate" '.$sortdate.'></td>
        </tr>
        <tr>
          <td class="text_medium" style="padding:5px;">'.mi18n("Sortierung nach Nummer").':</td>
          <td style="padding:5px;"><input type="radio" name="CMS_VAR[3]" value="sortnum" '.$sortnum.'></td>
        </tr>
        <tr>
          <td class="text_medium" style="padding:5px;">'.mi18n("Sortierung aufsteigend").':</td>
          <td style="padding:5px;">';
if (strtolower($cms_sort_direction) == 'desc') {
    echo '<input type="radio" name="CMS_VAR[16]" value="asc"/>';
} else {
    echo '<input type="radio" name="CMS_VAR[16]" value="asc" checked/>';
}
echo '</td>
        </tr>
        <tr>
          <td class="text_medium" style="padding:5px;">'.mi18n("Sortierung absteigend").':</td>
          <td style="padding:5px;">';
if (strtolower($cms_sort_direction) == 'desc') {
    echo '<input type="radio" name="CMS_VAR[16]" value="desc" checked/>';
} else {
    echo '<input type="radio" name="CMS_VAR[16]" value="desc"/>';
}
echo '</td>
        </tr>';



#Number of articles
echo '
        <tr>
          <td class="text_medium" style="padding:5px;">'.mi18n("Anzahl Artikel begrenzen").':</td>
          <td style="padding:5px;"><input type="text" name="CMS_VAR[15]" value="'.$cms_limit_articles.'"></td>
        </tr>';
#Include start article
echo ' 
        <tr> 
          <td class="text_medium" style="padding:5px;">'.mi18n("Startartikel in Liste einbeziehen").':</td> 
          <td style="padding:5px;"><input type="checkbox" name="CMS_VAR[17]" value="yes"'.$cms_include_start_article.'></td> 
        </tr>';

#Speichern der Seite
echo ' 
        <tr> 
          <td class="text_medium" style="padding:5px;">'.mi18n("Bilderliste speichern").':</td> 
          <td style="padding:5px;"><input type="checkbox" name="CMS_VAR[4]" value="yes"'.$article_stored.'></td> 
        </tr>';

echo '</table>';
?><?php


Output:

Code: Alles auswählen

<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname  :      News
* Author(s)   :     Andreas Lindner, 4fb
* Copyright   :     Contenido - four for business, Andreas Lindner
* Created     :     12.08.2005
************************************************/

cInclude('classes', 'class.article.php');
cInclude('includes', 'functions.api.string.php');
cInclude('includes', 'functions.api.images.php');

if (!is_object($tpl)) {
    $tpl = new Template;
}

$inhalt = "";

$tpl->reset();

$sql = "SELECT
            htmlpath, frontendpath
        FROM
            ".$cfg["tab"]["clients"]." 
        WHERE
            idclient = ".$client." ";

$db->query($sql);

if ($db->next_record()) {
    $htmlpath = $db->f('htmlpath');
    $frontendpath = $db->f('frontendpath');
}

// selected category
$selcat = "CMS_VALUE[1]";
$template = "termine_lumpen.html";
// anzahl der zeichen text


$limit = "CMS_VALUE[15]";

$cms_sort_direction = "CMS_VALUE[16]";
if ($cms_sort_direction == '') {
    $cms_sort_direction = 'desc';
}

if ("CMS_VALUE[3]" == "sortdate") {
    $order = 'lastmodified';
} else {
    $order = 'artsort';
}

if ("CMS_VALUE[17]" != '') {
    $with_start = true;
} else {
    $with_start = false;
}

$speichern = "CMS_VALUE[4]";

$tpl->set('s', 'TITLE', $newsheadline);




if ($speichern == "yes" ) {


if (strlen($selcat) > 0 AND $selcat != '0') { 
   if ("CMS_VALUE[17]" != '') { 
      $options = array ('idcat' => $selcat, "start" => true, "order" => $order, "direction" => $cms_sort_direction); 
   } else { 
      $options = array ('idcat' => $selcat, "start" => false, "order" => $order, "direction" => $cms_sort_direction); 
   }



    $list = new ArticleCollection($options);

    $count = $list->count;
    


    if ($count > 0) {
        if (is_numeric($limit) AND strlen($limit) > 0) {
            if ($limit < $list->count) {
                $limit_art = $limit;
            } else {
                $limit_art = $list->count;
            }
        } else {
            $limit_art = $list->count;
        }

        for ($i = 0; $i < $limit_art; $i ++) {

            $article = $list->nextArticle();

            $article_id = $article->getField('idart');
           
            $headline = strip_tags($article->getContent('CMS_HTMLHEAD', 1));
            $headline = str_replace($replace, " ", $headline);


            $teaserheadline = /*$subheadline."&nbsp;-&nbsp;".*/
            $headline;
            $href = $sess->url("front_content.php?idcat=$selcat&idart=$article_id");
            $teasertext = $article->getField('summary');
            
            
            // BEGIN SRIPT
   
             $url = $sess->url("http://www.die-lumpen.de/cms/front_content.php?idart=$article_id"); //URL of the feed.
         
                  
             $data = file_get_contents($url); 
                       
             $images = explode('<!--BEGINN-->', $data, -1);
                 
         

                           
             $img_ausgabe_1 = explode('<!--STOP-->', $images[1], -1);
             $img_ausgabe_2 = explode('<!--STOP-->', $images[2], -1);
             $img_ausgabe_3 = explode('<!--STOP-->', $images[3], -1);
         
         
         
             if($img_ausgabe_1[0] || $img_ausgabe_2[0] || $img_ausgabe_3[0]) {
             $inhalt .= $headline."<br>"; 
 
             $inhalt .= '<a href="'.$href.'">'.$img_ausgabe_1[0]."</a>  ";
             $inhalt .= '<a href="'.$href.'">'.$img_ausgabe_2[0]."</a>  ";
             $inhalt .= '<a href="'.$href.'">'.$img_ausgabe_3[0]."</a>  ";
             $inhalt .= "<br>====================================<br><br><br>";
             }
         


            } // end for



            $tpl->generate('templates/'.$template);

        }
    }

echo $inhalt;

conSaveContentEntry ($idartlang, "CMS_VALUE", 35, $inhalt); 

} else {

$inhaltausgabe = "CMS_VALUE[35]";
echo $inhaltausgabe;
}

?>


Und hier im letzten Teil wollte ich es in diesen Cache legen:


Code: Alles auswählen

conSaveContentEntry ($idartlang, "CMS_VALUE", 35, $inhalt); 

} else {

$inhaltausgabe = "CMS_VALUE[35]";
echo $inhaltausgabe;
}
Aber so gehts ja nicht :-)


Wär schön, wenn jemand eine Lösung wüsste

Re: Im Output Variable abspeichern

Verfasst: Sa 28. Feb 2009, 12:38
von Deddy
Hallo!

Endlich hab ich wieder mal Zeit gefunden hier weiter zu machen.

Hab des Rätsels Lösunge gefunden. Wen es interessiert:

Code: Alles auswählen

conSaveContentEntry ($idartlang, "CMS_HTML", 35, $inhalt); 


} else {

echo "CMS_HTML[35]";

}