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

Gde li gresim? Flash news + php (xml) + sql

[es] :: Flash :: Gde li gresim? Flash news + php (xml) + sql

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

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

baneizalfe
FON

Član broj: 73868
Poruke: 31
212.200.123.*



Profil

icon Gde li gresim? Flash news + php (xml) + sql31.05.2007. u 02:25 - pre 205 meseci
Uradio sam flash news ticker aplikacijicu koja cita samo naslove vesti iz xml-a i to fino radi. Problem je kad pokusavam da podatke ubacijem dinamicki iz baze, preko php-a.
kod sledeci:
Code:
<?php
include('konekcija/konekcija.php');

$tip = 'Vesti';

if(isset($_GET['m']) && !is_numeric($_GET['m'])&&isset($_GET['y']) && !is_numeric($_GET['y']))
    die();
$my = "";
$nl = "\r\n"; 
if(isset($_GET['m'])&&isset($_GET['y'])){
    $my=sprintf("AND v.godina='%s'AND v.mesec='%s'",$_GET['y'],$_GET['m']);
}

echo('<?xml version="1.0" encoding="utf-8"?>');
echo('<vesti>');
$upit = sprintf("SELECT v.naslov,v.sadrzaj,v.godina,v.mesec,v.vreme
                    FROM vesti AS v
                    WHERE v.tip='%s'%s
                    ORDER BY v.vreme DESC LIMIT 0,10",$tip,$my);
$query = mysql_query($upit,$konekcija) or die(mysql_error());

while($result = mysql_fetch_assoc($query)) {
echo('
    <vest title="'.$result['naslov'].'" links="index.php">'.$result['sadrzaj'].'</vest>
    ') .$nl;
}
echo('</vesti>');

?>

i on fino radi... lepo mi IE ovaj fajl prikaze kao obican xml fajl... Ali Flash nece da ga ucita.
Actionscript:
Code:
vesti_xml = new XML();
vesti_xml.ignoreWhite = true;
vesti_xml.load("vesti.php");
vesti_xml.onLoad = function(status) {
    if (status) {
        obj_xml = this.firstChild.childNodes;
        clipGen();
    } 
};
// funkcija za generisanje
function clipGen() {
    for (var i = 0; i < obj_xml.length; i++) {
        this.attachMovie("clip", "clip" + i, i);        
        this["clip" + i]._y = this["clip" + i]._height * i;
        this["clip" + i]._x = 0;
        this["clip" + i].naslov.text = obj_xml[i].attributes.title;
        // za generisanje linka
        this["clip" + i].url_button.url = obj_xml[i].attributes.links;
        this["clip" + i].url_button.onRelease = function() {            
            getURL(this.url,"_self");
        }
    }
}


Gde gresim? Mora da je neka glupost!!!
 
Odgovor na temu

gordon_beneth
BGD

Član broj: 104526
Poruke: 192
*.adsl.sezampro.yu.



+1 Profil

icon Re: Gde li gresim? Flash news + php (xml) + sql31.05.2007. u 08:23 - pre 205 meseci
Možda ovako
Code:

vesti_xml = new XML();
vesti_xml.ignoreWhite = true;
vesti_xml.load("vesti.php");
vesti_xml.onLoad = function(status) {
    if (status) {
        obj_xml = this.firstChild.childNodes;
        clipGen(obj_xml);
    } 
};
// funkcija za generisanje
function clipGen(obj_xml) {
    for (var i = 0; i < obj_xml.length; i++) {
        this.attachMovie("clip", "clip" + i, i);        
        this["clip" + i]._y = this["clip" + i]._height * i;
        this["clip" + i]._x = 0;
        this["clip" + i].naslov.text = obj_xml[i].attributes.title;
        // za generisanje linka
        this["clip" + i].url_button.url = obj_xml[i].attributes.links;
        this["clip" + i].url_button.onRelease = function() {            
            getURL(this.url,"_self");
        }
    }
}


Takođe, pošto koristiš relativnu putanju za load, swf treba biti pokrenut sa servera. Ako hoćeš da ti radi u Flasu (test movie) stavi apsolutnu putanju, npr "http://localhost/sajt/vesti.php"

[Ovu poruku je menjao gordon_beneth dana 31.05.2007. u 09:38 GMT+1]
/(bb|[^b]{2})/
 
Odgovor na temu

baneizalfe
FON

Član broj: 73868
Poruke: 31
212.200.123.*



Profil

icon Re: Gde li gresim? Flash news + php (xml) + sql01.06.2007. u 02:26 - pre 205 meseci
U pravu si za putanju. Nije hteo da radi sa relativnom... Radi sa apsolutnom... Sad radi. Hvala!
 
Odgovor na temu

[es] :: Flash :: Gde li gresim? Flash news + php (xml) + sql

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

Postavi temu Odgovori

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