
Originally Posted by
voltage
I'm using this with 1.3. I would like to wrap a div around the entire news template (it needs a little padding). However, I've looked at the tpl files and they are a different format than the rest of zen and I can;t seem to figure out how to do it.
Hi everybody,
First off, what a great mod! Many thanks Joshua 
I don't know if anybody has posted anything in response to the above question but I was wondering the same thing. How can you wrap a div around the entire news content? It seemed difficult at fist because I tried editing the stylsheet to get some padding on the left but it didn't always work. In addition, on the main page the news content goes within the centerColumn container, but on article pages, comment pages, etc, there is no container, so styles would not be consistent.
Well I may have a solution, try it if you dare!
1. Browse to you includes/classes directory and find 'news.php'.
2. Make a backup just in case.
3. Open up the file for editing (I know it looks a little hectic but it's actually not) and notice that everything is broken into sections. For example you have:
Code:
function newsHeader($header, $date, $links_array = false) {
$this->news_page .= '<div class="newsHeader"><h1>' . $header . '</h1></div>' . "\n";
$this->news_page .= '<div class="newsHeadlineText">' . $date;
if ($links_array && is_array($links_array)) {
foreach ($links_array as $link) {
$this->news_page .= ' | <a href="' . $link['link'] . '">' . $link['text'] . '</a>';
}
}
$this->news_page .= '</div>' . "\n";
$this->clearSplit();
return true;
}
This houses the div classes for the newsHeader and newsHeadlineText.
4. Every section you want to wrap you've got to wrap individually. So for the above you would change the code to:
Code:
function newsHeader($header, $date, $links_array = false) {
$this->news_page .= '<div class="newsWrapper">';
$this->news_page .= '<div class="newsHeader"><h1>' . $header . '</h1></div>' . "\n";
$this->news_page .= '<div class="newsHeadlineText">' . $date;
if ($links_array && is_array($links_array)) {
foreach ($links_array as $link) {
$this->news_page .= ' | <a href="' . $link['link'] . '">' . $link['text'] . '</a>';
}
}
$this->news_page .= '</div>' . "\n";
$this->news_page .= '</div>' . "\n";
$this->clearSplit();
return true;
}
Note the code in red. This is what you must add before and after each specific area you want wrapped listed in this class file. Add the bolded lines at the begining and end of each section you want wrapped or need padding on.
Another example for the articleHeading div:
Before
Code:
function articleHeading($heading) {
$this->news_page .= '<p class="articleHeading">' . $heading . '</p>' . "\n";
return true;
}
After
Code:
function articleHeading($heading) {
$this->news_page .= '<div class="newsWrapper">';
$this->news_page .= '<p class="articleHeading">' . $heading . '</p>' . "\n";
$this->news_page .= '</div>' . "\n";
return true;
}
5. One other very important step would be to add the appropriate CSS to your stylesheet for the 'newsWrapper' style.
6. That's pretty much it. The only other thing I can think of is you may want to account for this additional style padding on your home page by editing your includes/templates/template_default/templates/tpl_index_default.php file where you added the news module (this is what makes it display on your home page) and setting up another div with a negative left margin like so:
Code:
<?php
/**
* get the Define Main Page Text
*/
?>
<div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div>
<?php } ?>
<div style="margin-left: -10px;">
<?php include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_NEWS_SUMMARY_MODULE)); ?>
</div>
<?php
$show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_MAIN);
while (!$show_display_category->EOF) {
?>
Have fun!
- Jonah
Bookmarks