News:

Follow us on Bluesky!

Main Menu

Board Dir

Started by Mr. Pedram, February 22, 2013, 12:36:44 PM

Previous topic - Next topic

Mr. Pedram

Hey SMFers,
What's the "Board Dir" variable exactly?


', $settings['boardurl'], '


or


', $settings['boarddir'], '


neither is work!
even with underline between board and url or dir!

i want to set address to root dir, where forum/s installed. a little help please.
*Set address for "src"

My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

All Colours Sam

Use $boarddir  which is defined directly in Settings.php

You just need to globalize it.

global $boarddir ;

do not that  $boarddir and $boardurl are two different things, the first one holds a path while the second holds an url.

SMF also provides a var for the sources dir:  $sourcedir and the cache dir: $cachedir, this is done because it is possible to move out those dirs to another location without breaking anything.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Mr. Pedram

Quote from: Suki on February 22, 2013, 12:54:19 PM
[size=78%]global $boarddir ;[/size]

global $boarddir ; not working dude

you means:


', $global['boarddir'], '


still not working.


<script type="text/javascript" src="', $global['boarddir'], '/js/script.js"></script>


some developers used this for set url for "src":


' . $boardurl . '

Ex:

<script type="text/javascript" src="' . $boardurl . '/js/script.js"></script>


yes , it's works only for forums that installed in root, not smth like this:


root/forum

i want to set url for src , where exactly forum installed, even @ sub folders!
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

All Colours Sam

I'm not a dude.


Please do take a look and see the code I wrote:

global $boarddir;

put that line of code somewhere in your code before using the var, then you simply need to use $boardurl

example:

echo $boardurl;


but most importantly, what exactly are you trying to do?  please tell me exactly and with the most details as possible, what do you want to do.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Mr. Pedram

Quote from: Suki on February 22, 2013, 01:49:50 PM
I'm not a dude.


Please do take a look and see the code I wrote:

global $boarddir;



it was Unclear a little, but now i get it what's your means.

Quote from: Suki on February 22, 2013, 01:49:50 PM
I'm not a dude.



Sorry!


Quote from: Suki on February 22, 2013, 01:49:50 PM
but most importantly, what exactly are you trying to do?  please tell me exactly and with the most details as possible, what do you want to do.


i mentioned in prev post
anyway,


you means:



';
echo '
global $boarddir;
<script type="text/javascript" src="' . $boardurl . '/js/script.js"></script>


?
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

All Colours Sam

Please tell me why do you want to use the board dir, for what purposes do you want to use the dir path?

I'm asking yo because depending on what you wan to do, there might be a better alternative.

Do you want to load a JaveScript file?
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Mr. Pedram

However i mentioned in my last posts, but:


Quote from: Mr. Pedram on February 22, 2013, 12:36:44 PM


i want to set address to root dir, where forum/s installed. a little help please.
*Set address for "src"




Quote from: Mr. Pedram on February 22, 2013, 03:01:44 PM

i mentioned in prev post
anyway,



';
   echo '
   global $boarddir;
      <script type="text/javascript" src="' . $boardurl . '/js/script.js"></script>


?




Quote from: Suki on February 22, 2013, 03:05:09 PM


Do you want to load a JaveScript file?


yes,


for Ex.


<script type="text/javascript" src="', $settings['theme_url'], '/scripts/theme.js"></script>


it will be load from "scripts" folder in theme dir, but i want to load from root to a folder, Ex:


<script type="text/javascript" src="' . $boardurl . '/js/script.js"></script>

My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

All Colours Sam

Why do you want it to load from the root?  loading it from the root isn't going to help at all, while keeping all your JS files in a single folder does help with keep things organized.


Anway... you want to use an url, not a path.

$boarddir is a path:

C:/wampp/forum/

$boardurl is an url:

http://mysite.com/forum/


if you want to load your JavaScript from the root directory then use:

global $boardurl;

echo '<script type="text/javascript" src="' . $boardurl . '/script.js"></script>';

and put your script.js in your forum root dir.
Oh, wouldn't it be great if I *was* crazy? ...then the world would be okay
Suki

Mr. Pedram

QuoteWhy do you want it to load from the root?


not root, a folder on root


Root/js/script.js


that MOD i/m writing, will be add a folder to the root, like "Tapatalk" or "SMF Blog" and etc...






now it's working with:



'; global $boardurl;
echo '
<script type="text/javascript" src="' . $boardurl . '/mod/js/script.js"></script>



Thanks a lot for your help.
My Modifications:
» Loading For SMF
» Buddies Block
» Redirect Links
» Birthdate On Registration
» PM Warning
» Instagram
» Add Table,Td,Tr Button
» Search Topic & Board Button
Browse All...

Advertisement: