Current location: Hot Scripts Forums » Programming Languages » PHP » hehehe wierd question in php


hehehe wierd question in php

Reply
  #1 (permalink)  
Old 06-10-03, 08:09 AM
TheGreatOne's Avatar
TheGreatOne TheGreatOne is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Pc Desk
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
hehehe wierd question in php

Right in my php site i do it by using one template file.

index.php?dir=XXXXXXXXX&page=home

What ever the $dir is and $page is dertermines what page it includes and what directory from. Simple really

Right i go board when working so i had to go to intergrate babelfish. Now i cant use it like a normal site due to i have a large nav so i changed to a java one. Right soooo what i did was config it so i have

index.php?dir=challengesimon&page=home&lang=en_de

The way i coded it, it worked and it changed the included file languge. Brillaint

Now from saving me doing 5 other .php files with one in french.php one german.php etc can I do it so no matter what link someone clicks in the nav. So like they clicked index.php?dir=downloads&page=home and they are on the page index.php?dir=tips&page=who&lang=en_de . It changes pages to the link they keeped yet still it keeps the lang=en_de on the new url.

Cause like different languges have different exstentions..

lang=en_de
lang=en_sp
lang=en_fr
lang=en_jp

Understand???

Cheers and hope you understand hehehehe
__________________
## Like Music ?? ##

~~ http://www.theenergyradio.com ~~
Reply With Quote
  #2 (permalink)  
Old 06-10-03, 02:25 PM
phpkid phpkid is offline
Hot Moderator ;)
 
Join Date: Jun 2003
Location: India
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
And your problem is..


...I didn't really understand...

Regards,
JD
__________________
http://www.phpkid.org
Reply With Quote
  #3 (permalink)  
Old 06-10-03, 02:45 PM
amailer's Avatar
amailer amailer is offline
_-*^# PHP Master #^*-_
 
Join Date: Jun 2003
Location: Canada
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
could you show us the site you are having this problem [ which i do not understand either ] and then the code?
__________________
Amailer - Spam/Advertise/Have fun
Reply With Quote
  #4 (permalink)  
Old 06-10-03, 03:01 PM
Pearl's Avatar
Pearl Pearl is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Canada
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
I'm not a PHP coder, only Perl... but I *think* I get what you mean. When your visitor chooses a particular language, you want that language preference to stay the same no matter where they venture on your site.. is this right?

Depending on your script....
* try using cookies to remember their preferences
* hard code the default language as "en_de" or whichever you prefer, when no language is selected.
* internally code your script to replace all the links (eek!) probably the slowest choices of them all... but like I said, it depends on your script and how you're pulling your pages.

A more precise explanation on what you are trying to accomplish might help you get the right solution from some of the PHP experts here.

Best of Luck!
Reply With Quote
  #5 (permalink)  
Old 06-10-03, 03:08 PM
TheGreatOne's Avatar
TheGreatOne TheGreatOne is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Pc Desk
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry my grammer skills are a little poor > Yea thats the one Pearl. Wants it to stay with the users. My Coding is not tooo strong so someone may have to give me a hand . The default language is already there on the page
__________________
## Like Music ?? ##

~~ http://www.theenergyradio.com ~~
Reply With Quote
  #6 (permalink)  
Old 06-10-03, 03:13 PM
amailer's Avatar
amailer amailer is offline
_-*^# PHP Master #^*-_
 
Join Date: Jun 2003
Location: Canada
Posts: 237
Thanks: 0
Thanked 0 Times in 0 Posts
anyway, if you could post your code maby we coudl change it and make it work, and yes i do like dance! z103.5 RADIO!

__________________
## Like Dance Music ?? ##
__________________
Amailer - Spam/Advertise/Have fun
Reply With Quote
  #7 (permalink)  
Old 06-10-03, 03:18 PM
TheGreatOne's Avatar
TheGreatOne TheGreatOne is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Pc Desk
Posts: 114
Thanks: 0
Thanked 0 Times in 0 Posts
Code:
            <?php

$dir = $dir ? $dir : "";
$page = $page ? $page : "home";
$lang = $lang ? $lang : "en_fr";

$error = 0;
if (file_exists("content/$dir/$page.php"))
include "http://babelfish.altavista.com/babelfish/urltrurl?tt=url&url=**URL**/$dir/$page.php&lp=$lang";
else
$error = 1;

?>
                  <?php

if ($error)
echo "Error HTML Code";

?>
I dont like giving out my site code just incase some little bugger in the same community uses it
__________________
## Like Music ?? ##

~~ http://www.theenergyradio.com ~~
Reply With Quote
  #8 (permalink)  
Old 06-10-03, 11:30 PM
The Wolf's Avatar
The Wolf The Wolf is offline
CMS Developer
 
Join Date: Jun 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
You could use str_replace to replace all referances to index.php with : 'index.php?lang=*'.
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
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
PHP Dudes - Hi All stuart New Members & Introductions 4 05-03-04 01:22 PM
PHP Triad/Upload form eddyvlad PHP 6 10-06-03 11:17 PM
PHP header question khadlock PHP 2 09-23-03 08:17 AM
MySQL with PHP question. HELP for a newbie kenfused PHP 3 08-02-03 12:53 AM


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