mrbad Posted April 27, 2010 Share Posted April 27, 2010 Hello, I want to assign large data - say 500-600 lines which contains data and html tags to X variable, which will parse the data to translation function (google api) and data will be translated. Please help. Thanks in advance, Vikram Quote Link to comment Share on other sites More sharing options...
Deoctor Posted April 27, 2010 Share Posted April 27, 2010 so wt is ur problem Quote Link to comment Share on other sites More sharing options...
mrbad Posted April 27, 2010 Author Share Posted April 27, 2010 Hello, On assigning large data to X Variable - it does not gives any output. Someone suggested me to go for :confused:XML - Quote Link to comment Share on other sites More sharing options...
Deoctor Posted April 27, 2010 Share Posted April 27, 2010 can u show me some code so that i can help u why it is not getting assigned. u see i dont have that much imagination power.. Quote Link to comment Share on other sites More sharing options...
mrbad Posted April 27, 2010 Author Share Posted April 27, 2010 Hello, Here is the data file (30% data only) - hope it helps <? $products1="<div style='width:890px; float:left;'><div class='procoltitle1'>Products</div><div class='procoltitle2'>Standard</div><div class='procoltitle1'>Package</div><div class='procoltitle2'>CAS No.</div><div class='procolodd1'>Acyclovir</div><div class='procolodd2'>E.P/B.P/USP</div><div class='procolodd1'>25/50 HDPE Drums</div><div class='procolodd2'>59277-89-3</div><div class='procoleven1'>Artesunate</div><div class='procoleven2'>I.H.S.</div><div class='procoleven1'>1/5/25/50/100 KG.</div><div class='procoleven2'>88495-63-0</div><div class='procolodd1'>Artemether</div><div class='procolodd2'>I.H.S.</div><div class='procolodd1'>1/5/25/50/100 KG.</div><div class='procolodd2'>72963-77-4</div><div class='procoleven1'>Sodium Stearyl Fumarate</div><div class='procoleven2'>U.S.P.</div><div class='procoleven1'>5/10/25/50 KG HDPE Drums</div><div class='procoleven2'>4070-80-8</div><div class='procolodd1'>Alpha-Beta Arteether</div><div class='procolodd2'>I.H.S.</div><div class='procolodd1'>1/5/25/50/100 KG.</div><div class='procolodd2'>75887-54-6</div><div class='procoleven1'>Amoxicillin Tri Hydrate</div><div class='procoleven2'>B.P./I.P.</div><div class='procoleven1'>25/50 KG HDPE Drums</div><div class='procoleven2'>26787-78-0</div></div>"; ?> Thanks, Vikram Quote Link to comment Share on other sites More sharing options...
Deoctor Posted April 27, 2010 Share Posted April 27, 2010 Hello, Here is the data file (30% data only) - hope it helps <? $products1="<div style='width:890px; float:left;'><div class='procoltitle1'>Products</div><div class='procoltitle2'>Standard</div><div class='procoltitle1'>Package</div><div class='procoltitle2'>CAS No.</div><div class='procolodd1'>Acyclovir</div><div class='procolodd2'>E.P/B.P/USP</div><div class='procolodd1'>25/50 HDPE Drums</div><div class='procolodd2'>59277-89-3</div><div class='procoleven1'>Artesunate</div><div class='procoleven2'>I.H.S.</div><div class='procoleven1'>1/5/25/50/100 KG.</div><div class='procoleven2'>88495-63-0</div><div class='procolodd1'>Artemether</div><div class='procolodd2'>I.H.S.</div><div class='procolodd1'>1/5/25/50/100 KG.</div><div class='procolodd2'>72963-77-4</div><div class='procoleven1'>Sodium Stearyl Fumarate</div><div class='procoleven2'>U.S.P.</div><div class='procoleven1'>5/10/25/50 KG HDPE Drums</div><div class='procoleven2'>4070-80-8</div><div class='procolodd1'>Alpha-Beta Arteether</div><div class='procolodd2'>I.H.S.</div><div class='procolodd1'>1/5/25/50/100 KG.</div><div class='procolodd2'>75887-54-6</div><div class='procoleven1'>Amoxicillin Tri Hydrate</div><div class='procoleven2'>B.P./I.P.</div><div class='procoleven1'>25/50 KG HDPE Drums</div><div class='procoleven2'>26787-78-0</div></div>"; ?> Thanks, Vikram dude try this <?php echo $products1= " <div style=\'width:890px; float:left;\'><div class=\'procoltitle1\'>Products</div><div class=\'procoltitle2\'>Standard</div><div class=\'procoltitle1\'>Package</div><div class=\'procoltitle2\'>CAS No.</div><div class=\'procolodd1\'>Acyclovir</div><div class=\'procolodd2\'>E.P/B.P/USP</div><div class=\'procolodd1\'>25/50 HDPE Drums</div><div class=\'procolodd2\'>59277-89-3</div><div class=\'procoleven1\'>Artesunate</div><div class=\'procoleven2\'>I.H.S.</div><div class=\'procoleven1\'>1/5/25/50/100 KG.</div><div class=\'procoleven2\'>88495-63-0</div><div class=\'procolodd1\'>Artemether</div><div class=\'procolodd2\'>I.H.S.</div><div class=\'procolodd1\'>1/5/25/50/100 KG.</div><div class=\'procolodd2\'>72963-77-4</div><div class=\'procoleven1\'>Sodium Stearyl Fumarate</div><div class=\'procoleven2\'>U.S.P.</div><div class=\'procoleven1\'>5/10/25/50 KG HDPE Drums</div><div class=\'procoleven2\'>4070-80-8</div><div class=\'procolodd1\'>Alpha-Beta Arteether</div><div class=\'procolodd2\'>I.H.S.</div><div class=\'procolodd1\'>1/5/25/50/100 KG.</div><div class=\'procolodd2\'>75887-54-6</div><div class=\'procoleven1\'>Amoxicillin Tri Hydrate</div><div class=\'procoleven2\'>B.P./I.P.</div><div class=\'procoleven1\'>25/50 KG HDPE Drums</div><div class=\'procoleven2\'>26787-78-0</div></div>"; ?> Quote Link to comment Share on other sites More sharing options...
mrbad Posted April 27, 2010 Author Share Posted April 27, 2010 Hi, I have already tried this but no luck - since data to be assigned to variable is very large (more then 500-600lines) and since variable has limitation of 157 characters only - it wont work :'( Thanks anyways Vikram Quote Link to comment Share on other sites More sharing options...
Deoctor Posted April 27, 2010 Share Posted April 27, 2010 have u tried concatenation of the variable.. Quote Link to comment Share on other sites More sharing options...
dgoosens Posted April 27, 2010 Share Posted April 27, 2010 [...] since variable has limitation of 157 characters only well that would be the kind of limitation one could eventually encounter on Windows... but never heard about something like that for PHP... sounds like nonsense I am guessing there is something wrong with your code... but you should post it so that we could have a look at it... Quote Link to comment Share on other sites More sharing options...
mrbad Posted April 27, 2010 Author Share Posted April 27, 2010 Hello, Friends, thank you so much for your kind support. Here are the codes for php and have also attached text file - to have an idea of how large data is to be assigned to variable. index.php <? $page="pharma"; require 'content/'.$page.'.php'; require "inc/functions.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Parth : Translation</title> <script type="text/javascript" src="js/jsapi"></script> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <!-- LANGUAGE FLAG STARTS --> <? echo languagemenu(); ?> <!-- LANGUAGE FLAG ENDS--> <br /> <h1>Parth</h1> <!-- CONTENT AND TRANSLATION STARTS--> <? $txtid="1"; $txt="$products1"; echo content1($txtid, $txt); ?> <!-- CONTENT AND TRANSLATION ENDS --> </body> </html> function.php //MAIN TRANSLATION function translate($txt, $txtid) { global $self; $self=$_SERVER['PHP_SELF']; global $lang; global $txt; global $page; echo' <!-- MESSAGE TRANSLATION STARTS--> <script type="text/javascript"> google.load("language", "1"); function toptext() { google.language.translate("'.$txt.'", "en", "'.$lang.'", function(welcomemsg) { if (!welcomemsg.error) { var container = document.getElementById("'.$txtid.'"); container.innerHTML = welcomemsg.translation; } }); } google.setOnLoadCallback(toptext); </script> <!-- MESSAGE TRANSLATION ENDS--> '; } //TRANSLATION 1 function content1($txtid, $txt) { global $txtid; global $txt; echo' <div class="contentbox" id="'.$txtid.'">'; echo translate($txt, $txtid); echo '</div>'; } Thanks, Vikram [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
dgoosens Posted April 27, 2010 Share Posted April 27, 2010 the length of the text should not be an issue... try like this: function content1($txtid, $txt) { global $txtid; global $txt; return '<div class="contentbox" id="'.$txtid.'">' . translate($txt, $txtid) . '</div>'; } and function translate($txt, $txtid) { // [...] return ' <!-- MESSAGE TRANSLATION STARTS--> <script type="text/javascript"> google.load("language", "1"); function toptext() { google.language.translate("'.$txt.'", "en", "'.$lang.'", function(welcomemsg) { if (!welcomemsg.error) { var container = document.getElementById("'.$txtid.'"); container.innerHTML = welcomemsg.translation; } }); } google.setOnLoadCallback(toptext); </script> <!-- MESSAGE TRANSLATION ENDS--> '; } Quote Link to comment Share on other sites More sharing options...
mrbad Posted April 27, 2010 Author Share Posted April 27, 2010 Hello, Here is the link : http://yoursview.com/parth2/index2.php It works fine till certain, on adding even one more column - data goes away Thanks, Vikram Quote Link to comment Share on other sites More sharing options...
dgoosens Posted April 27, 2010 Share Posted April 27, 2010 looks like a Google limitation... I am not aware of how much you are allowed to "ask" them Quote Link to comment Share on other sites More sharing options...
mrbad Posted April 27, 2010 Author Share Posted April 27, 2010 Hello, I thing Google translation has no limitations. Have a look at : http://yoursview.com/parth2/index3.php This is done directly by jquery. But it is fine for 1 page website. When we have multiple pages, user will have to click every time on desired translation language. Thanks, Vikram Quote Link to comment Share on other sites More sharing options...
mrbad Posted April 28, 2010 Author Share Posted April 28, 2010 Hello, Any help :'(!! Thanks, Vikram Quote Link to comment Share on other sites More sharing options...
dgoosens Posted April 28, 2010 Share Posted April 28, 2010 maybe a PHP timout then or something like that... I can't see anything in your code that would cause this... try to alter your PHP limits with ini_set(); http://uk.php.net/manual/en/function.ini-set.php or directly in your php.ini file (if you have access to it) Quote Link to comment Share on other sites More sharing options...
mrbad Posted April 30, 2010 Author Share Posted April 30, 2010 Hello, No - it doesn't work :'( :'( :'( :'( :'( :'( Please help - I am held up :'( :'( :'( :'( :'( Vikram Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.