becquersito Posted April 9, 2007 Posted April 9, 2007 Hello... im absolutely newbie and i dont know anything about .php files. I tried to make a new section in my oscomerce web. I built a new file (let's call it "newfile.php"). I want it to be translated to the different languages avialable... I guessed i should make a require some way like "require(DIR_WS_LANGUAGES . $language . 'newfile.php'); " and then, build a "newfile.php" in each lenguage directory, and use the php echo to write up the translated text. I thought that should be enough. But it seems it doesnt work, so i suppose it works some other way.... that's why i'm asking how to requiere a file?.
kirikintha Posted April 9, 2007 Posted April 9, 2007 What exactly are you trying to do? Where do you want the file to show up? Is it going to be a box, etc. If you need to require a file, there are only a few files you should add it to, unless you are adding support for an existing feature. Just need a little more information in order to give you an answer Nothing unreal exists
becquersito Posted April 9, 2007 Author Posted April 9, 2007 Well, its just a full new section, but i want to preserve the format of the page (so header, left column, etc.). I wanted that the contents of this page could be translated.... like with conditions.php or privacy.php. In fact, what i tried to do was to make a copy of the conditions, replacing the content and the name, but obviously it didnt work. Thanks.
kirikintha Posted April 9, 2007 Posted April 9, 2007 Can you show me your modified code? Just let me see the file you modified. Nothing unreal exists
becquersito Posted April 9, 2007 Author Posted April 9, 2007 This is the file in the "main directory": <?php /* $Id: projectes.php,v 1.22 2003/06/05 23:26:23 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . 'projectes.php'); $breadcrumb->add(NAVBAR_TITLE, tep_href_link('projectes.php')); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <table cellspacing=0 cellpadding=0 width=541 align=center> <tr><td colspan=5 class=ch4> </td></tr> <tr><td height=7></td></tr> <tr><td colspan=5 background=images/m25.gif height=1></td></tr> <tr><td height=3></td><tr> <tr> <table border="0" cellpadding="0" cellspacing="0" width="536"> <tr> <td></td> </tr> <tr> <td><span style="font-size: 10.5pt; font-family: inherit; mso-bidi-font-family: Arial"> </span></td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION; ?></a>. </span></td> </tr> <tr> <td> </td> </tr> <tr> <td> <p align="center"></p> </td> </tr> <tr> <td></td> </tr> <tr> <td> <hr> <p> </td> </tr> <tr> <td><a name="principi"></a></td> </tr> <tr> <td></td> </tr> <tr> <td> </td> </tr> <tr> <td> <p align="center"></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_1; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_1; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_2; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_2; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_3; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_3; ?> </tr> <tr> <td><span style="font-size: 10.5pt; font-family: inherit; mso-bidi-font-family: Arial"> </span></td> </tr> <tr> <td><<p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_4; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_4; ?></span></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_5; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_11; ?></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_6; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_5; ?></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_7; ?></td> </tr> <tr> <td> <p align="right"><span style="font-size: 10.5pt; font-family: inherit; mso-bidi-font-family: Arial"> <a href="#principi"></a></span></p> </td> </tr> <tr> <td> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td></td> <td><img border="0" src="images/en_Execucio.gif" width="73" height="59"></td> <td><img border="0" src="images/en_financament.gif" width="68" height="63"></td> </tr> </table> </td> </tr> <tr> <td> <hr> <p> </td> </tr> <tr> <td> </td> </tr> <tr> <td></td> </tr> <tr> <td> </td> </tr> <tr> <td> <p align="center"></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_1; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_6; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_2; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_7; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_3; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_8; ?></span></td> </tr> <tr> <td><span style="font-size: 10.5pt; font-family: inherit; mso-bidi-font-family: Arial"> </span></td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_4; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_9; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_5; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_10; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_6; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_11; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_7; ?></td> </tr> <tr> <tr> <td> <p align="right"><span style="font-size: 10.5pt; font-family: inherit; mso-bidi-font-family: Arial"> <a href="#principi"></a></span></p> </td> </tr> <tr> <td> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><img border="0" src="images/en_projeccio.jpg" width="73" height="63"></td> <td><img border="0" src="images/en_Execucio.gif" width="73" height="59"></td> <td><img border="0" src="images/en_financament.gif" width="68" height="63"></td> </tr> </table> </td> </tr> <tr> <td> <hr> <p> </td> </tr> <tr> <td></td> </tr> <tr> <td> </td> </tr> <tr> <td> <p align="center"></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_1; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_12; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_2; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_13; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_3; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_14; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_4; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_15; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_5; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_16; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo HEADING_SUB_TITLE_6; ?><p style='margin:0cm;margin-bottom:.0001pt;text-align:justify'><span style='font-size:9.5pt;font-family:inherit;mso-bidi-font-family:Arial'><?php echo TEXT_INFORMATION_16; ?></span></td> </tr> <tr> <td> </td> </tr> <tr> <td> <p align="right"><span style="font-size: 10.5pt; font-family: inherit; mso-bidi-font-family: Arial"><a href="#principi">a></span> </td> </tr> <tr> <td> <img border="0" src="images/en_projeccio.jpg" width="73" height="63"><img border="0" src="images/en_Execucio.gif" width="73" height="59"> </td> </tr> <tr> <td> <hr> <p> </td> </tr> <tr> <td> <p align="center"></td> </tr> </table> !-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> and this is a part of the file in the includes/languages/lenguage directory: <?php /* $Id: projectes.php,v 1.4 2002/11/12 00:45:21 dgw_ Exp $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2002 osCommerce Released under the GNU General Public License */ define('NAVBAR_TITLE', 'XXXX'); define('HEADING_TITLE', 'XXXXX'); define('HEADING_SUB_TITLE_1', 'XXXXX');
kirikintha Posted April 9, 2007 Posted April 9, 2007 OK - so is the only output - "NAVBAR_TITLE" etc, not the value? Can I get a link to that? I think your problem may just be file placement - but I am having a hard time visualizing what you are doing. Nothing unreal exists
becquersito Posted April 9, 2007 Author Posted April 9, 2007 OK - so is the only output - "NAVBAR_TITLE" etc, not the value? Can I get a link to that? I think your problem may just be file placement - but I am having a hard time visualizing what you are doing. Well i tried to do just the same way that "privacy.php" or "conditions.php" work.... i guessed that the way these files work is including ore requiring the files in i.e. "includes/lenguages/english/privacy.php" which content de values of the (variables?) like "HEADING_SUBTITLE_1". So then i thought that just using the formula <?php echo HEADING_SUBTITLE_1; ?> the text would be shown. Well as i said i have no idea. What link do u need? to the file i tried to make? its in http://www.cooperacio.org/donacions/projectes.php Thanx.
ttetzloff Posted April 9, 2007 Posted April 9, 2007 If you are wondering how to include a file via php. Here is the following php code and a link to php.net for reference: <?php require 'prepend.php'; ?> http://us3.php.net/require Hope this helps, :D -Tyler -Tyler
kirikintha Posted April 9, 2007 Posted April 9, 2007 Yeah - your not getting any output at all so your file is in the wrong place - it's not reading the include - most likely because you have it in the /donacions/ directory - this is where you problem is - you have to figure out the proper path to the included files. I would try putting this file into the language/%lang%/ directory, and see if it reads anything there since it's not giving any errors, you may also want to put a "die" stament into your require statement require('myfile.php) or die('hey I can't include this file darnit!'); hopefully this helps I' pretty sure this all to do with file placement - it can be very strict in OSC Nothing unreal exists
vasttech Posted April 9, 2007 Posted April 9, 2007 One problem is in the require line for your languages: require(DIR_WS_LANGUAGES . $language . 'projectes.php'); Should be: require(DIR_WS_LANGUAGES . $language . '/' . 'projectes.php'); The missing slash will cause the require to fail. Also, in your original question you said something about I want it to be translated to the different languages avialable Just to be clear, osCommerce does not translate for you. If you want it in other languages you have to translate yourself and place in the appropriate language directory. osCommerce Knowledge Base osCommerce Documentation Contributions
becquersito Posted April 11, 2007 Author Posted April 11, 2007 Thank you all guys.... but it isn't working and i can't understand why. If i requiere any other file from the languages/english/ directory it works, but never with my "projectes". I will keep trying.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.