Jump to content

linking your pages


jcombs_31

Recommended Posts

i never use the URL in my hyperlinks unless it's linking externally. It has been known for me to change domain names for a project and I'm not a fan of either using php to insert the domain (i tend to keep my HTML pages as HTML as possible) or search+replace+re-upload in the event of me changing the domain name (or going from a testing server to a proper one)

 

I dislike syntax such as ./somewhere/test.php or ../somewhereelse/test2.php so I always start my links off with a / so they're all relative to the web root.

Link to comment
Share on other sites

I keep my dynamic. There are times when I need to get links that are controlled by cpanel to work on their directory and not the root.  Sounds confusing, but here is what i do:

 

<?php

 

$path = "..";

 

$link = $path . '/index.php';

 

echo $link;

 

require_once($path . 'includes/master.php');

 

unset($path);

 

?>

 

stuff like that :-/

Link to comment
Share on other sites

I like creating things dynamic. That's why I use relative paths. And even if I need to use a full address (like in an email for confirming a registration or something like that) I do things like this:

 

<?php

$url = "http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/activation.php";

?>

 

This makes things dynamic as possible.

 

Orio.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.