GetSimple Support Forum

Full Version: Hiding /theme Folder in Source
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
One thing I love about GetSimple is that if you look at the source, it almost looks like a pure HTML site. One thing that hints that it's a CMS is the /theme folder.

It seems like most of the references is due to:
  • CSS
  • JavaScript
  • Images

Is there a way to "hide" the /theme folder?

Perhaps a combination of PHP script to rewrite references to CSS, JavaScript, and Images to /css, /js, and /images respectively and .htaccess to redirect these folders to the theme-specific folders?
Just use a rewrite rule and rewrite those folders to theme/
Of course you will have to manually change your theme.
(2013-04-03, 06:34:37)shawn_a Wrote: [ rel="nofollow" -> ]Of course you will have to manually change your theme.

Is there a way to NOT change the theme (like through custom PHP function)?
I doubt it there is no way to know now a theme calls its assets.
You could use hooks and output buffering then replace the paths before they goto the browser. But talk about over complicating something for some unknown benefit.
(2013-04-03, 10:30:49)shawn_a Wrote: [ rel="nofollow" -> ]I doubt it there is no way to know now a theme calls its assets.
You could use hooks and output buffering then replace the paths before they goto the browser. But talk about over complicating something for some unknown benefit.

I guess the point is you keep your customizations modular so they'll survive upgrades. Is there a place where users can enter custom functions that won't be affected by GS or theme upgrades?

If not, what would be an elegant solution? Add an include line in /index.php to reference a separate PHP file? And re-add that line at every upgrade?

P.S. I'm looking at it from a management perspective. When the next version of GS comes out, I want to make sure I don't lose any customizations I've made.
you can write your own functions in functions.php file stored in theme directory.
All functions will be loaded before executing theme's file.
My point is the theme is hardcoded to the theme subdirectory.
They all are.

Its not really a php or function issue. You have to change it manually or via output buffering like i said.

Ideally and Perhaps you could change the theme folder definition in core but I have no idea if that will work, and there is no guarantee that a theme even sues that for the path.
(2013-04-03, 22:54:16)shawn_a Wrote: [ rel="nofollow" -> ]Its not really a php or function issue. You have to change it manually or via output buffering like i said.

I think there's several problems to solve in order to achieve this:

1. Where to put the code? I asked a similar question here and a brilliant answer was to make a static plugin that you control. There's no update to the plugin, since it's yours and you can put what ever custom code in it.

2. Like shawn_A mentioned, develop PHP code to rewrite any references to files like /theme/some_theme/css/style.css to /css/style.css.

3. Craft .htaccess to rewrite /css/style.css back to /theme/some_theme/css/style.css.

That way, /theme/some_theme/css/style.css never appears in the HTML source code.

Problem 1 & 3 seems very easy to do. Problem 2 seems a bit more difficult.

shawn_A, you wouldn't, by any chance, want to take a crack at problem 2, would you?
Easiest thing is to just use a rewrite and change the theme, I do not understand why this is not preferred, is this something that needs to work across many sites, why does it need to be code.
Ok I got this working problem is that
Code:
get_theme_url()
is hardcoded to theme.
infact theme folder is hardcoded all over core, as is other paths for some reason.

So there are some core modifications needed, maybe I can get this fixed in 3.2.2
there are about 3-4 places in code that need to be modified to use GSTHEMESPATH or some other config option.
(2013-04-04, 06:06:42)shawn_a Wrote: [ rel="nofollow" -> ]infact theme folder is hardcoded all over core, as is other paths for some reason.

I think in the long run, cleaning up the hardcoded /theme folder would be useful to everyone.