Hi,
i have one script where i have tv shows, episodes and subtitles. So i want to export all data but i succeeded to show tv show, seasons and episodes, but can not foreach subtitles. How to implement subtitles in this code and how to export them to page?
TV Show page to view
[php]public function prikaz() {
$core = &get_instance();
$id = $core->get(‘input’)->get(‘id’, ‘int’);
$sql = “SELECT * FROM “.TBL_SERIJE.” AS s WHERE s.id = '”.$id."’ LIMIT 1";
$query = $core->get(‘db’)->select($sql, FILE, LINE);
if ($core->get(‘db’)->rows > 0) {
$s = mysqli_fetch_object($query);
#mysqli_free_result($query);
$this->data = array(
‘id’ => $s->id,
‘naziv’ => $s->naziv,
‘img’ => $s->img,
‘opis’ => $s->opis,
‘status’ => $core->get(‘config’)->status_serije[$s->status],
‘tema’ => $s->tema,
‘imdb’ => $s->imdb,
‘tvdb’ => $s->tvdb,
‘godina’ => $s->godina,
‘mreza’ => $s->mreza,
‘slovo’ => $s->slovo,
‘premijera’ => $s->premijera,
‘trajanje’ => $s->trajanje,
‘drzava’ => $s->drzava,
‘jezik’ => $s->jezik,
‘zanr’ => $s->zanr,
‘cover’ => $s->cover,
‘youtube’ => $s->youtube,
‘isfavorite’ => $this->is_favorites($s->id,$core->get(‘user’)->id),
‘sezone’ => array()
);
}
$this->sezone = array();
$this->epizode = array();
$sql = “SELECT * FROM “.TBL_EPIZODE.” WHERE id_serije = '”.$id."’ order by sezona DESC, br_epizode ASC";
$query = $core->get(‘db’)->select($sql, FILE, LINE);
if ($core->get(‘db’)->rows > 0) {
while ($r = mysqli_fetch_object($query)) {
if (!isset($this->sezone[ $r->sezona ])) {
$this->sezone[ $r->sezona ] = array();
$this->data[‘sezone’][ $r->sezona ] = true;
}
$dan = dodaj_nulu($r->dan);
$mesec = dodaj_nulu($r->mesec);
$godina = dodaj_nulu($r->godina);
$this->sezone[ $r->sezona ][] = $r->id;
$this->epizode[ $r->id ] = array(
‘id’ => $r->id,
‘serija’ => $r->id_serije,
‘br’ => $r->br_epizode,
‘naziv’ => $r->naziv,
‘br_sezone’ => dodaj_nulu($r->sezona),
‘broj’ => dodaj_nulu($r->br_epizode),
‘se’ => $r->sezona,
);
// unset podataka
#unset($r, $s);
}
ksort($this->sezone);
}
}[/php]
And my export page is:
[php]<?php foreach ($core->get(‘serije’)->sezone as $sid => $epizode) {
?>
<div class="tab-pane fade <?php if($sid==1) { echo "show active";}?>" id=“pills-s-<?=$sid?>” role=“tabpanel” aria-labelledby=“pills-sezona-<?=$sid?>”>
Sezona <?=$sid?>
# | Naziv epizode | Emitovanje | Opcije |
<?php unset($e);} ?>
</div>
</div>
<?php
unset($epizode);
}
?> [/php]
So that show season in tv show and episodes. Now i want after every episode list of subtitles in this epizode, but how to do this. How to add.
Table episodes have : id, name, airdate, season_number, ep_number
Table subtitles have: id, show_id, season_number, ep_number, author, etc.
So i want to do foreach in episodes to create for that specify ep. But i have low knowledge in arrays, so don’t accualy know how to add this and show. Anyone know? Or some more information?