Jump to content

Search the Community

Showing results for tags 'xml encoding utf8'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; $doc->formatOutput = true; $doc->load("proba.xml"); $root = $doc->documentElement; $filmovi=mysql_query("SELECT * FROM film ORDER BY film_id DESC LIMIT 0,100"); while($pod=mysql_fetch_array($filmovi)) { $film = $doc->createElement('film'); $film = $root->appendChild($film); $link = $doc->createElement('link'); $link = $film->appendChild($link); $dodajlink = $doc->createTextNode('film-'.seoURL($pod['film_ime']."_".$pod['film_imesrpski']).'-'.$pod['film_id']); $dodajlink = $link->appendChild($dodajlink); $ime = $doc->createElement('ime'); $ime = $film->appendChild($ime); $dodajime = $doc->createTextNode(utf8_encode($pod['film_ime'].' '.$pod['film_imesrpski'].' '.$pod['film_imestrano'])); $dodajime = $ime->appendChild($dodajime); $doc->save("proba.xml"); } thet was proba.php proba.xml is: <?xml version="1.0" encoding="UTF-8"?> <pretraga> <film> <link>film-Rough_Magic_Opasna_magija-4657</link> <ime>Rough Magic Opasna magija </ime> </film> <film> <link>film-HouseSitter_uvarkua-4656</link> <ime>HouseSitter ?uvarku?a </ime> </film></pretraga> and livesearch.php $xmlDoc=new DOMDocument(); $xmlDoc->load("proba.xml"); $x=$xmlDoc->getElementsByTagName('film'); //get the q parameter from URL $q=$_GET["q"]; //lookup all links from the xml file if length of q>0 if (strlen($q)>0) { $hint=""; for($i=0; $i<($x->length); $i++) { $y=iconv('','UTF-8',$x->item($i)->getElementsByTagName('ime')); $z=$x->item($i)->getElementsByTagName('link'); if ($y->item(0)->nodeType==1) { //find a link matching the search text if (strpos($y->item(0)->childNodes->item(0)->nodeValue,$q)) { if ($hint=="") { $hint="<a href='".$z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } else { $hint=$hint . "<br /><a href='".$z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a>"; } } } } } // Set output to "no suggestion" if no hint were found // or to the correct values if ($hint=="") { $response="Nema slicnih filmova"; } else { $response=$hint; } //output the response echo $response; livesearch and all work great except if i use non-english characters... i try with utf8_encoding but doesent work, i read a lot of diffrient things but i don't know how to use function like: iconv livesearch script When i try to add non-english charcter in xml file and when i use search i got this message: how can i fix this problem?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.