Using default OpenPublish theme

Events happening in the community are now at Drupal community events on www.drupal.org.
Citizen's picture

If you want to use the OpenPublish theme s it absolutely necessary to create a sub-theme or can you just configure and use the default openpublish_theme?

Comments

Running with the default Open-Publish theme

crotown's picture

It seems to me that one almost has to create a sub-theme and make your own front-page.tpl.php file, at least. The default OpenPublish theme uses the twitter_pull module to pull the recent tweets from @OpenPublish. If you didn't want OpenPublish's tweets on your front page you would have to override that template.

For those interested, here is the code from front-page.tpl.php that would usually require an override:

<?php
print twitter_pull_render ('@openpublish', t('Our Tweets'), 3, 'op_homepage_tweets');
?>

If this were done in a modular way, with the FeedAPI module (also included in OpenPublish), for example, the block could be hidden easily, but instead twitter_pull is hard-wired into the theme. This looks like a conscious decision to me.

I just made a copy of the OpenPublish theme...

irishgringo's picture

and hacked it up... no sub theme at all.
I also replaced the menu system and ripped out the Twitter pull.
Also added some regions for adds.

It's best practise to create

resveld's picture

It's best practise to create a sub-theme, cause if you would upgrade Openpublish, your own theme would still be intact instead of overwritten!

Thanks for all the comments.

Citizen's picture

Thanks for all the comments. We ended up creating a sub-theme folder, copied everything into it, created a new .info file and we also had to tweek the template.php file. Everything seems to be working properly so far. (keeping my fingers crossed!)

To crotown: We are definitely interested in taking the tweets off the front page. Would we just need to delete that php code that you posted?

Omitting the tweets

crotown's picture

Yes, just deleting that line in page/page-front.tpl.php will delete the tweets.

It's also a best practice to have as few files in your sub-theme as necessary. If you simply copy (override) all the base theme files you will not benefit at all when the base theme is upgraded (though at least you won't get your theme overwritten!).

I recommend you first make a .info file for your new theme as described in http://openpublishapp.com/doc/your-first-openpublish-subtheme. Then make a sub-directory called page/ with two files page.tpl.php and page-front.tpl.php, where the latter has the line we've mentioned deleted, and the former is just a copy of the file of the same name in openpublish_theme. The resulting theme will be the same as the out-of-the-box theme but without the tweets on the front page. Three files is all you need in your tweetless sub-theme, at first.
Then add files to the sub-theme as needs arise.

You may be wondering why you need the copy of page.tpl.php, at all. It is because of a bug that is fixed in Drupal 7 but will never be fixed in Drupal 6. It is described here: http://drupal.org/node/279573.

-Steve

perhaps I should clarify...

irishgringo's picture

I copied the open publish theme to another theme... and hacked the new theme... I don't see how that will be overwritten as its a completely separate theme now.

Consider sub-theming anyway

crotown's picture

@IrishGringo,
Consider converting your hacked version of openpublish_theme into a sub-theme now, to save lots of time in the future. In particular, consider two future scenarios:

(1) A security flaw is found today in the version of openpublish_theme that you modified, say 6.x-1.12. Clearly your theme has the same vulnerability and needs to be upgraded, but how do you even know what to change in your theme?

(2) OpenPublish 3.0 comes out including openpublish_theme 6.x-2.0 and it has great new features you want to use on your web site right away. But your theme does not work with OpenPublish 3.0, since it is a modified version of openbpublish_theme 6.x-1.12. How do you get your site running on OpenPublish 3.0?

There are ways around these problems, obviously, but they are very labor-intensive. Basically, by making your own private version of openpublish_theme you ensure that that code can never again be upgraded to benefit from the further community work on the bulk of that code. Though there will still be difficulties in upgrading if you use sub-theming, they are guaranteed to be a lot fewer in number and easier than if you cut off the bulk of the code from the larger Drupal community.

@crotown, thanks for your

irakli's picture

@crotown,

thanks for your answers. I could not agree more.

Two additional things:
1. page-front.tpl.php has been cleaned-up in 2.1 (soon to be released) so you can just disable a block to remove twitter-pull driven @openpublish block
2. It is not recommended to immediately override everything in the sub-theme. To get the most out of sub-theming it's recommended to only override things on on-the-need basis.

.............................................
http://twitter.com/inadarei

Can you provide any hints on

ithacaindy's picture

Can you provide any hints on the changes (if any) to the UI of OP2.1? (I'm particularly hoping drop-down menuing made it into the update.)

Absolutely. There is a slick

irakli's picture

Absolutely. There is a slick two-level menu that is easy to back-port to existing themes, as well.

.............................................
http://twitter.com/inadarei

Ooh. I can't wait.

ithacaindy's picture

Ooh. I can't wait.

I had to delete the line from

youngros's picture

I had to delete the line from the original page-front.tpl.php to remove the tweets,. I followed the above instructions and removed from the copy in the subtheme and they stayed put. Using version 2.0

Node folder in the sub-theme

leob's picture

I agree with irakli. I am only override things on on-the-need basis. So my issue now is in regards node-article.tpl.php. I am trying to customize in the sub-theme some variables but I couldn't make those changes work in the sub-theme but when i do it in the OP theme folder it works. I already tried to clean the cache several times, restart my wamp server and nothing happened.
Anybody could help me with some other tips?

Same issue with OP sub-theming

crotown's picture

@leob I am having the same issue and trying to get an answer at http://groups.drupal.org/node/100789. I think it got overlooked here.

@ALL I apologize for recommending sub-theming openpublish_theme at a time when it was nearly impossible given the state of OP and OP documentation. (Nothing is impoossible in Drupal with enough programming effort.) I definitely see why standard practice has been to hack openpublish_theme -- it works with minimal effort at the time, though it makes future upgrades difficult.

Got it straightened out! My error.

crotown's picture

Got my sub-theming difficulty straightened out at http://groups.drupal.org/node/100789. It was my error, and my faith in OpenPublish is restored (and I am embarrassed).

OpenPublish

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: