Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

How to refer to location of css file

Asked Modified Viewed 6,843 times
I
isuzucrewcab
I
  • Member, joined since
  • Contributed 70 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
asked
Member

Hi,

I have a subdirectory structure under the phpfusion base directory which holds the code for my custom pages. Under that directory I have a css directory where I want to store my css files.

So,

phpfusion7
.........|-----mycode
.....................|----- css

How do I refer to the location in the <link rel> line in my header? I can only get it to work if it is in the phpfusion7 directory.

Thanks
0 replies

15 posts

B
Basti
B
Basti 10
[PHP-Fusion Crew Member & Admin from June 2008 - December 2010]

http://basti2web.de - Support Site for my infusions
  • Veteran Member, joined since
  • Contributed 1,099 posts on the community forums.
  • Started 32 threads in the forums
answered
Veteran Member

use the constant BASEDIR
0 replies
I
isuzucrewcab
I
  • Member, joined since
  • Contributed 70 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
answered
Member

If I do this to test -

require_once "maincore.php";
print "base".BASEDIR;



I just get base.
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

echo BASEDIR.'mycode/css';
0 replies
A
afif
A
afif 10
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 12 threads in the forums
answered
Member

try putting this in your header.

echo "<link media='screen' type='text/css' href='".BASEDIR."mycode/css/[color=#ff0000]yourcss.css[/color]' rel='stylesheet'/>";
0 replies
I
isuzucrewcab
I
  • Member, joined since
  • Contributed 70 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
answered
Member

Still no joy. the BASEDIR is not showing anything.
0 replies
B
Basti
B
Basti 10
[PHP-Fusion Crew Member & Admin from June 2008 - December 2010]

http://basti2web.de - Support Site for my infusions
  • Veteran Member, joined since
  • Contributed 1,099 posts on the community forums.
  • Started 32 threads in the forums
answered
Veteran Member

well, BASEDIR should show nothing if your executed file is in the same folder like the maincore.php.

But if you execute the file /forum/index.php, the BASEDIR should be "'../".

So BASEDIR shows the relative path to your root folder of php-fusion.
0 replies
A
afif
A
afif 10
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 12 threads in the forums
answered
Member

weird. using BASEDIR should have worked..
0 replies
B
Basti
B
Basti 10
[PHP-Fusion Crew Member & Admin from June 2008 - December 2010]

http://basti2web.de - Support Site for my infusions
  • Veteran Member, joined since
  • Contributed 1,099 posts on the community forums.
  • Started 32 threads in the forums
answered
Veteran Member

BASEDIR must work in this case. If it does not work, he is doing something wrong.

0 replies
A
afif
A
afif 10
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 12 threads in the forums
answered
Member

yep. BASEDIR always work. isuzu, maybe you should explain a lil bit further so we could help you..
0 replies
I
isuzucrewcab
I
  • Member, joined since
  • Contributed 70 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
answered
Member

Ok,

If i do this


echo "<link media='screen' type='text/css' href='cbw/css/cbw.css' rel='stylesheet'/>";


it works, but if I include the BASEDIR, it stops.


echo "<link media='screen' type='text/css' href=BASEDIR.'cbw/css/cbw.css' rel='stylesheet'/>";


Yet, when i do a print on BASEDIR it is blank, so the url should not change - correct??
Edited by isuzucrewcab on 03-01-2010 00:41,
0 replies
H
Harly
H
Harly 10
Regards, Har1y.
  • Senior Member, joined since
  • Contributed 302 posts on the community forums.
  • Started 51 threads in the forums
answered
Senior Member

The code is wrong. This is correct:
echo "<link media='screen' type='text/css' href=[color=#990000]'".[/color]BASEDIR.[color=#990000]"[/color]cbw/css/cbw.css' rel='stylesheet'/>";
Edited by Harly on 03-01-2010 10:59,
0 replies
A
afif
A
afif 10
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 12 threads in the forums
answered
Member

yep! you need to have the quotation mark and the full stop, then BASEDIR, then another full stop and quotation mark.
0 replies
H
hen3ry
H
hen3ry 10
  • Member, joined since
  • Contributed 53 posts on the community forums.
  • Started 25 threads in the forums
answered
Member

I'm doing something very similar: I want to use a single, custom site-wide stylesheet for all my custom pages.

I understand the "how" and the "why" of this issue, but I need to understand where. In the thread above, speaking about a stylesheet specification like this:


echo "<link media='screen' type='text/css' href='".BASEDIR."cbw/css/cbw.css' rel='stylesheet'/>";


afif says, "try putting this in your header". How?

I don't think this code would go in the content of a custom page ("Add Custom Page" admin panel) because I'm fairly certain all stylesheet specifications need to go way up at the top of the generated HTML, inside <head> ... </head>. It doesn't seem possible for the Custom Page mechanism to do this.

But I can't find where to insert the stylesheet specification.

A little help, please?

TIA
0 replies
H
hen3ry
H
hen3ry 10
  • Member, joined since
  • Contributed 53 posts on the community forums.
  • Started 25 threads in the forums
answered
Member

Here is the answer to my follow-on question:

http://code.starefossen.com/infusions/fusion_functions/functions.php?function=add_to_head

This is how "downstream" content in custom pages can modify the html header of generated pages, specifically, to insert a reference to a custom stylesheet.

There's a relevant example given.

Thanks, Starefossen!

hen3ry
0 replies
A
afif
A
afif 10
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 12 threads in the forums
answered
Member

you should know that in your theme folder there's a folder named 'templates'. in there you can find header.php and admin_header.php. put the import css command in both. that should be fine.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 15 posts
  • Votes 0 votes
  • Topic users 6 members

6 participants

H
H
Harly 10
Regards, Har1y.
  • Senior Member, joined since
  • Contributed 302 posts on the community forums.
  • Started 51 threads in the forums
A
A
afif 10
  • Member, joined since
  • Contributed 183 posts on the community forums.
  • Started 12 threads in the forums
I
I
  • Member, joined since
  • Contributed 70 posts on the community forums.
  • Started 32 threads in the forums
  • Started this discussions
B
B
Basti 10
[PHP-Fusion Crew Member & Admin from June 2008 - December 2010]

http://basti2web.de - Support Site for my infusions
  • Veteran Member, joined since
  • Contributed 1,099 posts on the community forums.
  • Started 32 threads in the forums
P
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
H
H
hen3ry 10
  • Member, joined since
  • Contributed 53 posts on the community forums.
  • Started 25 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet