I read so many posts about splitting content in multiple column, but didn't find a simple solution to my needs.
How can I split main content in two columns rather than displaying it in a single column?

I need to modify the page_"page-alias" phptemplate file, so that the content is, for the specified url, displayed differently. In all other cases the content is displayed in a single column. I know I need to modify the print $contentfunction, modifying template.php too, but I can't understand if I only need to modify page_"page-alias" file or also node_"node-alias" file in my phptemplate theme.

Any answer is really appreciated.

Thanks.

Comments

coreyp_1’s picture

I cant think of three ways to do it:

  1. Create a custom .tpl.php for the specific page.
    • Information on this method can be found here. Basically, the .tpl.php will be called something like "page-node-#.tpl.php", where "#" is the number of your node.
    • This method will only affect that one page. If you want a second page to be two-column as well, you will need to provide a second .tpl.php for that node #.
  2. Use ConTemplate and CCK to make an open-ended solution.
    • ConTemplate will override the $content variable, and you can use PHP to do so. The problem is that you don't want to do it all the time, so that's where CCK comes in.
    • Use CCK to set up a check box, calling it "2 column layout", for example. Now, when using ConTemplate, you can check the value of the checkbox. If it is not set, then just return the normal text. If it is set, then return the 2-column markup.
  3. Set up a second content type for the 2-column nodes.
    • This has the advantage of only needing one tpl.php file for the content type (i.e., no need to use ConTemplate or CCK).
    • This has the disadvantage that you have 2 separate content types. If someone creates a 1-column version, and then later wants it to be 2-column, it is difficult to change node types.
    • You will always see both types in the node/add page.
    • It is a design preference. Personally, I don't like the idea of creating a new content type (a data structure) for what is essentially a cosmetic variation.

The first method is quick, but must be duplicated for each additional node that you want to present as 2-column.

The second method takes longer to set up, but will meet your needs forever. Setting a second (or third, or fourth, or hundredth...) node to 2-column is as simple as clicking one checkbox, as opposed to ftp-ing new files to the server.

The third method is somewhere in between.

Personally, I would probably go with option #2, but that is just my opinion. It all really depends on the situation.

- Corey

enli’s picture

Thank you for your reply. option #1 was my choice when I wrote this post. There are many solutions, ( http://drupal.org/node/46415 , http://drupal.org/node/38235 and also http://drupal.org/node/44596 ), I tried setting up all of the solutions show in these posts, but I was not able to make them work.
http://drupal.org/node/44596 could be useful for my needs, but unfortunately I didn't understand where to place the "HTML comment to serve as a delimiter" <!-- NODESPLITDELIMITER -->, so that in my page the first section of content is displaying the full content.
Please take a look if you can help somehow.

enrico

http://www.enricolippi.net

coreyp_1’s picture

<!-- NODESPLITDELIMITER --> is typed directly into the content of the Node. If you are using a WYSIWYG editor, it may be interfering with the code, changing it to &lt;!-- NODESPLITDELIMITER --&gt;.

- Corey

enli’s picture

Thanks for your reply, but I found out that it is a problem of "input formats".
In fact, when I chose "Filtered HTML" (HTML filter active), the splitted content is displayed in the first column following the first part of content, whereas if I chose "Full HTML" (HTML filter inactive), the splitted content is correctly displayed in the second column.

There seemed to be a problem of reading with the filters, so I tried to add <!-- NODESPLITDELIMITER --> to the list of allowed HTML tags, but this doesn't change the result: "Filtered HTML" isn't working with <!-- NODESPLITDELIMITER -->, so that the HTML comment is filtered and the splitted content is displayed in the first column, as if <!-- NODESPLITDELIMITER --> wasn't put at all in the node text.

It is clear that the problem is with the "HTML filter", since when I turn on HTML filter in the "Full HTML" settings page, <!-- NODESPLITDELIMITER --> isn't read anymore. By turning off the HTML filter,

is read and the content is correcty split. I also tried to add in the text and/or in the HTML filter &lt;!-- NODESPLITDELIMITER --&gt;, but nothing changed.
Do you think there is a solution to this problem?

enrico

http://www.enricolippi.net

span’s picture

I'm very new to Drupal and I'm curious on how to go about the setup you mention in #2 in more detail. I've got the modules installed but i don't really understand where I can set up the return function that checks the checkbox.

A hint perhaps?

- Daniel

carolaun’s picture

I am realy interested, too, how to get the second solution be set up. I have not worked with ConTemplate before. What do I have to put in to get 2 columns? What exactly do I have to do with CCK?