MyBB Community Forums

Full Version: Simple 'Links' Question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well,

I had transferred severs lately and changed the domain. I wanted to ask a simple question which got me mixed in a way or another. Now I had a newsbar in the old server (and domain) which had links to specific threads in the forum. When I was doing the template edits, I wrote the link in the following format:

<a href="http://www.mydomain.com/forums/showthread.php?tid=23">Click here</a>

When I transferred the server, this link, as you may have already guessed is not active anymore so I had to manually edit the templates again to be like:

<a href="http://www.mynewdomain.com/forums/showthread.php?tid=23">Click here</a>

Rather than using this long url to link to the post from the begginng, I could have used this in the template edits: (Please correct me if I am wrong)
<a href="showthread.php?tid=23">Click here</a>

I could easily use this way because the showthread.php is in the same directory in which the link is inserted (i.e: the link is at index.php, index.php and showthread.php are both in the same directory)

So finally, my question is: (sorry for all that delay)

What if the place where I linked from wasn't index.php?

For example, imagine, just imagine that I were to link from the uploads directory, it'll search for showthread.php and won't find it within the uploads directory and so the link is broken so what form of link should I use which would not be affected by domain changes?

Thanks a lot and really sorry for the long explanation.
You can use the variable to refer to where the forum is hosted:
{$mybb->settings['bburl']}
, eg
<a href="{$mybb->settings['bburl']}/showthread.php?tid=23">Click here</a>
Thank you very much, Zinga!

But, I didn't quite understand the code. Say the link si coming from the /uploads directory? Will the format you have entered work for it? Can you do a little bit more code explanation?

Thanks!
If it is from upload, you need to use /upload/showthreadphp?tid=xx then.
Don't quite get your question..
(2008-08-27, 07:43 AM)xiaozhu Wrote: [ -> ]If it is from upload, you need to use /upload/showthreadphp?tid=xx then.

I am confused now. If I used this, it'll look for showthread.php in the uploads direcorty while there is really no showthread.php in the uploads directoy, it's in the main directory. So when I link FROM the uploads directory (for example) to a thread, how do I make it go one direcotory UP?

if the link is in index and links to > a directory in it (uploads) >, I'll use uploads/

BUT what if : Vice versa?

The link is in uploads and linking to the main directory?

I hope you can understand this better now.

Thanks!
It depends on where your files are.

Where are you linking it to? Adjust it accordingly then.
If it is not under uploads/ then use the root, which is what zinga gave.