Changing 'public' folder functionality

Feed 8 posts, 4 voices

Avatar
8 posts

In RadiantCMS, files that need to be publicly accessible (CSS, js, images, etc) are put in the ‘public’ folder, just as in Frog, but ‘public’ is not part of the path.

Is there a way to do this in FrogCMS? It’s just much cleaner and prettier.

Example:

<link href="/css...">

instead of

<link href="/public/css...>
 
Avatar
76 posts

Yes, although it’s not Frog CMS specific. There’s an HTML tag you can add to your layout.

Add a BASE tag (within the HEAD) to your layout, and set the path for all auxiliary files such as CSS and images, like this:

<head>
...
<base href="<?php echo URL_PUBLIC ?>public/" />
<link href="css/foobar.css" rel="stylesheet" />
...
</head>
<body>
<img src="images/foobar.jpg" />
</body>
 
Avatar
343 posts

This is more related to your theme I think. You can always use this the <base> tag to overcome this. Example for your question :

<head>
<base href="/public/" />
<link href="css...>
</head>
<body>
<img src="example.jpg" />
</body>

Where the css… and example.jpg files are in the public folder.

 
Avatar
8 posts

The BASE tag is a good tip, but it doesn’t help with images embedded in CSS, and it doesn’t help with the fact that my relative and absolute file paths are all mucked up, since I’m porting to Frog from vanilla HTML.

I’m pretty sure this is default behavior in Frog, not a problem with my theme, but if it’s a problem with my theme, I’d like to find a fix or at least a workaround.

Any other thoughts?

 
Avatar
541 posts

in your css just use the relative path …

ex:

/public/css/styles.css
/public/images/your_image.png

in your css use ../images/your_image.png

 
Avatar
76 posts

Porting from vanilla static pages to any CMS will involve some manual work to change paths – there is no escaping that.

 
Avatar
8 posts

I do realize that porting takes some doing, but it’s not the work I’m concerned about.

I’m just saying that Radiant has a more elegant solution for storing static files. Shall I post a feature request instead?

 
Avatar
541 posts

well this is not a really big probleme .. I don’t think tu have public or not is a big question and i’m not sure that adding addition condition and time for removing it is really important … just take wordpress … all theme files (css, images, js …) are in wp-content/themes/theme_name/ … so /public/ is not so bad ;)

 
Avatar
8 posts

I agree, but I submit that the point of developing Frog isn’t to make it good compared to Wordpress, but to be the best it can be, standing alone.

My 2ยข