Copy link to clipboard
Copied
Is there a way to use 'ALT+click" to show css properties in php files?
When I ALT+left click an element, on a php file with include(...) I only see:
Is this one of the limitations of working with php files?
Copy link to clipboard
Copied
It works as expected for me, but my .css links are standard html links.
I'd wager DW is having issues with php script in your css file paths, like it does with the Visual Media Queries Bar.
Copy link to clipboard
Copied
I have no problem seeing the properties in PHP files or the media queries bar if I turn it on.
The <head> of my php page comes from a server-side include file.
<?php include("includes/head.html"); ?>
The include file contains ordinary links to external CSS files, some hosted locally and some on CDNs. The local file paths are relative to my parent document which is at site root level.
<link rel="stylesheet" type="text/css" href="styles/style.css">
Copy link to clipboard
Copied
I guess than that it not the "include", it is the actual link i use.
To make sure I always get the right path I use:
<link href="<?php echo siteRoot()?>/css/bootstrap.rtl.css" rel="stylesheet" type="text/css">
How can i set the css relative to my site root?
When I try this:
<link href="<?php echo siteRoot()?>/css/main.css" rel="stylesheet" type="text/css">
The styles are respected but I can't see the properties.
When is use this:
<link href="/css/main.css" rel="stylesheet" type="text/css">
The properties are not respected and there are no styles to my page (same for "css/main.css").
Now the strange thing it that when I use both:
<link href="<?php echo siteRoot()?>/css/main.css" rel="stylesheet" type="text/css">
<link href="/css/main.css" rel="stylesheet" type="text/css">
The styles are respected andi can see the properties.
Can you explain this?
Perhaps it has to do with the fact your site is under the root of the testing server?
Copy link to clipboard
Copied
Is there an easy way to change my xampp root for each testing server i have?
e.g. 2 testing servers under:
c:\xampp\htdocs\test1 => root should be "http://localhost/test1
c:\xampp\htdocs\test2 => root should be "http://localhost/test2
Copy link to clipboard
Copied
your question does not seem clear to me....
what do you call having different test servers... are they different servers configured differently (different PHP versions, different config.ini, different servers (apache, nginx....).. etc...) or are they different applications to be tested?
Copy link to clipboard
Copied
Ok,
I simply have 2 sites in DW, each points to a different Local Testing server folder:
When i use the testing sever i want the root to be correct for each site so that root relative files will be found.
c:\xampp\htdocs\test1 => root should be "http://localhost/test1
c:\xampp\htdocs\test2 => root should be "http://localhost/test2
Copy link to clipboard
Copied
yes ... I get it...
so you don't have to bother with pathname... just use
/ before your path, you'll be absolute to the root server, what ever it's name is...
and if you want to locate your work outside of C, which I recommand, use aliases to indicate to xamppp where your root folder is on other hard drive...
Copy link to clipboard
Copied
Thanks,
I have tried using / before the path but the file is not found.
When i try to "view in browser" and then use the "inspect" option in chrome. i see that:
"http://localhost/main.css" cannot be found. i guess this is because the root of the server is "c:/xampp/htdocs" and not "c:/xampp/htdocs/DnD_B4"
On the actual website "/" in front will work but i need it to work on my local testing server as well without any script to find the root.
How do I configure aliases?
Copy link to clipboard
Copied
well, to avoid any confusion and any untimely headache....
as a starting point, could you please tell me the following points:
thanks
Copy link to clipboard
Copied
THANKS
Copy link to clipboard
Copied
karpiyon wrote
- copy of the HTML code to manage links and includes....
I am opening the file under /_templates/page.php so teh root is one directory above
<link href="../css/main.css" rel="stylesheet" type="text/css"> this IS working
<link href="/css/main.css" rel="stylesheet" type="text/css"> this is NOT working
The reason is quite simple
../ goes up one directory
/ goes to the root directory
Going up one directory will work in every ambient. The root directory in a local XAMPP server is www (localhost) and not your site, while on the remote it will be the www/httpdocs/etc part which is your site.
Edit: I just noticed that php - Root Directory of Website (using Xampp) - Stack Overflow has not been of much use to you. But the location of the XAMPP root directory is the cause of your problem. The problem disappears when you go remote.
Copy link to clipboard
Copied
BenPleysier a écrit
Edit: I just noticed that php - Root Directory of Website (using Xampp) - Stack Overflow has not been of much use to you. But the location of the XAMPP root directory is the cause of your problem. The problem disappears when you go remote.
that's why I was using aliases that directly point on the website root folder and not on the xampp root folder
Copy link to clipboard
Copied
and this is the error in chrome when i user the "/" infront of teh css file
Copy link to clipboard
Copied
did you manually change the HTTP port ?... from 80 to 55648...
Copy link to clipboard
Copied
Yes i am aware of this and this is what i stated - the problem is only locally.
Still, it was mentioned here that it should be possible to use the "/" even on the local site.
What I am trying to achieve is:
Copy link to clipboard
Copied
Have a look at this answer PHP XAMPP Server DOCUMENT_ROOT folder structure - Stack Overflow
Copy link to clipboard
Copied
Thanks!
This talks about using a variable or any part of code to deduct the root folder.
I've done this and my site is working fine, both locally on on remote.
However, using any kind of code to deduct root folder and than use this when i call a .css file disable the property inspector.
This is what i try to refrain from doing - no code for site root.
Copy link to clipboard
Copied
The only other way is to change the XAMPP root directory, but this would apply to all of your sites. Have a look at this answer php - how to configuring a xampp web server for different root directory - Stack Overflow
Copy link to clipboard
Copied
BenPleysier a écrit
The only other way is to change the XAMPP root directory, but this would apply to all of your sites. Have a look at this answer php - how to configuring a xampp web server for different root directory - Stack Overflow
using aliases resolve it too... (well I didn't read the article and perhaps that is what they explain to do...
anyway using aliases dosen't apply to all web site but it is a case by case...
Copy link to clipboard
Copied
Sorry Birnou, I just skimped over the replies, and yes, we seem to be going around in circles. aliases would solve the problem.
Copy link to clipboard
Copied
dont worry Ben, I think the same thing... the simplest would be a good old alias
Copy link to clipboard
Copied
Could you send a link which explains how to use alias xampp server please?
Copy link to clipboard
Copied
karpiyon a écrit
Could you send a link which explains how to use alias xampp server please?
here is a way to handle it, in the more evolutive and object way
now when you want to create an alias
Alias /mywebsite/ "D:/mywebsitelocation/"
<Directory "D:/mywebsitelocation/">
Require all granted
</Directory>
use the alias
added comment...
you can use and point to a Synology NAS as aliases, so in the CONF file enter the following (minimum)
Alias /mywebsite/ "//yourNASserver/mywebsitelocation/"
<Directory "//yourNASserver/mywebsitelocation/">
Require all granted
</Directory>
and you can add any additional instructions that you will need for this specific web site in the CONF file
Copy link to clipboard
Copied
As what I've came up with so far, and yes it does not look clean is this:
I load the php head:
require_once(phpRoot()."/_scripts/pageMake/heads.php");
in the head i cal the same file twice:
<link href="<?php echo siteRoot()?>/css/main.css" rel="stylesheet" type="text/css">
<?php if(isLocalSite()):?>
<link href="/css/main.css" rel="stylesheet" type="text/css">
<?php endif?>
I do this for each style sheet i want to appear when ALT+click as well as for the media queries.
If i neglect the /css/main.css in this case ithe properties are not show when I ALT+click.
If I on;y use /css/main.css i have no styles at all.
Why is this working?
Dan