php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2006

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 02.09.2006, 12:31  
Erfahrener Benutzer
 
Registriert seit: 16.02.2006
Beiträge: 303
tinchen
Standard Text Array, auch wenn keine Ausgabe Array ist?

Hallo zusammen,

ich habe wieder einmal etwas sehr merkwürdiges produziert.
Keiner meiner Ausgaben ist ein Array, trotzdem steht unter dem
HTML Code unter der Seite einfach:

Array

Ich habe nun schon mehrere Möglichkeiten ausgeschlossen, aber kann
Fehler einfach nicht finden.
Ausgegeben werden soll nur:

PHP-Code:
<?php if(count($categories)) { ?>
             <form action="index.php" method="post" name="catForm">
            <input type="hidden" name="option" value="<?php echo $option?>" /> 
            <input type="hidden" name="task" value="<?php echo $task?>" />

            <p style="white-space: nowrap;">

                <?php if($precatlist) { ?>
                    <label for="catid"><?php echo $precatlist?></label>
                <?php ?>

                <?php echo $cat_list?>
        
                <?php if($okbutton) { ?>
                    <input type="submit" value="OK" name="select" class="button" />
                <?php ?>
            </p>

            <input type="hidden" name="Itemid" value="<?php echo $_Itemid?>" />
        </form>
    <?php ?>


    <?php if(count($contents) && !empty($catid)) { ?>

        <form action="index.php" method="post" name="contentForm">
            <input type="hidden" name="option" value="com_content" /> 
            <input type="hidden" name="task" value="view" />

            <p style="white-space: nowrap;">

                <?php if($precontentlist) { ?>
                    <label for="id"><?php echo $precontentlist?></label>
                <?php ?>

                <?php echo $content_list?>
            
                <?php if($okbutton) { ?>
                    <input type="submit" value="OK" name="select" class="button" />
                <?php ?>
            </p>
            <input type="hidden" name="Itemid" value="<?php echo $_Itemid?>" />
            <input type="hidden" name="catid" value="<?php echo $catid?>" />
        </form>
    <?php }  ?>
In der Ausgabe dann:
Code:
<form action="index.php" method="post" name="contentForm">
			<input name="option" value="com_content" type="hidden"> 
			<input name="task" value="view" type="hidden">

			<p style="white-space: nowrap;">

				
				
<select name="id" class="inputbox" size="1" onchange="document.contentForm.submit();">
	<option value="">Content</option>
	<option value="2">Newsflash 1</option>
	<option value="3" selected="selected">Newsflash 2</option>
	<option value="4">Newsflash 3</option>

</select>
			
							</p>
			<input name="Itemid" value="9" type="hidden">
			<input name="catid" value="3" type="hidden">
		</form>
	Array
Versteh ich nicht.

Gruß
Tine
tinchen ist offline  
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 02.09.2006, 13:31  
Erfahrener Benutzer
 
Registriert seit: 21.05.2008
Beiträge: 9.937
Zergling-new wird schon bald berühmt werden
Standard

Dann gehts in deinem Quelltext eben noch weiter.
Zergling-new ist offline  
Alt 02.09.2006, 13:37  
¯\_(ツ)_/¯
 
Benutzerbild von Flor1an
 
Registriert seit: 18.06.2008
Beiträge: 8.814
PHP-Kenntnisse:
Fortgeschritten
Flor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer Anblick
Standard

Könnte ja auch im PHP Quelltext stehen nicht nur in diesem Template (ich nehm mal an es ist ein Template).
__________________
▇█▓▒░◕‿‿◕░▒▓█▇
Flor1an ist offline  
Alt 02.09.2006, 14:18  
Erfahrener Benutzer
 
Registriert seit: 16.02.2006
Beiträge: 303
tinchen
Standard

Diese Array taucht nur auf, wenn $catid nicht leer ist.
Im PHP Code gibt es keine Ausgaben und es ist ausgeschlossen, dass dieses Array aus anderen Teilen kommen kann. Es muss sich hier irgendwo verstecken.

Das Problem ist wohl mal wieder, das ihr mit dem Code nicht allzuviel anfangen könnt, da ich ja auf eine ganze Funktionsreferenz zurückgreien kann. Aus diesem Grund habe ich die wichtigsten Funktionen auch angehängt. Ich sehe da kein Array.

PHP-Code:
/** ensure this file is being included by a parent file */
defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

$sections        $params->get'sections''' );
$okbutton        $params->get'okbutton''1' );
$pretext        $params->get'pretext''' );
$precatlist        $params->get'precatlist''' );
$precontentlist        $params->get'precontentlist''' );
$firstcatoption     $params->get'firstcatoption''' );
$firstcontentoption    $params->get'firstcontentoption''' );
$defaultItemid        intval$params->get'defaultitemid''' ) );

$catid             intval(  mosGetParam$_REQUEST'catid'''  ) );
$id             intvalmosGetParam$_REQUEST'id''' ) );
$option         mosGetParam$_REQUEST'option''' );
$task             mosGetParam$_REQUEST'task''' );


global 
$Itemid;

    if(
$Itemid) {
        
$_Itemid $Itemid;
    } else {
        
$_Itemid 0;
    } 

    if(
$defaultItemid) {
        
$_Itemid $defaultItemid;
    }



global 
$database$my;


    
$query "SELECT c.id, c.name FROM jos_categories AS c" 
        
."\n INNER JOIN jos_sections AS s ON s.id=c.section"
         
."\n WHERE c.access<=".$my->gid
        
. (!empty($sections) ? ' AND c.section IN ('.$sections.')' '')
         .
"\n AND c.published=1"
         

    
$database->setQuery$query );
    
$cats $database->loadObjectList();

    
    
$categories = array();

    if (!empty(
$firstcatoption) || (count($row)<=&& !$okbutton)) {

        
$categories[] = mosHTML::makeOption''$firstcatoption );
    }

    foreach ( 
$cats as $cat ) {
    
        
$categories[] = mosHTML::makeOption$cat->id$cat->name);

    }


    
$cat_list mosHTML::selectList$categories'catid''class="inputbox" size="1" onChange="document.catForm.submit();"''value''text'$catid );




    if(!empty(
$catid)) {

    
$query "SELECT id, title FROM #__content" 
         
."\n WHERE catid=".$catid
         
."\n AND access<=".$my->gid
         
."\n AND state=1"
         
. (!empty($sections) ? ' AND section IN ('.$sections.')' '')
         ; 
    
$database->setQuery$query );
    
$content $database->loadObjectList();

    
$contents = array();

    if (!empty(
$firstcontentoption) || (count($content)<=&& !$okbutton)) {

        
$contents[] = mosHTML::makeOption''$firstcontentoption );
    }

    foreach ( 
$content as $c ) {

        
$contents[] = mosHTML::makeOption$c->id$c->title );

    }

    
$content_list mosHTML::selectList$contents'id''class="inputbox" size="1" onChange="document.contentForm.submit();"''value''text'$id );

    }    
    
?> 
PHP-Code:
function makeOption$value$text=''$value_name='value'$text_name='text' ) {
$obj = new stdClass;
$obj->$value_name $value;
$obj->$text_name trim$text ) ? $text $value;
return 
$obj;

PHP-Code:
function selectList( &$arr$tag_name$tag_attribs$key$text$selected=NULL$idtag=false$flag=false ) {

reset$arr );

$id $tag_name;

if ( 
$idtag ) {
    
$id $idtag;
}

$html '<select name="'$tag_name .'" id="'$id .'" '$tag_attribs .'>';

for (
$i=0$n=count$arr ); $i $n$i++ ) {

if( 
is_array$arr[$i] ) ) {
    
$k $arr[$i][$key];
    
$t $arr[$i][$text];
    
$id = ( isset( $arr[$i]['id'] ) ? $arr[$i]['id'] : null );

} else {

    
$k $arr[$i]->$key;
    
$t $arr[$i]->$text;
    
$id = ( isset( $arr[$i]->id ) ? $arr[$i]->id null );

}

//if no string after hypen - take hypen out
$splitText explode" - "$t);
$t $splitText[0];

if(isset(
$splitText[1])){ $t .= " - "$splitText[1]; }

$extra '';
//$extra .= $id ? ' id="' . $arr[$i]->id . '"' : '';

if (is_array$selected )) {

   foreach (
$selected as $obj) {
      
$k2 $obj->$key;
      if (
$k == $k2) {
          
$extra .= ' selected="selected"';
          break;
  }

}

} else {
     
$extra .= ( $k == $selected ' selected="selected"' '' );
}

//if flag translate text
   
if($flag$t JText::_$t );
   
$html .= '<option value="'$k .'" '$extra .'>' $t '</option>';
}
$html .= '</select>';
return 
$html;

tinchen ist offline  
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[Erledigt] Formular ausgabe Array cuep PHP Tipps 2008 11 27.05.2008 17:45
array ausgabe falsch? se-clan PHP Tipps 2007 2 07.01.2007 22:20
Ausgabe Array in schleife PHP Tipps 2006 2 01.02.2006 13:49
Array auslesen andrew22 PHP Tipps 2006 3 21.01.2006 23:06
Text ausgabe filtern btw verkurtzen Bruce PHP Tipps 2007 2 28.12.2005 13:11
Array Ausgabe Nummerieren! PHP Tipps 2007 3 14.12.2005 16:43
[Erledigt] durch Klick auf Text anderen Text einblenden HTML, Usability und Barrierefreiheit 3 03.07.2005 14:41
DIV´s wollen nicht wie ich das will :-) HTML, Usability und Barrierefreiheit 22 28.03.2005 18:36
Array wie auslesen? PHP Tipps 2005 7 07.03.2005 11:43
Problem Suche Array das nur den text in Variable ließt ... PHP Tipps 2005 2 09.01.2005 11:58
Mehrdimensionales Array in eindimensionales Array umwandeln PHP-Fortgeschrittene 3 03.01.2005 22:31
bbcode - Classe PHP-Fortgeschrittene 4 18.09.2004 17:30
zufällige Ausgabe von Array? PHP Tipps 2004 8 01.09.2004 10:05
[Erledigt] einfachste methode ein array in ein text file zu schreiben? PHP-Fortgeschrittene 10 25.06.2004 18:42
[Erledigt] Warum Ausgabe Array ?? Datenbanken 2 22.06.2004 14:52

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
formular value keine php ausgabe, \'text\' => $t_array \html, php textarray

Alle Zeitangaben in WEZ +1. Es ist jetzt 18:00 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.