Jump to content

basic php question? - echo site url


nezona

Recommended Posts

I have this piece of code in my header.php ;-

 

<a href="<? echo SITE_URL; ?>reception/" class="snav" >Reception Areas</a>

 

Now obviously this points to a page on my site called reception. The only problem is im trying to get ready to be search engine optimized, instead of it pointing to the whole of the url, I just want it point to same site link i.e instead of www.primeofficeenviroments.com/reception. I want it to point to /reception.

 

Can anyone help?

 

Neil

Link to comment
Share on other sites

Lol. I think i no wat ur talking about but why don't you just get rid of <? echo SITE_URL; ?>?

At the moment ur outputting your a href link as www.website.com/reception however if u just use...

 

<a href="reception/" class=snav>Reception areas</a>

 

it'll work fine

Link to comment
Share on other sites

use ./reception/ instead.

 

the ./ means from the current (working) directory (or cwd for short)

 

NOTE:

./ will work if your url is wwwmysite.com as the browser will read reception/ from wwwmysite.com/reception/

 

However if your url is this: wwwmysite.com/dir2/

then the browser will read reception/ from wwwmysite.com/dir2/reception/. As dir2/ is the cwd. Instead you should use ./../reception/. The ../ means backup one level in the directory tree.

Link to comment
Share on other sites

Hi thanks guys it worked,

 

apart from....

 

because it's the header.php file, if I go from the home pages www.primeoe.com and click on the a href is works fine and shows the directory www.primeoe.com/reception. If I then click on desks it tries to find www.primeoe.com/reception/desks.

 

is there anywhere around this?

 

kind regards

neil

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.