How To Retrieve Url Using Html Code???

Discussion in 'Programming' started by rrn, Feb 22, 2009.

  1. #1
    hi , i am new to this..
    i am stuck in a big problem for many days.
    in my website.. on the main page.. there is a link to view the arabic conversion of tat site. now the link is working..when i click the link, it is directed to index.php.. tats ok..
    but wat i need is..
    suppose my site is test.com
    am on test.com/hope.php.. wen i click the link it should direct to test.php of arabic..
    like tat it should link to the corresponding pages..
    somebody pls give me a solution...
    hope u r clear...
     
    rrn, Feb 22, 2009 IP
  2. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #2
    buldozerceto, Feb 22, 2009 IP
  3. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thank u.. but i couldnt fully understand .. can u pls explain??
     
    rrn, Feb 22, 2009 IP
  4. chrisranjana.com

    chrisranjana.com Active Member

    Messages:
    132
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Maybe you can use a cookie to identify the language of the user ?
     
    chrisranjana.com, Feb 23, 2009 IP
  5. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Those two sites are mirror sites..
     
    rrn, Feb 23, 2009 IP
  6. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thank u for the above replies

    www.test.com and www.test.com/ar both these are mirror sites..
    if i am in the carrer.php page of test.com , and if i click the link to the mirror site, it should direct to carrer.php of test.com/ar

    <a href="ar/index.php"><img src="arabic.gif" border="0" alt="" /></a>

    this is the line of code....

    whenever i click yhr link to test.com/ar, it is only directing to index.php..
    hope my question is clear..

    help me pls....
     
    rrn, Feb 24, 2009 IP
  7. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    well it should not link to "ar/index.php" ...

    you should use php to read the current url and then create the link to the ar page ..

    
    <a href="ar<?php echo $_SERVER['REQUEST_URI']; ?>"><img src="arabic.gif" border="0" alt="" /></a>
    
    HTML:
    the $_SERVER['REQUEST_URI'] ( http://gr.php.net/manual/en/reserved.variables.server.php ) command returns the current url.
    so what we do is add it to the ar subfolder and it would redirect to the same page in the ar site

    hope this helps
     
    gnp, Feb 24, 2009 IP
  8. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    thanks a lot...

    tried the code...

    but the same as before is happening... the link to the mirror site is directing only to index.php

    ie if i am in test.com/post.php or in test.com/xxx.php , the link is directing only to index.php. y is it so? wat change should i make?
    thanks for ur help..
     
    rrn, Feb 24, 2009 IP
  9. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #9
    do you have your site on the air so we can look at it in action ?
     
    gnp, Feb 25, 2009 IP
  10. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    yes , sure...

    www.gulfnav.com

    u can go through the site..

    thanks...
     
    rrn, Feb 25, 2009 IP
  11. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #11
    hmm..

    cant see why the above code would not work..

    can you create a new .php page with only
    
    <?php echo $_SERVER['REQUEST_URI']; ?>
    
    PHP:
    and call it to see if it displays anything ?
     
    gnp, Feb 26, 2009 IP
  12. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    <a href="ar<?php echo $_SERVER['REQUEST_URI']; ?>"><img src="arabic.gif" border="0" alt="" /></a>

    i tried the code once more..
    now it is displaying " Requested document not found"
     
    rrn, Feb 26, 2009 IP
  13. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    thanks ...

    tried creating a new.php page and directed the link to new.php..

    it is displaying /new.php

    i couldnt find the mistake.. can u pls help me??

    thanks for ur help..
     
    rrn, Feb 26, 2009 IP
  14. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #14
    are you including another page which holds the link to the arabic version ?

    if so what is the name of that page, and what is the code you use to include it ?
     
    gnp, Feb 26, 2009 IP
  15. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    all the arabic html files are saved in a folder 'ar' .
    php pages are common for both english and arabic html files .

    www.test.com/index.php is the link to english site and
    www.test.com/ar/index.php is the link to arabic site.

    hope u r clear..


    thanks...
     
    rrn, Feb 26, 2009 IP
  16. gnp

    gnp Peon

    Messages:
    137
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #16
    hmm ... not sure of your system so i am not sure i can really help ..

    here goes my last attempt.. (it is very primitive because i am not a php coder.. just messing with it ..)

    
    <?php
    	if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
     		$ref = $_SERVER['HTTP_REFERER'];
     		
    		// check if we come from same domain and english version
    		$strdomain = "gulfnav.com/";
    		$strardomain = "gulfnav.com/ar/";
    		if ( stripos($ref, $strdomain) !== false &&  stripos($ref, $strardomain) === false ) 
    			header( str_replace($strdomain, $strardomain, $ref ) );
    	}
    ?>
    
    PHP:
    put this at the very top of your /ar/index.php file

    hope this works ..
     
    gnp, Feb 26, 2009 IP
  17. rrn

    rrn Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    thanks a lot for ur help..

    tried ur last attempt..that too didnt work...
    will try some other way...

    i have got some other doubt..
    i have a function in php for sending emails..
    whenever i send just one mail from the php page to my email id..
    i am receiving 3 or 4 mails...
    y is it so? pls giv a solution...
     
    rrn, Mar 1, 2009 IP