Hello,
I am trying to get a purchased drupal theme to work with OpenPublish 1.7.1. I read in a post here somewhere that OpenPublish doesn't support other stand-alone themes, and so to use other themes, you have to make them be sub-themes of the base OpenPublish theme. So, I tried altering the code on the purchased theme so it is a sub-theme of the default openpublish theme. When I did this, however, there were collisions between functions in the two themes' template.php files that caused the site to break - both are based on a phptemplate theme, and so the following functions are declared in both places:
phptemplate_breadcrumb
phptemplate_preprocess_page
phptemplate_menu_local_tasks
phptemplate_comment_submitted
phptemplate_node_submitted
phptemplate_get_ie_styles
phptemplate_menu_item
I commented these functions out of the file for the purchased template and the site loads now, but the purchased template is not behaving as it should (though it is pretty close - the only part that is problematic is the home page - it doesn't load any content).
So, where do I go from here? If possible, I'd like to get this all working while minimizing code changes to third-party pieces they will need to update in the future, since those I am helping are short on resources, and I want them to be able to upgrade without needing to change too much code each time.
Is it possible to use a theme other than the OpenPublish theme without sub-theming the OpenPublish theme? If so, then I could just use it as a reference and hack away at the one we purchased.
If I leave the purchased theme as a sub-theme, I could probably go through and rename the functions above in the purchased theme, and then change the other parts of the template so it calls the renamed functions, and see how that works. Might this be an option?
If I have to change one or the other, I'd prefer not to change the OpenPublish theme, so OpenPublish updates don't require code changes. If it is the path of least resistance, however, I could also just comment out or rename the colliding functions in the OpenPublish theme.
The purchased theme is ThemeNews, from themesnap.com.
Any help or advice on how to proceed will be greatly appreciated.
Thanks,
Jonathan Morgan
Comments
You can rename any function
You can rename any function that starts with "phptemplate_" to "themename_" where "themename" is the machine-name of the theme. For instance, if your theme's name is "london_blue", you can rename "phptemplate_comment_submitted" to "london_blue_comment_submitted" and once you clear cache, everything will still work.
In OpenPublish 2.0 all functions are renamed to openpublish_theme_* to eliminate the chance of such problem, but for now it's probably better to rename functions in the theme you are creating.
Hope this helps.
.............................................
http://twitter.com/inadarei
set theme as sub-theme?
Do I need to keep the purchased theme that I am trying to get working coded as a sub-theme of the OpenPublish default/base theme? I think I read in one of the group posts here that themes need to be sub-themes of the OpenPublish default/base theme, but now I can't find that post, and so I just want to make sure.
Thanks for the help!
Here's an excerpt from the
Here's an excerpt from the new OP documentation (not yet published) that covers your question:
-------- What Is an OpenPublish Theme?
OpenPublish theme is any theme that can be used with OpenPublish and can supports full functional spectrum of the OpenPublish platform.
Technically, any Drupal theme can be enabled in OpenPublish, but that does not mean that any Drupal theme is compatible with it. OpenPublish adds a wide variety of features on top of those supported by vanilla Drupal. Drupal themes not built for OpenPublish are typically not aware of these features and therefore either do not properly support them or ignore them altogether.
OpenPublish distribution comes with a base theme: openpublish_theme. The purpose of the base theme is to ease the development of themes compatible with OpenPublish. While not technically necessary, it is highly recommended to start any OpenPublish theme as a sub-theme of the openpublish_theme.
When releasing versions of OpenPublish, we constantly update openpublish_theme. The themes that properly sub-theme openpublish_theme will automatically get most bug-fixes and improvements, simply by updating openpublish_theme. Those themes that don't sub-theme openpublish_theme, will have to do independent maintenance and updates, which could be costly, over time.
.............................................
http://twitter.com/inadarei
sub-theme it is
Thank you. I'll keep it sub-themed. I think this purchased stand-alone theme is going to end up being the starting point for me learning that OpenPublish default theme and then keeping the look and feel, but swapping in OpenPublish specific code where I have to make things not implemented in the base OpenPublish theme work. If there is a particular way it would be helpful for me to document what I do as I go, I'd be happy to. I think others here would find that helpful. I'll start by just adding notes to this discussion.
To try to cut down on confusion, theme I am converting will be referred to as the "stand-alone theme", and the OpenPublish default theme will be referred to specifically as the "OpenPublish default theme".
Attempt to make a stand-alone theme work in OpenPublish (1.7.1):
- Step 1: change all "phptemplate_" function names to "_" in template.php in the stand-alone theme.
- Step 2: use OpenPublish default theme code as a reference to figure out how to make the stand-alone theme interact with OpenPublish content types (instead of default "Story", which the particular stand-alone theme I am working with is configured to display by default).
Thanks,
Jon
Your Opinion of ThemeNews
What is your opinion of ThemeNews? I'm considering it as a base for an OP child theme?
OK so far, but themesnap won't support using it as OP sub-theme
Hello,
Well, the theme looks nice and seems to work pretty well as a sub-theme, except for the home page, but in talking with the Themesnap developers, they don't support using their themes as sub-themes, and so said essentially that they wouldn't help figure out how to make it work with OpenPublish. They also said something about having to customize the Useful Blocks module code.
I am going to try to work through getting it to function in OpenPublish and I can keep you posted. Not sure what to tell you until I dig into the code a little bit more, though, and see how truly incompatible the newstheme is with sub-theming and with using the OpenPublish content types instead of "Story". I'll keep posting updates to this thread, though, so you can see progress.
Jon
By the way, OP 2.0 will be
By the way, OP 2.0 will be released before DrupalCon and will have significantly improved base theme (among other things). Not sure if you can or should wait, but just something to keep in perspective.
.............................................
http://twitter.com/inadarei
Would I be able to benefit from the new base theme?
Would I be able to benefit from the new base theme if I've already done a lot of work customizing the CSS on the current base theme? Or is it going to take a lot of work to adapt it?
That really depends on the
That really depends on the kind of customizations you've done, but I would not expect it to be too much work.
.............................................
http://twitter.com/inadarei
Mostly CSS
Most of the customizations I've done have been CSS. Sounds like fun : )
Will 2.0 have major underthehood changes, similar to adding Features in 1.7? That upgrade was important for me to perform, but a little intimidating at points.
To jonathan.morgan
Hello,
Can you please elaborate on how the frontpage is not working? is everything else fine with the theme you have?
Thank you,
Walid.
www.hibr.me