Hello,

In dreamweaver, i'm trying to do something on my website. Now whenever someone clicks on a link like forums, i want to be www.forums.central-forums.net, but at the moment, that won't work....

how do i do it...

This is my current script:

<li><strong><a href="www.central-forums.net">Homepage</a></strong></li>
					<li><strong><a href="forums">Forum</a></strong></li>
					<li><strong><a href="about">About</a> </strong></li>
					<li><strong><a href="donate">Donate</a></strong></li>
					<li><strong><a href="contact">Contact </a></strong></li>

Whenever someone clicks on the homepage link, it will not work.

How do i get it to work??

I need this done urgently!

Thanks,

Cohen

Why won't it work? Does it lead to a 404 error or does it not open at all?

<li><strong><a href="http://www.central-forums.net">Homepage</a></strong></li>
                [COLOR="Green"]<li><strong><a href="forums">Forum</a></strong></li>
                <li><strong><a href="about">About</a> </strong></li>
                <li><strong><a href="donate">Donate</a></strong></li>
                <li><strong><a href="contact">Contact </a></strong></li>[/COLOR]

These links should lead to pages at the very least. Something like forums.php or forums.html...
If you have directories in http://www.central-forums.net then they should have index.php or index.html for this kind of linking to work. The problem is when you're in a directory (say /forums/) the about link is linking to http://www.central-forums.net/

So I suggest that you do this instead:

<li><strong><a href="http://www.central-forums.net">Homepage</a></strong></li>
                <li><strong><a href="http://www.central-forums.net/forums">Forum</a></strong></li>
                <li><strong><a href="http://www.central-forums.net/about">About</a> </strong></li>
                <li><strong><a href="http://www.central-forums.net/donate">Donate</a></strong></li>
                <li><strong><a href="http://www.central-forums.net/contact">Contact </a></strong></li>

But that's tedious if you have many links! If you have a variable/constant for holding http://www.central-forums.net/ --- now is the time to use it. =)

<li><strong><a href="<?php echo $base_url;?>">Homepage</a></strong></li>
                <li><strong><a href="<?php echo $base_url;?>forums">Forum</a></strong></li>
                <li><strong><a href="<?php echo $base_url;?>about">About</a> </strong></li>
                <li><strong><a href="<?php echo $base_url;?>donate">Donate</a></strong></li>
                <li><strong><a href="<?php echo $base_url;?>contact">Contact </a></strong></li>
<li><strong><a href="http://www.central-forums.net">Homepage</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/forums">Forum</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/about">About</a> </strong></li>
					<li><strong><a href="http://www.central-forums.net/donate">Donate</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/contact">Contact </a></strong></li>

i do this and i get the 404 Error.

Now, what do i do with this code

<li><strong><a href="<?php echo $base_url;?>">Homepage</a></strong></li>
					<li><strong><a href="<?php echo $base_url;?>forums">Forum</a></strong></li>
					<li><strong><a href="<?php echo $base_url;?>about">About</a> </strong></li>
					<li><strong><a href="<?php echo $base_url;?>donate">Donate</a></strong></li>
					<li><strong><a href="<?php echo $base_url;?>contact">Contact

where do i put the links etc???

Thanks,

Cohen

When you're in the forums, the links are pointing to http://www.forums.central-forums.net/forums/ and http://www.forums.central-forums.net/about --- which is probably wrong!

Your homepage, however, is working now. Meaning the links are pointing to the proper places http://www.central-forums.net/forums and http://www.central-forums.net/about etc.

The code I gave you is correct. You have to double-check your pages (specially the topmenu in your forums) because you're still 'relative-linking' to the about, donate, forums pages on the url http://forums.central-forums.net.

<li><strong><a href="http://www.central-forums.net">Homepage</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/forums">Forum</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/about">About</a> </strong></li>
					<li><strong><a href="http://www.central-forums.net/donate">Donate</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/contact">Contact </a></strong></li>

Copy and paste that code. When we've got the html working, I'll help you with the $base_url too.

When you're in the forums, the links are pointing to http://www.forums.central-forums.net/forums/ and http://www.forums.central-forums.net/about --- which is probably wrong!

Your homepage, however, is working now. Meaning the links are pointing to the proper places http://www.central-forums.net/forums and http://www.central-forums.net/about etc.

The code I gave you is correct. You have to double-check your pages (specially the topmenu in your forums) because you're still 'relative-linking' to the about, donate, forums pages on the url http://forums.central-forums.net.

<li><strong><a href="http://www.central-forums.net">Homepage</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/forums">Forum</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/about">About</a> </strong></li>
					<li><strong><a href="http://www.central-forums.net/donate">Donate</a></strong></li>
					<li><strong><a href="http://www.central-forums.net/contact">Contact </a></strong></li>

Copy and paste that code. When we've got the html working, I'll help you with the $base_url too.

It worked! Thanks!!!!

Cohen

Ok. So have you used the $base_url? This will help you save time when transferring the site or when editing links...

Just define the constant in your header (or somewhere up there) then you can echo it anywhere in your document.

<?php
define ("BASE_URL", "http://www.central-forums.net");
?>
...
...
...

<p>This is <a href="<?php echo BASE_URL; ?>">a link to my homepage</a>. This is <a href="<?php echo BASE_URL;?>/forums">the forums</a>.

... and so on.

oh, nice, thanks!

what is it that you actually work looking for??

I think I have an understanding of what is it you are requesting.

Or, atleast I had a great idea to implement. PHP - Chmod - New Directory - Click the link it builds a new directory; specifically for the person that clicked it? No?

Done, and solved.

Marked as Solved.

Cohen

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.