Omega page templates

cyptm's picture

Hi all,

I need some assistance here with more of a best practice question regarding the omega theme. With other themes I would normally have a page--front.tpl.php file which would control the layout of the front page and all other pages would just fallback to the regular page.tpl.php. variables in these pages would essentially be regions that were just printed out like "print render($page['sidebar'])"

In omega the difference is that 'sections' are printed out instead:

<?php
print render($page[header]);
?>
<?php
print render($page[content]);
?>

How does one create a different layout for the front page in Omega considering that 'sections' are what are printed in the default page.tpl.php. And the layout is intended to be controlled in the them settings administration. I can easily print bits and pieces from the $page array i.e "print render($page['content']['some_zone']['some_region')" and create a different layout but I'm looking for the intended (best) way of doing this in Omega.

Please and thank you!

Comments

This is done using the Delta

kulonlz's picture

This is done using the Delta and context modules. There's a link to everything you need on the Omega download page.

That Worked!

cyptm's picture

Thanks alot! I installed the Delta and Context modules and what and they worked like a charm!!

thanks again.

what about changing node elements only?

avolve's picture

As a follow up question, I want to make changes to a single (custom) node display, moving around fields.

Basically, I am looking to accomplish two things (upgrading a site from D6, with minor modifications)

  1. Place a custom field above the node title (or replace the node title with another field in the page title)

  2. Display the first image from an image field above the the node body, with the remaining images below the node body.

As with the OP, in the past I would have modified a page--NODETYPE.tpl.php (two dashed for Drupal 7).

Is this possible with Delta and context (can not currently see how to do this). Is so is it overkill?

What is the best practice approach for this, in line with Omega's page.tpl structure?

Any suggestions appreciated.

I assume you would just

kulonlz's picture

I assume you would just create a new content type, almost exactly like you would in d6. I'm not sure why you would need to modify the template in either case.

It's under admin/structure/types

Changing node elements only

cyptm's picture

avolve,

If you wanted to change node type elements you would have to tackle that on the node level. In fact per Drupal's API http://drupal.org/node/1089656 the template "page--NODETYPE.tpl.php" is NOT a core template suggestion. Instead you would use, "node--type.tpl.php."

In your node--type.tpl.php you have access to the entire node object and can display the individual elements however you like.

hope that helps.

If you google around, you can

patrickavella's picture

If you google around, you can tell Drupal to use a specific node.tpl based on path via the template.php file. You definitely want to theme a node.tpl for what you want though. If it's for a single node it's probably the easiest to just create a new content type then theme the node.tpl for that node-type like suggested above.

Delta/context won't let you move fields around.

An alternative may be using either display suite or just using a view with fields if you don't want to get your hands dirty with more tpl files.

It's simple enough in Omega

kulonlz's picture

It's simple enough in Omega to theme individual pages without creating another tpl file. You're given so much markup to work with, all you have to do is include the page id while styling it in CSS. Unless what you're trying to do is more complicated than what you've stated, I really think creating a content type, along with using the Delta module can produce what you need. I'm not saying that you never need to create new files, I just don't see why you need one for this.

Thanks for the replies. I

avolve's picture

Thanks for the replies. I adopted a different approach to what I was initially seeking to do, after familiarising myself a little more with the way Omega (and Drupal 7) is set-up.

This includes a node--TYPE.tpl.php and views for a teaser page.

page.tpl.php suggestion for node type

Mark123's picture

Beware of thinking "since I can't think of a reason for it, you don't need it"!
Sometimes you may need a tpl.php file for a page based on a node type. One reason is to add a Quicktabs tab set.
As noted above, Drupal doesn't recognize such suggestions by default. You can add a preprocess function to make it do so, however. See http://drupal.org/node/1142800 .

Albany, NY

Group organizers

Group notifications

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

Hot content this week