We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7536
    • 3 Posts
    Ok, let me explain situation first...
    I’m trying to make snippet that generate playlist for longtail video player directly from database, now everything is working fine until I’m trying to genarate <title> tag.
    here’s code i’m using, it is under development and this is just version to check if generated code is fine
    <?php
    $output = '';
    $result = $modx->db->query( 'SELECT id, user, naslov, video, opis, img FROM `test` ORDER BY naslov ASC' );
    
    while( $row = $modx->db->getRow( $result ) ) {
    
    $output .= "<track>\n" .
      "       <creator>XicaTV</creator>\n" .
      "       <title>" . $row['naslov'] . "<title>\n" .
      "       <location>" . $row['video'] . "</location>\n".
      "       <info>"     . $row['opis']  . "</info>\n".
      "       <image>"    . $row['img'] . "</image>\n".
      " </track>\n";
    }
    
    echo "<?xml version='1.0' encoding='UTF-8'?>\n";
    echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
    echo "<trackList>\n";
    echo $output;
    echo "</trackList>\n";
    echo "</playlist>\n";
    ?>
    


    I’m sure there’s something about <title> tag that I can’t figure out. Everything else is generated just fine, and even if i use some other name for this tag it works just fine, but when i name it <title> it just skip that line of code... When i check source of generated page there’s one missing line of code that starts with <title> tag
    I’m 99% sure it’s something stupid about it but I can’t figure it out atm.

    EDIT* for now I’m running it on local machine for now, but i can upload it on web if this can help
      • 4310
      • 2,310 Posts
        <title>" . $row['naslov'] . "<title>\n" .

      Should be :
        <title>" . $row['naslov'] . "</title>\n" .

      grin
        • 7536
        • 3 Posts
        Nah that’s not it, I guess I missed that sign once I was rewriting it over and over when I was trying to fix it...
        But I found out what’s causing problems... I was calling snippet in body instead in header, it seems that in body <title> tag doesn’t work so none of content inside those tags is displayed....
        I called it in header now and it all works fine, and that’s where snippet should be in first place

        Anyway tnx for reply... at least now I know another thing that would bug me later on xD