I'm developing a site with framework Bootstrap
During development, I came across the problem related to path (path) of folders, images, pages and so on.
I was using include
to include header
and footer
on my site, however, I always encountered an error in the path, be it header and footer include, path of images and / or folders. It was then that I started reading about path relativo
and absoluto
.
To solve the header and footer path problem, I replace my includes with file_get_contents
, where I save the absolute address of my site variable and then just complete it as necessary. In this case I can print the header and footer on any page of my site.
Example:
$a = file_get_contents("http://localhost/sites/nome_da_pasta/include/header.php");
echo $a;
To solve the image, folder, and page path, I only inserted http://localhost/sites/nome_da_pasta/nome_do_arquivo.php
into the href
of the a
tag.
Before these changes, I was able to access the site through the cell phone, typing in the chrome of the device:
IPv4/caminho_do_site/index.php
However, I had the relative path problem.
Until then the two methods mentioned above, had solved my problem on the site using chrome browser on the notebook. However, when running the same site in the mobile phone chrome or in the notebook's mozilla browser, errors appear:
- A message appears on the phone
ERR_CONNECTION_REFUSED
- In Mozilla just open the localhost page.
Follow the error print on your phone:
Myquestionsare:
- Isthereaproperwaytocalltheabsolutepathofimages,folders,pagesandevenfootersandheaders(beingincludes)?
- Isthereabetterwaytoviewthesiteonmymobile?WithouthavingtouseIPv4(evenifthesiteisonlyonlocalhost)?
- Idonotunderstandhowthesamesite,withthesamesettingsandencodingsrunsonthenotebook'schromebrowser,buthasdifficultyrunningthroughIPv4onthephone.
- Whycannotthemobilephonefindthepathofthefolders/files/images/pagesonlocalhostifthesite(inthenotebook)can?
NOTE:IwouldliketounderstandthequestionsIaskedabove,butmybiggestneedistobeabletoopenthesiteonmymobilephoneaswell.
Update:
Idownloadedthemozillabrowseronmyphonetoseeiftheproblemwasjustinchrome,thefunnythingisthattheloginpageusuallyrunsonmyphone,butwhenItypeemailandpassword,theerrormessageappears,mobiletest:
Loginscreen:
Afterenteringemailandpasswordonmobile(keepinmindthatthewebsiteonthedesktopallpagesopennormally):