Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Ubacivanje <SELECT>,<OPTION> u php?

[es] :: PHP :: PHP za početnike :: Ubacivanje <SELECT>,<OPTION> u php?

[ Pregleda: 3596 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

korisnikk
kg

Član broj: 83869
Poruke: 156
*.3gnet.mts.telekom.rs.



+9 Profil

icon Ubacivanje <SELECT>,<OPTION> u php?10.11.2014. u 17:23 - pre 64 meseci
Code:
                        $divopen = true;
                        $firstsubcat = true;
                    } else {
                        if ($firstsubcat == false)
                            echo ' - ';
                        echo '<a href="'.$link.'">'.htmlspecialchars($row->name).$numAds.'</a>';
                        $firstsubcat = false;
                    }
Ovo je deo koda koji prikazuje podkategorije u jednoj komponenti za oglase.
Ima li neko ideju kako dodati <OPTION> i <SELECT> tagove da se podkategorije prikazuju u padajucem meniju,umesto kao sada odvojene crticom?
 
Odgovor na temu

Nemanja Avramović
Software architect
Cloud Horizon
Beograd, Srbija

Moderator
Član broj: 32202
Poruke: 4382
95.180.68.*

Jabber: Nemanja Avramović
Sajt: avramovic.info


+45 Profil

icon Re: Ubacivanje <SELECT>,<OPTION> u php?11.11.2014. u 10:59 - pre 64 meseci
Pošto nisi dao deo koji "vrti" kategorije, moram pseudo kodom da ti odgovorim:

Code:
<?php
echo '<select name="ime">';

foreach ($rows as $row)
{
echo "<option value='{$row->id}'>{$row->name}</option>\n";
}

echo '</select>';
?>

Laravel Srbija.

[NE PRUŽAM PODRŠKU ZA PHP PREKO PRIVATNIH PORUKA!]
 
Odgovor na temu

korisnikk
kg

Član broj: 83869
Poruke: 156
*.3gnet.mts.telekom.rs.



+9 Profil

icon Re: Ubacivanje <SELECT>,<OPTION> u php?11.11.2014. u 12:51 - pre 64 meseci
Citat:
Pošto nisi dao deo koji "vrti" kategorije...
Ovo je kompletan kod:
Code:
?>
<div class="row-fluid">
    <div class="span12">
        <fieldset>
            <?php if ($this->conf->display_last == 1)
            {
                $this->displayContents($this->contents,$this->nbimages); 
            }
            ?>
        </fieldset>
    </div>
</div>
<div class="row-fluid">
    <div class="span12">
        <fieldset>
            <legend><?php echo JText::_('ADSMANAGER_FRONT_TITLE'); ?></legend>
            <div class="row-fluid">
                <div class="span12">
                    <?php echo $this->conf->fronttext; ?>
                </div>
            </div>
            <br />
            <?php $this->general->showGeneralLink() ?>
            <div id="adshome" class="row-fluid">
                <?php 
                $nbcatsperrow = $this->conf->display_nb_categories_per_row;
                $classtype = (int) (12 / $nbcatsperrow);

                $num = 1;
                $divopen = false;

                foreach ($this->cats as $row) {
                    //remove the if if you want more than 1 sublevel
                    if ($row->level > 1) {
                        continue;
                    }


                    if ($row->level == 0) {
                        if ($divopen == true) {
                            $divopen = false;
                            ?>
                                        </h3>
                                    </div>
                                </div>
                                </div>
                            <?php }
                        if ($num == $nbcatsperrow+1) {
                            $num = 1;
                            echo '</div>';
                        }
                        if ($num==1) {
                            echo '<div class="row-fluid">';
                        }
                        $num++;
                    }

                    if(isset($this->conf->display_nb_ads_per_categories) && $this->conf->display_nb_ads_per_categories)
                        $numAds = " (".$row->num_ads.")";
                    else
                        $numAds = '';

                    $link = TRoute::_("index.php?option=com_adsmanager&view=list&catid=".$row->id);


                    if ($row->level == 0) {
                        $imgsrc = TTools::getCatImageUrl($row->id);
                            ?>
                        <div class="span<?php echo $classtype ?>">
                            <div class="span12">
                                <div class="span6">
                                <?php 
                                    echo '<a class="image" href="'.$link.'" title="'.htmlspecialchars($row->name).'"><img class="imgcat" src="'.$imgsrc.'" alt="'.htmlspecialchars($row->name).'" /></a>';
                                ?>
                                </div>
                                <div class="span6">
                                <h2 class="no-margin-top"><a href="<?php echo $link; ?>"  ><?php echo htmlspecialchars($row->name).$numAds; ?></a></h2>

                                <h3>
                        <?php    
                        $divopen = true;
                        $firstsubcat = true;
                    } else {
                        if ($firstsubcat == false)
                            echo ' - ';
                        echo '<a href="'.$link.'">'.htmlspecialchars($row->name).$numAds.'</a>';
                        $firstsubcat = false;
                    }
                }
                if ($divopen == true) {
                    ?>
                        </h3>
                                </div>
                    </div>
                </div>
                <?php 
                }
                echo "</div>";
                ?>
            </div>
            <?php if ($this->conf->display_last == 2)
            {
                $this->displayContents($this->contents,$this->nbimages); 
            } $this->general->endTemplate();
            ?>
        </fieldset>
    </div>
</div>

 
Odgovor na temu

[es] :: PHP :: PHP za početnike :: Ubacivanje <SELECT>,<OPTION> u php?

[ Pregleda: 3596 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.