wwwouter
-
Posts
3 -
Joined
-
Last visited
Posts posted by wwwouter
-
-
Thank you both! @horst your solution works great for me. Configuring content types is a part of PW I was not yet familiar with.
It's so cool to discover new ways in which PW is such a powerfull and customizable product.This solves my problem, but I'm still curious why my altered RewriteCond didn't work, if anyone knows the answer to that I'd love to know!
- 1
-
Some context: I want to use PHP variables in my CSS (more info below) and found a solution on CSS-tricks that looks fairly elegant and somewhat solid to me. It's pretty simple, I created a file style.css.php inside the site/templates/ directory and load that in my page head. In style.css.php is the following:
<?php header("Content-type: text/css; charset: UTF-8"); header("Charset:utf-8"); if ($homepage->hero_image) { echo <<<CSS .hero { background: url($homepage->hero_image->url) no-repeat; } CSS; } ?>
Because of the following RewriteCond (line 373) in the htaccess file the server sends a 403 error back when the file is requested:
# Block access to any PHP or markup files in /site/templates/ or /site-*/templates/ RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))($|/) [NC,OR]
(My htaccess file is @version 3.0 and @htaccessVersion 301)
This is how I thought I could fix that (based on these answers on stack overflow) but it does not work:
# Block access to any PHP or markup files in /site/templates/ or /site-*/templates/ RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/templates($|/|/((?!style\.css).)*\.(php|html?|tpl|inc))($|/) [NC,OR]
I tested the rule with htacess tester and htaccess check and both worked for me, but on my site I still get a 403 instead of the file.
I'm working on localhost, using MAMP (not sure if that's relevant).
A bit more about what I want to do achieve specifically:
I want to use an image as a background-image for an element, not place it as an image. This image is provided by the user via a field and can therefore change.
I know I can achieve this like this:echo "<section class='hero' style='background-image: url($page->hero_image->url)'></section>";
But I would prefer a method other than inlining because of scalability and cleanliness. (I admit the extra link in the page head is not ideal either)
P.s. this is my first post here, I hope it's submitted in the right forum and my explanation is clear.
Media Manager Archive
in Media Manager
Posted · Edited by wwwouter
Hi @kongondo, thanks fo your plugin, I just bought and installed it and am now setting things up. Just wanted to let you know I had this same problem and this fix worked for me, but I don't have Media Manager installed in a subfolder (I think). My setup is: localhost (MAMP), Media Manager is installed in Applications/MAMP/htdocs/website/site/modules/MediaManager. When I move on to the live site I will let you know if it happens there as well. If you have any questions to help find out more about this bug let me know.
edit: I'm using PW 3.0.165 and MM v0.1.2 β