Jump to content

nguyenkhv

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by nguyenkhv

  1. Hello all, I have a javascript work in the header section of a php page to strip all special non alphabetical unicode characters of a php variable name META_TAG_TITLE before writing it to the page title: THe purpose is for Google bot to index the pate title without the non alphabetical characters. However, Google bot is not accepting the javascript, and therefore, the javascript function bellow is useless for google index. ----------------------- <head> <script language="JavaScript" > document.title=StripUnicode('<?php echo META_TAG_TITLE; ?>') function StripAll() { document.myForm.Keyword.value = StripUnicode(document.myForm.vArea.value) } function StripUnicode(textString) { var returnValue = "" var uFont = textString.toLowerCase() for (var i=0; i< uFont.length; i++) { returnValue += stripThis(escape(uFont.charAt(i))) } return returnValue } function stripThis(uniCode) { var a = "%E1%E0%E3%u1EA1%E2%u1EA5%u1EA7%u1EAB%u1EAD%u0103%u1EAF%u1EB1%u1EB5%u1EB7%u1EA3% u1EA9%u1EB3" var e = "%E9%E8%u1EBD%u1EB9%u1EBF%u1EC1%u1EC5%u1EC7%EA%u1EC3%u1EBB" var i = "%ED%EC%u0129%u1ECB%u1EC9" var o = "%F3%F2%F5%u1ECD%F4%u1ED1%u1ED3%u1ED7%u1ED9%u01A1%u1EDB%u1EDD%u1EE1%u1EE3%u1ED5% u1EDF%u1ECF" var u = "%FA%F9%u0169%u1EE5%u01B0%u1EE9%u1EEB%u1EEF%u1EF1%u1EE7%u1EED" var y = "%FD%u1EF3%u1EF9%u1EF5%u1EF7" var d = "%u0111" var returnValue var bIsFound = false if (uniCode.charAt(0) == "%") { if (a.indexOf(uniCode) !=-1) {returnValue = "a"; bIsFound = true} if (!bIsFound){ if (e.indexOf(uniCode) !=-1) {returnValue = "e"; bIsFound = true}} if (!bIsFound){ if (i.indexOf(uniCode) !=-1) {returnValue = "i"; bIsFound = true}} if (!bIsFound){ if (o.indexOf(uniCode) !=-1) {returnValue = "o"; bIsFound = true}} if (!bIsFound){ if (u.indexOf(uniCode) !=-1) {returnValue = "u"; bIsFound = true}} if (!bIsFound){ if (y.indexOf(uniCode) !=-1) {returnValue = "y"; bIsFound = true}} if (!bIsFound){ if (d.indexOf(uniCode) !=-1) {returnValue = "d"; bIsFound = true}} } if (!bIsFound) returnValue = unescape(uniCode) return returnValue } </script> </head> ----------------- I dont know any thing about php, and therefore, cannot customize the php to strip the unicode like the javascript does above. Can someone please help me with converting or write a similar php code to work like the javascript function bove. thanks for all help and suggestions. nguyen
×
×
  • 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.