Current location: Hot Scripts Forums » Programming Languages » PHP » include()


include()

Reply
  #1 (permalink)  
Old 08-24-03, 05:56 PM
Dimka Dimka is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Prague
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
include()

Hi!
I am trying to make a multi language web site
i have a template and in it

PHP Code:

<? 

      
if ($text == text1) { include "cz/text1.inc"; }
elseif (
$text == tex2)  { include "cz/text2.inc"; }

?>
so that if some one presses on links
PHP Code:

link1?text=text1

link2
?text=text2 
it includes from folder cz/ *.*.inc files
i have another folder ru/ and there are same .inc files but translated into eng.

how to make a lik so that it adds to link1?text=text1&"something"
and it changes folder form cz -> ru
so that i see same file but translated

something like
PHP Code:

www.inteal.de 

any advices are welcome

thanks!
Reply With Quote
  #2 (permalink)  
Old 08-24-03, 09:18 PM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
Not entirely sure what you're asking here...
__________________
PHP / mySQL Developer
Reply With Quote
  #3 (permalink)  
Old 08-25-03, 08:26 AM
Dimka Dimka is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Prague
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
ok i see maybe i've e[plained it wrong check out this web site www.inteal.de thats a good example of what i want ,how to do switching between languages like on this website?
Reply With Quote
  #4 (permalink)  
Old 08-25-03, 02:25 PM
Gordon Freeman's Avatar
Gordon Freeman Gordon Freeman is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
hello,

first of all i'd like to say that im russian like Dimka here . Well he could be CZ but still, he has a russian name like me
anyway, about that code
i think you should totally change it
examples:
index.php
PHP Code:

<?php
// lets start with setting the language
if ($lang == 'ru')
{
include
"lang/ru.php";
}
elseif (
$lang == 'cz')
{
include
"lang/cz.php";
}
elseif (
$lang == 'en')
{
include
"lang/en.php";
}
else
{
include
"lang/en.php";
}
// end of setting language
?>
<title><?php echo $lang['pagetitle'?></title>
<br>
<style type="text/CSS">
body {
    background: #FFFFFF;
    font-size: 8pt;
    font-family: Tahoma;
}
A:link            { COLOR: #56728e; TEXT-DECORATION: none; FONT-FAMILY: tahoma; }
 A:active        { COLOR: #56728e; TEXT-DECORATION: none; FONT-FAMILY: tahoma; }
 A:visited         { COLOR: #56728e; TEXT-DECORATION: none; FONT-FAMILY: tahoma; }
 A:hover        { COLOR: #96b2ce; TEXT-DECORATION: bold; FONT-FAMILY: tahoma; }
INPUT, TEXTAREA, SELECT    { FONT-SIZE: 8pt; FONT-FAMILY: tahoma; }
</style>
<br><br><br><center><b><?php echo $lang['hello'?></center><br><br><br>
Choose your language: 

<form method="post" name="lang_form" action="<?php echo $HTTP_REFERER ?>" onSubmit="if(document.jumpbox.f.value == -1){return false;}">
<select name="lang">
<option value="en" selected>English</option>
<option value="ru">Russian</option>
<option value="cz">Czech</option>
</select> <input type="submit" value="Go">
</form>

<br><br><br>
$lang['test_text']<br><br><br><br><p>&nbsp;</p><center>© 2003 <a href=mailto:gordon@fr.ee>Gordon Freeman</a></center>
example language file: lang/en.php
PHP Code:

<?php
$lang
['pagetitle'] = 'Testpage';
$lang['hello'] = 'Hello, welcome to the test page. You can use every html tag here and it will appear as HTML. like this one: <a href=mailto:gordon@fr.ee>Gordon Freeman </a>';
?>
greetz,
Freeman

Last edited by Nico; 08-18-11 at 04:25 AM.
Reply With Quote
  #5 (permalink)  
Old 08-25-03, 03:16 PM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
Yes but remember that all values of attributes in html should be surrounded by quotes. Some browsers don't like it if you don't.

<a href="mailto:gordon@fr.ee">Gordon Freeman </a>
__________________
PHP / mySQL Developer

Last edited by Nico; 08-18-11 at 04:25 AM.
Reply With Quote
  #6 (permalink)  
Old 08-25-03, 03:23 PM
Gordon Freeman's Avatar
Gordon Freeman Gordon Freeman is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
hello,

yes i know that, i just wanted to spear some time

greetz,
Freeman
Reply With Quote
  #7 (permalink)  
Old 08-25-03, 04:13 PM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
Ah yes, but he may not know that
__________________
PHP / mySQL Developer
Reply With Quote
  #8 (permalink)  
Old 08-25-03, 04:13 PM
Dimka Dimka is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Prague
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Привет тёска!
Огромное спасибо за помощ!
только я несовсем разобрался со скрипатом ,он почему-то выдаёт не полное содержание переменных в lang/ru.php
а только первые буквы...
www.intelia.ru
в чём может быть дело?

Ещё раз спасибо.
Reply With Quote
  #9 (permalink)  
Old 08-25-03, 04:20 PM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
What?
__________________
PHP / mySQL Developer
Reply With Quote
  #10 (permalink)  
Old 08-25-03, 05:15 PM
Dimka Dimka is offline
Newbie Coder
 
Join Date: Aug 2003
Location: Prague
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
i wrote to Gordon Freeman its in Russian

i jus said that it doest seem to work it's showing olnly first latters from the lang files iam new to PHP so i coud't figure out wats wrong
chech tis out intelia.ru

thanks
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Include file in asp TheLaughingBandit ASP 1 09-19-03 10:32 AM
Include from database geneane ASP 7 09-15-03 11:38 AM
Include problem lapo4ka18 PHP 3 08-23-03 08:03 PM
include tag rkiss PHP 1 08-12-03 04:10 AM
"10 most requested pages" script to include in page avx Script Requests 5 08-06-03 03:26 AM


All times are GMT -5. The time now is 05:35 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.