Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hiding /theme Folder in Source
#1
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?
Reply
#2
Just use a rewrite rule and rewrite those folders to theme/
Of course you will have to manually change your theme.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
(2013-04-03, 06:34:37)shawn_a Wrote: Of course you will have to manually change your theme.

Is there a way to NOT change the theme (like through custom PHP function)?
Reply
#4
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.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#5
(2013-04-03, 10:30:49)shawn_a Wrote: 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.
Reply
#6
you can write your own functions in functions.php file stored in theme directory.
All functions will be loaded before executing theme's file.
Addons: blue business theme, Online Visitors, Notepad
Reply
#7
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.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#8
(2013-04-03, 22:54:16)shawn_a Wrote: 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?
Reply
#9
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.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#10
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.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#11
(2013-04-04, 06:06:42)shawn_a Wrote: 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.
Reply




Users browsing this thread: 1 Guest(s)