2 columns layout for news
cosmin 269
From: -
From: -
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: 2 columns layout for news
cosmin
OP
269
From: -
From: -
2 columns layout for news
Works great now, thank you.
Works great now, thank you.
1 Re: 2 columns layout for news
Philipp
From: Austria
Administrator
1342From: Austria
2 columns layout for news
Open index.php and find:
and add:
Replace:
with:
Find:
and add:
Find:
and replace with:
Now open category.php and add after:
the following:
Then replace:
with:
Open index.php and find:
$result = DBQuery("SELECT * FROM esselbach_st_stories WHERE (story_time LIKE '%$story_date_array[$a]%') AND story_main = '1' AND story_website = '$website' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') OR (story_time LIKE '%$story_date_array[$a]%') AND story_main = '1' AND story_website = '0' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') ORDER BY story_time DESC");
and add:
$news = mysql_num_rows($result);
$news2 = round($news/2);
$news++;
Replace:
if (!$newsrow)
{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$newsrow = 2;
}
$mainnews .= GetTemplate("news_col_news");
if ($newsrow == 2)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
with:
if (!$newsrow)
{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == $news2)
{
$mainnews .= GetTemplate("news_col_middle");
}
$mainnews .= GetTemplate("news_col_news");
$newsrow++;
if ($newsrow == $news)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
Find:
$result = DBQuery("SELECT * FROM esselbach_st_stories WHERE story_main = '1' AND story_website = '$website' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') OR story_main = '1' AND story_website = '0' AND story_sticky = '0' AND story_hook = '0' AND story_time < ('$currentdate') ORDER BY story_time DESC LIMIT $blocks[website_newsmax]");
and add:
$news = mysql_num_rows($result);
$news2 = round($news/2);
$news++;
Find:
if (!$newsrow)
{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$newsrow = 2;
}
$mainnews .= GetTemplate("news_col_news");
if ($newsrow == 2)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
and replace with:
if (!$newsrow)
{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == $news2)
{
$mainnews .= GetTemplate("news_col_middle");
}
$mainnews .= GetTemplate("news_col_news");
$newsrow++;
if ($newsrow == $news)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
Now open category.php and add after:
$result = DBQuery("SELECT * FROM esselbach_st_stories WHERE story_category = '$id' AND story_website = '$website' AND story_hook = '0' AND story_time < ('$currentdate') OR story_category = '$id' AND story_website = '0' AND story_hook = '0' AND story_time < ('$currentdate') ORDER BY story_time DESC LIMIT 20");
the following:
$news = mysql_num_rows($result);
$news2 = round($news/2);
$news++;
Then replace:
if (!$newsrow)
{
$categorynews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 1)
{
$categorynews .= GetTemplate("news_col_middle");
$newsrow = 2;
}
$categorynews .= GetTemplate("news_col_news");
if ($newsrow == 2)
{
$categorynews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
with:
if (!$newsrow)
{
$categorynews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == $news2)
{
$categorynews .= GetTemplate("news_col_middle");
}
$categorynews .= GetTemplate("news_col_news");
$newsrow++;
if ($newsrow == $news)
{
$categorynews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
1 Re: 2 columns layout for news
Philipp
From: Austria
Administrator
1342From: Austria
2 columns layout for news
The example I posted work only with 20 news stories, but I will look into in tomorrow.
The example I posted work only with 20 news stories, but I will look into in tomorrow.
1 Re: 2 columns layout for news
cosmin
OP
269
From: -
From: -
2 columns layout for news
I can't get it to work. I've sent you a more detailed e-mail.
I can't get it to work. I've sent you a more detailed e-mail.
1 Re: 2 columns layout for news
Philipp
From: Austria
Administrator
1342From: Austria
2 columns layout for news
This would require some changes in index.php as well category.php.
You could try to replace:
with something like this:
This example should add the break (news_col_middle) before news #11 and the footer after news #20.
This would require some changes in index.php as well category.php.
You could try to replace:
if (!$newsrow)
{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 1)
{
$mainnews .= GetTemplate("news_col_middle");
$newsrow = 2;
}
$mainnews .= GetTemplate("news_col_news");
if ($newsrow == 2)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
with something like this:
if (!$newsrow)
{
$mainnews .= GetTemplate("news_col_header");
$newsrow = 1;
}
elseif ($newsrow == 11)
{
$mainnews .= GetTemplate("news_col_middle");
}
$mainnews .= GetTemplate("news_col_news");
$newsrow++;
if ($newsrow == 20)
{
$mainnews .= GetTemplate("news_col_footer");
$newsrow = 0;
}
This example should add the break (news_col_middle) before news #11 and the footer after news #20.
I do not want to use tables, so I went around changing templates. I've resorted to a CSS layout which gave pretty good results with Google. It all worked out until I got to changing the 2 column news layout.
How can I get the news to appear like this?
http://www.file-portal.net/test/test_2_col.html
I've changed the news_col_footer,news_col_header, news_col_middle templates, but because they loop, when changing the layout, the left and right div loop, and the result is not only different from what I want it's bad in a different way, especially in Opera.
http://www.file-portal.net/test/loop_problem.html
I mean, why do the header and footer loop? Shouldn't they work more like the site header and footer in this particular case?