Tags

, , , ,

You’re in a jungle. There are many trees and the forest is dense and dark. You’ve lost the path.
How will you get back to your home?
If you have a device, that can give your exact location, finding the way to home seems much easier. Isn’t it?
A complex website structure sometimes seems to be like a dense forest. And we think, oh, God, let me have a device that can locate my root easily.
Let me explain why it happens.

Suppose, you’re building a website. The structure is like this – root->flow-control->foreach-loop/foreach-loop.php.
You’re staying at the foreach-loop.php and you want to know your total root path; so that you can easily go back to the root and access any folder there.
What’s more, the ‘css’ folder stays at the root folder at the same position as ‘flow-control’ folder.
However, you are staying one step below and want to use the same ‘css style’ that the ‘css’ folder is keeping now.
And now comes the best part.
Just attch a php file on the top of the ‘foreach-loop.php’ file.

  • echo $_SERVER[‘SCRIPT_NAME’]

It will give you the correct path and shows how you’ve reached there.  The output is :

  • /sanjib/flow-control/foreach-loop/foreach-loop.php

Now it is very easy to reach the ‘css’ folder. Write down the connector link as :

  • link href=”../../css/shop-homepage.css” rel=”stylesheet”

The first-two-dots of the above link indicate the root or ‘sanjib’ folder. The second-two-dots indicate the ‘flow-control’ folder which is sharing the same platform with ‘css’ folder. And now your ‘foreach-loop.php’ file is sharing the same platform with the ‘shop-homepage.css’ file.

Sound good?

Since you here…

I’m a professional writer. I do nothing; I only write books.
If you find this post helpful please consider buying any of my books. You can buy from either Leanpub or amazon.
If you live outside the USA, it is good to buy from Leanpub.
Let me explain why. I don’t get my royalty of outside-USA-sale on Amazon. So please consider that aspect.
Maybe you are not in the mood to buy my book. In such case, you can send any amount as a ‘token of appreciation’ through Paypal.
My Paypal username-email is sanjib12sinha@gmail.com.

Advertisements