php - Stylesheet not found when link is correct -
i trying link stylesheet php template website. used link: <link rel="stylesheet" type="text/css" href="{{app.request.basepath }}/app/views/templates/style.css">
now, works on localhost server(i use mamp), when upload files web host error:
failed load resource: server responded status of 404 (not found)
the panel have seems support 5.5, use 5.6 on local server. issue.
and gives me link, exact link file, no misspelled or capitalized letters. file trying link stylesheet in same folder stylesheet. rewriting .htaccess file because using slimphp file is:
rewriteengine on rewritecond %{request_filename} !-f rewriterule ^ index.php [qsa,l]
i think might have being unable link not sure. in advance of help
edit: fixed problem linking style sheet public file in directory. there, link images using css, had place them in public directory
this how route theme-specific stylesheets in slim , twig. first create new config variable, themes.path
, contains actual filesystem path theme. set route css/theme.css
:
$app->config([ 'themes.path' => "path/to/themes" ]); /* render theme css */ $app->get('/css/theme.css', function () use ($app) { $app->response->headers->set("content-type", "text/css"); $css_include = $app->config('themes.path') . "/mytheme/css/theme.css"; $app->response->setbody(file_get_contents($css_include)); }
to use theme stylesheet in template documents, do:
<!-- theme stylesheet --> <link rel="stylesheet" href="{{site.uri.css}}theme.css" type="text/css" >
where site.uri.css
global template variable contains path (public) css directory. can hardcode part, if prefer.
Comments
Post a Comment