SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Question about Hypelink

    Trying to clean up some code during testing...

    Way back when, I created a "config.php" file with this Constant...
    PHP Code:
        // Virtual Location.
        
    define('BASE_URL'ENVIRONMENT === 'development'
                        
    'http://local.debbie'
                        
    'http://www.MySite.com'); 


    In the code below, does having BASE_URL provide any value??
    PHP Code:
            <class="button2" href="' . BASE_URL . '/account/log-in.php">Log In</a

    If memory serves me right, in this case, I believe I can attain an Absolute Reference in the href by just using a forward slash to start off the Hyperlink URL, right?


    The reason why I originally created Constants like WEB_ROOT and BASE_URL was because I had included files that were acting strangely if I didn't have a way to define some "absolute" point of reference.


    It seems to me that isn't needed here.

    Thoughts?



    Debbie

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    I agree that it doesn't provide any value in that scenario. You could probably find a good portion of those by doing a search for BASE_URL . '/

    Anything that starts with a beginning slash, won't need to have the BASE_URL appended.

  3. #3
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    I agree that it doesn't provide any value in that scenario. You could probably find a good portion of those by doing a search for BASE_URL . '/

    Anything that starts with a beginning slash, won't need to have the BASE_URL appended.
    See, I *am* learning, slowly but surely!!

    Thanks cpradio!!


    Debbie


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •